Jump to content

Learning PHP, Should I start also with OOP ?


JZK

Recommended Posts

Hey guys,

 

I just started to learn PHP and I think I'm making finally some progresses what really makes me happy :)

I'm sure that everybody knows that from begining (and not only) is really lot's of stuff to understand and postprocess so I would like to ask You guys, do You thing, I should include to my learning schedule also OOP, despite it's now really confusing me, or it's possible to learn it later as separated part for larger project's. I understaned principes, but for my small aplications is OOP really not necessary now. However, in future I would like to know it! :)

 

Thank's ;)

Link to comment
Share on other sites

It's a lot easier to get a firm grasp on procedural coding first and then work your way up to OOP if that's what you desire.

 

OOP is a different way of thinking with objects, methods and properties versus just procedures.(where everything can become an object)

 

The class is basically the blueprint of the object and a way to store methods/functions and properties/values

Methods are functions and part of the object

Properties are values of the class and part of the object

 

I think the key to understanding php coding is to learn what it can do, the functions, manipulating and sorting data such as arrays and values.

It's a lot simpler and faster to write procedural coding than to construct something in OOP, it would overcomplicate it.

For those coming from a strict language have to take into account php is a loose language and almost a free-for-all, a little imagination and can do some very interesting things with php.

 

So here is the php manual and the tutorial, lots of information around the net is outdated, wrong or bad practices.

 

If have a question or get stuck the people here are glad to answer them.

Link to comment
Share on other sites

I would like to add to QuickOldCar, not everything requires OO either.  Unless you are building some large framework or need an application interface when working with a team of developers, OO might be overkill.  Functional Programming is the better choice when you need server side processing on "trivial" (relative to project scope) functionality.  

 

That said, OO is important and should eventually be in your learning path.

Link to comment
Share on other sites

Just to add my two cents, I agree with QuickOldCar and rwhite.  OOP can be extremely useful down the line, but not necessary to get you off the ground, particularly when you're writing all the code yourself, and for many jobs I still use functional coding when OOP is (to use rwhite's phrase) 'overkill'. (which for me is most of the time!)  

 

I come across OOP most of all when I'm working on a project where many different programmers are involved, so if that's a possibility for your career path, then it is worth it from that perspective.

Link to comment
Share on other sites

Just to throw in here, I agree that starting with a procedural style does lessen the learning curve for the language as a whole. Once you're truly and thoroughly comfortable with php's functions, stylistic conventions, and quirks, you can set your eyes on OOP. The nice thing, as I'm sure you've already seen, is that php itself is becoming more and more object-oriented at the source, so you'll come across some to quite a bit of it even as you're learning procedural php and that should make the transition a little easier once you get to that point.

 

As for OOP being overkill, I think it can be on occasion. That being said, I do find it easier (now, anyway) to code with objects in all of my projects. I work with WordPress every day and all of my custom code involves objects and classes; sure, the patterns may not be as robust as they would were I maintaining or creating a full-fledged framework or larger integrated system, but I do find it easier to think in terms of objects and classes. So now, any project I start from scratch is written OOP-style from the outset, then refactored as I go on for pattern adherence and ease of use and maintenance.

 

Again, this is now - it took a lot of time for that shift in thinking to happen, and it was gradual and is still ongoing. That's really the biggest thing. You'll never completely learn php (or anything, really), so to answer your question - yes, you should include OOP in your learning schedule. You just don't have to include it yet - there's plenty of time, and plenty to learn.

  • Like 2
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.