procedural php to object oriented

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Anant
Forum Commoner
Posts: 66
Joined: Wed Jul 14, 2010 11:46 am

procedural php to object oriented

Post by Anant »

is it a good idea to move to object oriented php. I am confident in .NET but with php i have a doubt if this would work in longer run ?

Should i follow MVC architecture using Zend framework for our php site ?

Would it worth all the time and money spend in moving from procedural programming to object oriented ?

Anyone else changed thr website from procedural to object oriented - if yes then is it advisable to start from scratch or start adding object oriented bit to current site till it's all done ?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: procedural php to object oriented

Post by Weirdan »

I'd say adopting new technologies is a good idea when you're developing new project. For older code (especially if works fine and rarely needs any changes) changing paradigms doesn't make as much sense.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Re: procedural php to object oriented

Post by s.dot »

Anant wrote:Should i follow MVC architecture using Zend framework for our php site ?
Using the most popular design pattern along with the framework that the people behind php has available would improve your attractiveness as a coder on so many levels.
I agree with weirdan also.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: procedural php to object oriented

Post by pickle »

Anant wrote:Anyone else changed their website from procedural to object oriented - if yes then is it advisable to start from scratch or start adding object oriented bit to current site till it's all done ?
The two approaches are not dissimilar. While I haven't changed an entire website, I have updated a few old, small apps from procedural to OOP. I've found in most cases, you need to re-organize so much of the code, that it feels like you're re-writing anyway.

Like ~Weirdan said - don't change it if you don't have to. If you do need to though, I'd recommend starting from scratch. That is to say, don't try to copy and paste tiny bits of functionality from your procedural code into an OOP design. While you can certainly re-use algorithms and little snippets, rebuilding from scratch will allow you the freedom to do things completely fresh, rather than trying to simply duplicate what you did before, just in an OOP context.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Anant
Forum Commoner
Posts: 66
Joined: Wed Jul 14, 2010 11:46 am

Re: procedural php to object oriented

Post by Anant »

Thanks all of you for your replies.

In my case we constantly add new features to our site. It's quite easy to do it procedural way but as a career point of view - how many companies want a programmer doing only procedural programming ? I come from .NET background and now working on php. But one question scares me is how about the debug feature in php. I am currently using dreamweaver for php but there isn't any debug feature.

And once i move to OOP i am quite use to friendly debug feature of visual studio. Is there anything upto that level in any of the php ide ?

Thanks
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: procedural php to object oriented

Post by Weirdan »

Anant wrote:And once i move to OOP i am quite use to friendly debug feature of visual studio. Is there anything upto that level in any of the php ide ?
http://xdebug.org/docs/remote#clients
Post Reply