Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
In this video we’ll take a look at the project we will use to learn the basic constructs of object-oriented programming.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Hi.
0:00
I'm Alena, and
0:01
today I'm going to introduce you to
object oriented programming in PHP.
0:06
PHP is a procedural language at its heart.
0:11
In our previous PHP courses,
0:14
we've mostly used procedural code in
our projects In procedural programming
0:16
you specify a set of ordered steps needed
to implement the requested functionality.
0:21
This can make our program easy to read,
0:26
because we can just walk
through it step by step.
0:28
However, as our code base grows,
it can become harder and
0:31
harder to remember everything we just
read, and how it all fits together.
0:35
Organizing our code can help.
0:41
We can group code that's
used multiple times
0:43
into a function that can be
referenced throughout the program.
0:45
We can also group our functions
into a single file so
0:49
that we know where to find them.
0:52
In addition, we can group functions
into separate files that are organized
0:54
based on the functionality.
0:59
For example, we could group all functions
that deal with math into one file.
1:01
And all functions that deal with
products into another file.
1:06
Object-oriented programming gives
us an even more powerful way
1:09
to organize our code.
1:14
Object-oriented programming lets us
group data, as well as functions,
1:15
into a specific topic or
piece of functionality.
1:20
If you've completed our PHP courses
on building a basic website,
1:24
you've already been using objects.
1:28
This course will help you
more fully understand
1:30
the concepts involved in object
oriented programming and
1:33
give you the skills you need
to create your own objects.
1:37
Although the terms object and class
often appear to be used interchangeably,
1:41
they are not the same thing.
1:46
A class is like this instruction booklet.
1:48
It tells us which pieces to use,
and how to put them together.
1:51
The object is like this finished piece.
1:55
To give you a clear understanding
of how to use objects and
1:58
classes, we'll be creating
a cookbook full of recipes.
2:01
Let's review the finished project.
2:05
We'll create a cookbook collection
full of recipe objects,
2:08
from there we'll be able
to perform some actions.
2:12
We can display the recipe
titles from our cookbook.
2:16
We can display a shopping
list of ingredients.
2:22
Or we can display an individual recipe.
2:28
By the end of this course you'll be able
to structure and utilize your own objects.
2:36
After that, you'll be ready to launch
into more detailed explanations
2:42
of the terminology and concepts
surrounding object-oriented programming.
2:45
Once you dive into the concepts and
terminology,
2:50
you'll really start to understand
the power of object-oriented programming.
2:53
If at any time we hit a particular area
where you're struggling to follow along.
2:58
Remember, you can always slow down or
speed up the playback of these videos.
3:02
I also include more information
in the teacher's notes.
3:08
So don't forget to check
those out as well.
3:11
And finally, we have an awesome
community of fellow students
3:14
who can help you through
a difficult section.
3:18
Sometimes it just takes
another perspective and
3:20
I'll be here to guide you through each
step of the way, so let's keep going.
3:23
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up