Page 1 of 1

procedural php to object oriented

Posted: Fri Feb 25, 2011 5:19 am
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 ?

Re: procedural php to object oriented

Posted: Fri Feb 25, 2011 6:29 am
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.

Re: procedural php to object oriented

Posted: Fri Feb 25, 2011 9:51 am
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.

Re: procedural php to object oriented

Posted: Fri Feb 25, 2011 12:34 pm
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.

Re: procedural php to object oriented

Posted: Tue Mar 01, 2011 6:22 am
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

Re: procedural php to object oriented

Posted: Tue Mar 01, 2011 6:57 am
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