Is Precedural Enough?

[i]A Note to Moderators: If you feel that my question below does not belong in this section, please let me know where it should be posted.

Thanks,
Chirs[/i]

Hello,

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 OOPHP, 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?

Your expert opinion and insight and input is greatly appreciated.

Chris

My first project was a private-member site for a group I had. After getting login/logout to work, I made a register code and just kept building more things. I even done a shoutbox.

With PHP, you can achieve almost anything you can imagine. There will be times you get referred to Javascript or AJAX or something else, but majority of the time something can be solved with PHP.

The main thing to remember is that PHP is server-side and everything is loaded when the page loads. For something to be updated live, the page has to refresh. Depending what you’re doing, we may tell you to look at Javascript/JQuery/Ajax for live updating of a page.

Thanks, RaythXC.

Here is my take…

If you go with Object Oriented Programming then it’s like building all the walls before you build the house. The good part is that if any one wall needs fixed you do not have to muck around with the other three. The downside is occasionally if one wall is broken the whole house comes down.

I recently built two identical sites (from a script standpoint the content varied).
The first site I was developing all the scripts so I built each section of the site independently. The viewing section had a folder, the update section had a folder with the script from the viewing section to call when it needed it. Anyway at the end of this build I had several scripts that were practically identical just in different sections of the site. Now when I want to edit one I have to edit all of them so that the whole site functions the same. It takes longer but one section does not affect the other sections.

The second site I only built one viewing section and linked it to the update section. Now when I need to change the viewing section of the site I only edit one script. Its faster but occasionally I take out my whole (dev) site because that one script is not playing nice with the others.

From a programming standpoint the latter is a harder to do because you have to account for each contingency when writing the original script. However the former while easier is a lot more work when making updates or changes.

You also want to keep things that you are going to use over and over in a separate script. For example: your database connection information should be in one script and called on any script that needs to connect to the database, your page menus, headers, footers should be the same way. That way editing one script changes all your pages. Most of my index.php files do not do anything but call other scripts. Then depending on how the user navigates the pages depends on which scripts are called.

However, all this being said with a little PHP knowledge and a will to learn content management systems like Wordpress and Drupal can be vary useful for creating websites. They remove all the programming issues for the most part and allow you to focus on design and content, but still give you the option of writing that custom piece of code if you want.

and those are my thoughts.

Thank you so much for the very insightful response, Andrew.

Sponsor our Newsletter | Privacy Policy | Terms of Service