Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I posted a similar question on the PHP section of stackoverflow and was told that this might be a better forum in which to submit my question.

Without any programming experience whatsoever, I started studying PHP beginning in the second quarter of this year with the goal of slowly building my dream website starting later this summer.

Just as I was wrapping my head around PHP and beginning--I felt-- to truly understand the different concepts and how the code works (this is why I prefaced my post with my non-experience--I've really had to bang and cram it all in my head), I come across Object Oriented PHP.

I've taken the approach of of mastering (trying, as much as possible, at least) as many of the concepts and ideas before diving in to try and create my own scripts; much like learning how to dribble, throw a baseball or football well, before playing a single game. (of course I've played around with and done some code -drills).

My question to the experts is this: Should or must I learn and delve deep into Object-Oriented-PHP, thus delaying my "start-to-code" date? Or will procedural PHP Programming suffice if one would like to build good E-commerce, forum/comment-type (like PHP Help) or basic social networking websites?

How far will procedural programming take me? A site with 1,000; tens-of-thousands; hundred thousand visitors?

Thanks in advance for your expert insights.

share|improve this question

closed as too localized by Jim G., Jarrod Roberson, Walter, gbjbaanb, MainMa Jul 15 '12 at 14:21

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

It is impossible to say anything unless you describe the website you want to build. –  superM Jul 13 '12 at 18:14
Obligatory: codinghorror.com/blog/2008/05/… –  Robert Harvey Jul 13 '12 at 18:21
Let's say an e-commerce for a major retailer like Macys or QVC or forum/review site like yelp. –  Chris Jul 13 '12 at 18:21
Facebook uses PHP, although they did rewrite their engine from scratch, because the original one wouldn't scale to millions of users. –  Robert Harvey Jul 13 '12 at 18:25
This is not a forum. –  DeadMG Jul 13 '12 at 19:30
show 4 more comments

5 Answers

Should or must I learn and delve deep into Object-Oriented-PHP, thus delaying my "start-to-code" date?

Must? No.

You can use whatever works to get things done. Procedural code has some limitations and some benefits.

The bigger issue is that your first site is going to be horrible, no matter what language or style you use. Your second and third sites likely as well. There's more than just syntax to learn in order to make good sites, and it will behoove you to keep focused on incremental improvement. Start small, be patient.

share|improve this answer
Thanks, Telastyn. Very encouraging. Really wanted to get expert feedback so that I can move and study in the right direction. –  Chris Jul 13 '12 at 18:31
+1 for the note about first sites being horrible –  Izkata Jul 13 '12 at 19:56
add comment

Procedural approach can be used to build anything, look how C has been used to build OSes, But when it comes to manageable code Object Oriented code is always being preferred.

For someone still new to coding I would always recommend procedural approach. and yes you can build all sort of websites with it (assuming you learn SQL too).

It took me a year to take the jump from procedural to OO (maybe your speed be different). But first you should understand how things work under the hood (know the computer), this will make you a better developer.

share|improve this answer
+1: Good answer. I agree that procedural is simpler and therefore easier to learn. Object-orientation helps to manage the complexity of larger projects but you can get pretty far with procedural only. –  Giorgio Jul 13 '12 at 19:13
Thanks for the informative insights, nischayn22 and Giorgio. Truly appreciated. –  Chris Jul 13 '12 at 19:47
add comment

You do not need to use Object oriented programming.

My real advice to you though, is to start building websites before your dream website. It sounds like you are practicing making little scripts, but making the jump from that to a full, professional website can be daunting. To follow your analogy, you can learn to shoot a basketball and dribble before ever playing a game, but when you do decide to play a game, you will still be lost. You have some fundamentals, but you dont know how the game strategy works.

My first website in PHP was awful. I had spent time reading and practicing PHP as you had, but my site was a mess. In the end, it got out of hand, and I quit the project right as i was about to finish. I was unhappy with how it turned out, and i will probably never return to that project. Perhaps you should make your mistakes on something else before making your dream website? Perhaps after you have made a few websites, you will see the value of object oriented code, and it will be an obvious decision for you.

share|improve this answer
Thanks for the experienced-input, Ben313. –  Chris Jul 13 '12 at 19:48
add comment

I am a professional developer and work on a proprietary e-commerce platform. I too started off with PHP, and felt the need to attempt to write OO PHP.

The advantage: it's good to understand OO concepts, and commendable that you're trying to branch out on your own to learn them.

However, I would often not recommend learning something just for the sake of learning it. If you're developing on a framework that uses objects, dive into objects. Otherwise, focus your efforts on a project, find a problem and solve it.

My best advice is to just start programming. I would never ask you in a jr. dev interview if you were fluent in OO PHP. However, one of the first things I will ask is what you've been working on, and the types of problems you're currently solving. Food for thought.

Best of luck!

share|improve this answer
add comment

Don't delay building your website until you learn OOP. Get something built so you can see if one person will use it and then you can see if you can get a million.

No one will be able to tell which approach you used unless you open source the code. As more feature requests come up and you being to learn additional techniques, you may discover some OOP techniques can make it easier. All your users will see is that you are able to adapt and get the things they want which will lead to more users.

When he need to scale arrives (a good problem to have), there may be several areas you'll have to get into or maybe all of them: More hardware, improved code, changes to database design or database platform (NoSQL?), data caching, changing hosting providers or maybe even using your own servers (Hope you have lots of help on that one.).

Different sites have different user demands. Hopefully your learning process can keep up with and provide a site you're users enjoy. Looking back at your old code and shacking your head in disbelief, wonder and shame is the curse of becoming a better programmer.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.