What is OOP?
45sExplains the core concept of OOP in a relatable way, addressing common confusion.
▶ Play ClipThis video introduces object-oriented programming (OOP) in PHP, contrasting it with procedural programming. The instructor explains that OOP uses classes, properties, and methods to organize code into reusable containers, which is especially beneficial for larger applications and team collaboration.
The video is the first in a series on object-oriented programming using PHP, explaining what OOP is for beginners.
Procedural programming inserts PHP code directly into HTML documents where needed, while OOP uses separate documents containing classes.
Classes are containers for code related to a specific thing; they contain properties (variables) and methods (functions).
A login class can be reused across different pages (e.g., sign-up form) without rewriting code.
OOP is standard in marketing agencies and team environments because it provides a common format that all programmers understand.
For small personal projects, procedural is fine; for larger applications, OOP offers more benefits. Some programmers disagree on which is better.
OOP is taught differently across tutorials due to various design patterns (e.g., constructor pattern, MVC).
This series will use the MVC (Model-View-Controller) pattern, a popular design pattern for OOP in PHP.
OOP in PHP organizes code into classes for reusability and standardization, making it essential for larger projects and team collaboration. The series will use the MVC pattern to teach OOP effectively.
"The title accurately describes the content: an introductory explanation of object-oriented PHP."
What is the main difference between procedural and object-oriented PHP programming?
Procedural programming inserts PHP code directly into documents where needed, while OOP uses separate documents containing classes.
0:57
What are classes, properties, and methods in OOP?
Classes are containers for code related to a specific thing; properties are variables inside a class, and methods are functions inside a class.
1:41
What is one benefit of using OOP for larger applications?
Code reusability: a class can be reused across different pages without rewriting code.
2:06
Why is OOP considered a standard in marketing agencies?
Because OOP provides a common format that all programmers understand, facilitating collaboration.
3:21
Is OOP always better than procedural programming?
No, for small personal projects procedural is fine; OOP is more beneficial for larger applications. Some programmers disagree on which is better.
4:04
What design pattern will this series use?
MVC (Model-View-Controller) pattern.
6:29
Why might OOP be taught differently across tutorials?
Because there are different design patterns (e.g., constructor pattern, MVC) that instructors may choose to emphasize.
5:23
Procedural vs OOP
Clearly defines the fundamental difference between the two programming paradigms.
0:57Code Reusability
Highlights a key practical benefit of OOP for larger projects.
2:06Industry Standard
Explains why OOP is important for professional development and team collaboration.
3:21OOP vs Procedural Debate
Acknowledges that OOP is not universally superior, providing balanced perspective.
4:04MVC Pattern Introduction
Sets expectations for the series' structure and design pattern.
6:29[00:00] how it going guys I'm back to another
[00:02] series on how to do op oriented
[00:03] programming using PHP code now because
[00:07] this is the first episode in optic
[00:08] oriented programming I'm going to spend
[00:10] this episode explaining what exactly
[00:12] optic oriented programming is because
[00:14] it's very important that you guys
[00:16] understand what it is if you have never
[00:18] done anything with objectoriented
[00:19] programming before so if you're
[00:21] completely familiar with objectoriented
[00:23] programming you don't need to watch this
[00:25] episode The reason I want to do a small
[00:27] episode on just explaining what exactly
[00:29] it is is because I remember back when I
[00:31] was learning object oriented programming
[00:33] you know back when I was studying my
[00:35] bachelors um the teacher had a specific
[00:38] way of explaining optic oriented
[00:40] programming that didn't make sense to
[00:42] the entire class so it's very important
[00:45] to me that I understand this in a way
[00:46] that you guys understand it and know
[00:48] exactly why we need to use op oriented
[00:51] PHP programming versus the other way we
[00:54] do it in the past okay now when it comes
[00:57] to PHP programming the way been doing it
[01:00] in my other series that's just called
[01:02] PHP um we use something called procedure
[01:05] programming now what that means is that
[01:08] when we have a website such as just a
[01:10] regular website with a login system we
[01:12] would just go ahead and create the PHP
[01:14] code and insert it inside the document
[01:17] whenever we needed to use it meaning
[01:19] that if I had a sign up form inside my
[01:21] website I would just create the PHP code
[01:24] inside the HTML page or inside the PHP
[01:27] document uh where I had the sign up for
[01:30] form whereas in object going into phsp
[01:33] programming we create separate documents
[01:36] only meant for PHP code that has
[01:39] something in it called classes now
[01:41] classes contain something called
[01:43] properties and methods that we use
[01:46] regarding one specific thing inside our
[01:48] website now if that sounded confusing it
[01:51] will sound confusing if you've never
[01:53] done anything with optic ored PHP
[01:54] program before so don't get scared that
[01:57] you don't understand what classes and
[01:59] properties methods are just go ahead and
[02:02] follow the lessons and you will
[02:03] understand in no time so the basic idea
[02:06] here is that let's say we have this
[02:07] login system inside a website and I need
[02:10] to create the PHP code for this login
[02:12] system now what I can do instead of just
[02:14] creating the code where I need to use it
[02:16] inside my phsp document I'm going to go
[02:19] ah and create a separate document that
[02:20] has a class which is just a very big
[02:24] container to a lot of code that I use
[02:27] regarding login systems so this class
[02:30] might be called
[02:31] login now inside this login class we
[02:34] have properties and methods which is
[02:36] another way of saying we have variables
[02:38] and functions that are saved inside this
[02:41] class now don't get me wrong properties
[02:43] and methods are not the same as
[02:46] variables and functions but they work in
[02:48] a very similar way okay so inside this
[02:51] class regarding login systems we have
[02:54] code that does something regarding the
[02:56] login system and because we do it this
[02:59] way way if I were to do anything else
[03:02] inside the website you know in another
[03:03] page regarding a sign up form I can
[03:06] reuse the code inside the class rather
[03:08] than creating the code again inside the
[03:11] website okay so we can actually reuse
[03:13] code again and again and again which is
[03:16] one of the benefits from using op gr to
[03:18] PHP
[03:19] programming now another benefit from
[03:21] optic gr to PHP programming is that when
[03:24] you if you want to work at a marketing
[03:27] agency you know a place where they
[03:28] actually create websites for companies
[03:29] and that sort of thing it's pretty much
[03:32] a standard today that you need to
[03:34] understand after gr to PHP programming
[03:36] because oop which is what we call optic
[03:39] oriented PHP programming is a format
[03:42] that all programmers understand with
[03:44] procedural code I have one way of coding
[03:47] it another programmer has another way of
[03:49] coding it meaning that we might not
[03:51] understand the code that each you know
[03:53] each person wrote so op to go into PHP
[03:55] programming kind of solves that problem
[03:58] because we need to understand with other
[04:00] people program when we have other people
[04:02] that we work with now you might be
[04:04] asking well is optic ored PSP
[04:06] programming better than procedural
[04:08] programming you know we just create the
[04:09] code wherever we need to use it inside
[04:11] our document well if the code is just
[04:14] meant for you to use and you just create
[04:16] the code for small applications then no
[04:19] it doesn't matter if you do optic rer
[04:21] phsp programming or procedural
[04:23] programming like a login
[04:25] system I would say it's borderlining you
[04:27] know where you need to start considering
[04:29] us using optic run to phsp programming
[04:31] because now you're starting to create a
[04:33] lter application but I just want to
[04:35] highlight that a lot of people at least
[04:37] a lot of programmers don't believe that
[04:39] optic ored PSP programming is better
[04:42] than procedural some people think they
[04:44] do exactly the same thing where a person
[04:46] like me think that optic rer PSP
[04:49] programming if used right can do a lot
[04:52] more beneficial things when it comes to
[04:54] larger applications so if you're
[04:56] watching this series and thinking well
[04:58] optic R to PSP programming sounds much
[05:00] too complicated or might be too
[05:02] difficult to learn versus what you're
[05:04] actually getting out of it then you
[05:06] shouldn't look at it as a bad thing to
[05:09] just want to go with procedural
[05:10] programming just remember that if you
[05:12] want to work with this in the future
[05:14] you're going to need to look into optic
[05:16] R into phsp programming but it's really
[05:18] not that difficult to learn I just want
[05:19] to empathize that because it really
[05:21] depends on who's explaining it to you
[05:23] now another thing I want to mention
[05:25] regarding optic run into PHP programming
[05:27] which is one thing that if you guys have
[05:29] actually been good Googling it looking
[05:30] for tutorials is that when you go to
[05:33] different tutorial sites object oriented
[05:36] phsp programming will be taught
[05:39] differently by pretty much everyone and
[05:41] the reason for this is that we have
[05:43] different patterns in optic R to PHP
[05:46] programming now what patents means is
[05:49] that when you have optic PHP programming
[05:52] you have a specific formula or a
[05:54] specific pattern that you create the
[05:57] code in meaning that if I were to learn
[05:59] this from one website uh they might be
[06:02] using something called Constructor
[06:03] patents where another tutorial series
[06:06] might not be using Constructors which is
[06:08] something that we will be talking about
[06:09] in this series here because Constructors
[06:11] seem pretty important when it comes to
[06:13] having the proper format of op ored PHP
[06:16] programming but it's different what
[06:19] people teach you when it comes to op
[06:21] ored PHP programming so I just want to
[06:23] mention before you get started on this
[06:25] series that what we're going to be doing
[06:27] is we're going to go ahead and use
[06:29] what's called an MVC pattern which
[06:31] stands for model view controller and
[06:34] it's a pattern that was created quite a
[06:35] while back which was used mainly for
[06:38] other types of programming languages but
[06:41] has been incorporated into PHP when it
[06:43] comes to oop programming and we're going
[06:46] to go and using this series here now in
[06:48] the next episode I will be explaining
[06:50] what exactly an MVC model is you know
[06:52] model view controller and why we need to
[06:55] do it this way at least when it comes to
[06:56] my tutorial series here in the future we
[06:59] might might be looking into other design
[07:01] patterns but for now in the beginning
[07:03] here we're going to focus on the NVC
[07:05] pattern since it's pretty popular out
[07:06] there so I hope you guys enjoyed and
[07:09] I'll see you guys next
[07:13] time
⚡ Saved you time reading this? Transcribe any YouTube video for free — no signup needed.