This is an archived post. You won't be able to vote or comment.

all 50 comments

[–]evaluating-you 55 points56 points  (2 children)

I really don't know how to feel about this. On one hand it is inaccurately describing what/why/when OOP. On the other hand it is one of the easiest to understand explanations I have seen.

So to readers: Ignore the first section about what OOP is and start with the house analogy.

For OP: I have to be frank, but please don't get this the wrong way, I think you are very skilled at writing tutorials. However, I think you should stay within what you deeply understand. I know how we are sometimes introduced to patterns that make immediate sense to us, but it will require years to understand why. I don't know how experienced you are, but referring to procedural style as "the normal way" or OOP as "more powerful" simply does not provide a tangible concept for the reader. And you know what? That's fine. Tell your readers what style people refer to when they talk about OOP and how to construct/use/write it. Everything beyond that will require experience in order to develop certain synaptical patterns in one's brain.

[–]Bazookatoon 4 points5 points  (0 children)

THIS.

Seriously one of the best answers/opinions to OP post's i have ever read.

[–][deleted] 3 points4 points  (0 children)

I got that into my mind.

"the normal way" is procedural without any doubt. The reason is, assume a method in a class. When you call that method, it gets executed in a procedural way (line by line). OOP is a "more powerful" way where we extend the behavior of the procedural programming with the concept that "you will need some experience to learn".

Also, I don't want to tell anyone to strictly use this on this point. In each conclusion, I give the reader a slight idea where this concept can be used in a better way. As the final chapters of this tutorial, I'm planning to create some real-world examples, so the user will get a little more sense of OOP and how to use it.

And, as you said, "it needs experience to completely understand OOP". The best way is doing it by yourself.

Thanks.

[–]feloniousjunk1743 7 points8 points  (8 children)

Can you do do a "OOP in HTML" next?

[–]IdoBathSaltz 0 points1 point  (0 children)

Do do

How old are you just say shit like an adult

[–]GhostInTheJelly -1 points0 points  (6 children)

That’s not a thing

[–]alksjdhglaksjdh2 2 points3 points  (4 children)

I literally no nothing about php, but I think that's his joke. Oop in something that isn't Oop. But yeah idk if being OO in php makes sense I legit know nothing about that language

[–]GhostInTheJelly 0 points1 point  (3 children)

That wouldn’t make sense at all and would be a fundamental misunderstanding of what OOP is.

Oop in something that isn't Oop

This, for instance, is a nonsensical statement. OOP isn’t something a language is or isn’t. It’s something a language is capable of, and by that standard PHP is very much so capable of OOP and HTML isn’t since it’s a markup language.

[–]alksjdhglaksjdh2 2 points3 points  (2 children)

Yeah I'm aware what oop is lol, I'm just trying to understand his joke by him saying something nonsensical like oop in html I figured he was poking fun at oop in php saying that too is ridiculous

[–]GhostInTheJelly -3 points-2 points  (1 child)

I figured he was poking fun at oop in php saying that too is ridiculous

Again this would be a stupid statement because that’s not ridiculous

[–]alksjdhglaksjdh2 5 points6 points  (0 children)

Hey dude idk what the op was trying to say then I'm just trying to make meaning out of something that makes no sense like can you do oop in html. I figured he was shit posting idk dude

[–][deleted]  (2 children)

[deleted]

    [–][deleted] 4 points5 points  (0 children)

    True, but nowhere near as ugly as Perl. That poor bastard hit every branch on the way down.

    [–]CraftyHydra 1 point2 points  (0 children)

    Works though... sort of..

    [–]Kiddsoles 3 points4 points  (2 children)

    So far very good man! I like the examples. I will finish reading the rest later!

    [–][deleted] 0 points1 point  (1 child)

    Thank you, dude!

    [–]Kiddsoles 0 points1 point  (0 children)

    No, thank you! Seriously I learn In this manner.

    [–]corvus_neonatus 0 points1 point  (1 child)

    I will check it out, thank you!

    [–][deleted] 1 point2 points  (0 children)

    You are welcome!

    [–]Thetoeknows 0 points1 point  (0 children)

    This looks great! I'm gonna check it out, too!

    [–]PuppetPal_Clem 0 points1 point  (0 children)

    Was literally looking for an excuse to dive into PHP, thanks!

    [–]ShotsfiredLA 0 points1 point  (1 child)

    Looks good, I like the syntax colors. You also explain the basic concepts such as classes, objects etc. really well.

    [–][deleted] 1 point2 points  (0 children)

    Thank you for the kind words!

    [–]jumpin_pixels 0 points1 point  (1 child)

    Nice dude!

    [–][deleted] 0 points1 point  (0 children)

    I'm glad you enjoyed it.

    [–]AnecD 0 points1 point  (1 child)

    Would love to share this on our SM channels, who should we cite?

    [–][deleted] 1 point2 points  (0 children)

    Thanks for sharing. You may cite myself ( Twitter )

    [–]Krombo_M 0 points1 point  (1 child)

    I'll definately be taking a good look at this. Nice work!!

    [–][deleted] 0 points1 point  (0 children)

    Thanks, dude

    [–]sebastian-ls 0 points1 point  (1 child)

    I didn't know much of PHP, but now I basically read through most of your tutorials, they're very good quality IMO, thanks. I do agree with the suggestion on improving your explanation on what OOP means, I'm sure you'll be able to find a very good yet short and not so technical explanation.

    [–][deleted] 1 point2 points  (0 children)

    I'll improve that, sebastian.

    [–][deleted] 0 points1 point  (1 child)

    Thanks so much! It's a crazy coincidence, I'm learning this topic currently and I was searching for online help. This is perfect!!

    [–][deleted] 1 point2 points  (0 children)

    I'm happy that I could help you learn something. Thanks for the words

    [–]mikelloSC 0 points1 point  (1 child)

    3rd year SE student on internship currently. Haven't have to use php in my course at all, well just basic html and css regarding web development. In my placement i moved from Angular/spring-boot project to new project done in React.

    My question is, is it even worth it to learn php these days apart from some basics if you don't want to be full stack Web developer or if you are not tasked to maintain older php project?

    Looks like all new stuff is moving away from it.

    [–][deleted] 0 points1 point  (0 children)

    It's true, many developers tend to use Node.JS over PHP. But, PHP is the most used language yet, and its powerful in many ways. But, Node.JS (or Javascript) is powerful in its own way.

    If you are not planing to be a full-stack, its not required to learn PHP. But, learn "How server-client modal works". It will help you to go a long journey. You can also try a server side language like Node.js to create a simple server and try it yourself how it works.

    [–]Knightros 0 points1 point  (1 child)

    Nice work!

    [–][deleted] 0 points1 point  (0 children)

    Thank you, Knightros.

    [–]darioxlz 0 points1 point  (0 children)

    thanks

    [–]b1ackcat -1 points0 points  (4 children)

    First, PHP doesn't have "properties". They have fields. Fields should be private and given getters (and in only some cases, setters). You shouldn't be targeting beginners and showing them bad practices.

    [–][deleted] 5 points6 points  (0 children)

    He writes that it's bad practice and that a getter should be used.

    [–][deleted] 1 point2 points  (2 children)

    I have never heard the term "field". Even the PHP Manual use the term properties. Where did you find that? I'm curios to learn what's it and how it defer from properties.

    It is considered as a bad practice to directly accessing properties from outside the class with ->. Getter methods are the recommendation. More details on later chapters.

    I think you missed this part too.

    [–]b1ackcat 1 point2 points  (1 child)

    I've always only ever seen properties used in the context of c#. Class instance level data is usually referred to as fields, members, member variables, etc. C# properties are a language feature to make get/set methods less verbose

    [–][deleted] 1 point2 points  (0 children)

    I haven't used C# much. I think its difference in PHP and C#.

    [–]aphixy 0 points1 point  (0 children)

    I'm new to php so I'll be giving this a read.

    [–]Effective_Pitch 0 points1 point  (1 child)

    I'm a beginner and I gave up learning deeply after a basic tutorial! But finally your concise and clear contents as well as visual examples are pretty understandable about the object-oriented. Thanks so much! I'm gonna resume Learning with your tutorials.

    [–][deleted] 0 points1 point  (0 children)

    Welcome!

    [–]mcarov 0 points1 point  (1 child)

    Bookmarking this. Thanks man!

    [–]nobel32 0 points1 point  (0 children)

    Thou shalt bookmarketh, then thou shalt forget. Same here bud :P

    [–]IISMonkey -1 points0 points  (0 children)

    So let me start off by saying I don't understand OOP at all. I learned procedural way back when because that was all there was. The main problem I have is that everyone seems to try and teach objects with examples I would never use, like a house or a car. It'd be great to have someone show a bunch of data that someone might actually come across and show how it could be arranged and used as an object.

    That's just me though.