tag:blogger.com,1999:blog-5086776302734357547.post21031581618037467..comments2010-07-29T07:21:57.755-07:00Comments on I am learning PHP: Do Web-Scripting Languages Really Need OOP?TruthSeekerhttp://www.blogger.com/profile/12117124476229842123noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5086776302734357547.post-51720151512052595822010-07-29T07:21:57.755-07:002010-07-29T07:21:57.755-07:00I had a similar stance on PHP OOP to the author ab...I had a similar stance on PHP OOP to the author about two years ago. I didn't fully understand PHP OOP at that time. The post strikes me as fairly naive, and I believe in two years the author will have a different opinion.<br /><br />Just a sampling of OOP I could not do without today:<br />1. AutoLoader<br />2. Polymorphism<br />3. Inheritance<br /><br />For any web app that does more than one thing, OOP is indespensible. Frankly I would not want to maintain a procedural app of any real size. I actually do have an app I developed three years ago 100% prodecural and I hate working in it now. It needs to be re-written.<br /><br />My preferred style is the Rasmus Lerdorf approach: Procedural "controllers" with extensive use of objects when appropriate. Not EVERYTHING in your code needs to be an object.Coder Guyhttps://www.blogger.com/profile/12950402146233083718noreply@blogger.comtag:blogger.com,1999:blog-5086776302734357547.post-7582367106577128272010-07-27T14:37:54.101-07:002010-07-27T14:37:54.101-07:00The dilemma is that, especially in teams, OOP prov...The dilemma is that, especially in teams, OOP provides a well structured paradigm. But PHP apps that adhere too closely to PoEAA, while well architected, need all sorts of beefy host upgrades to be performant. It's hard to get the balance right - and you have to know when:<br />PHP !== JavaUnknownhttps://www.blogger.com/profile/05228765571982869564noreply@blogger.comtag:blogger.com,1999:blog-5086776302734357547.post-34453986476622162232010-07-27T01:16:58.432-07:002010-07-27T01:16:58.432-07:00I think the added benefits gained by using OO make...I think the added benefits gained by using OO make up for the less inferior manner in which it is implemented in PHP vs Java etc. Reusability & maintainability are key in software development.<br /><br />By developing with OO in mind, you think more about how you are going to resolve the problem, thus (generally) making a better solution.Smithyhttps://www.blogger.com/profile/14301093092280761115noreply@blogger.comtag:blogger.com,1999:blog-5086776302734357547.post-18562558282952359352010-07-26T16:40:28.029-07:002010-07-26T16:40:28.029-07:00Performance reasons aside, I'm not so sure a p...Performance reasons aside, I'm not so sure a procedural based application would scale that well (team wise) as isnoop said.Unknownhttps://www.blogger.com/profile/08564769346581499455noreply@blogger.comtag:blogger.com,1999:blog-5086776302734357547.post-48445972232981344952010-07-26T09:42:19.383-07:002010-07-26T09:42:19.383-07:00Procedural works well for small projects and singl...Procedural works well for small projects and single-coder environments.<br /><br />In any place with two or more developers, you'll quickly find that class-type code reusability and portability makes for much more maintainable and scalable code.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5086776302734357547.post-34806174516420275022010-07-26T04:29:35.522-07:002010-07-26T04:29:35.522-07:00It's often senseful to mix and match coding st...It's often senseful to mix and match coding styles. Procedural can very well coexist with object-structured code, which for some tasks just looks nicer and explains the algorithm or processing cleaner.<br /><br />However, in the PHP community there are very strong tendencies to cargo cult programming. Private methods and attributes make sense in Java, from where the idea was copied, but it adds little structural integrity in scripting languages (that's why Pythond eschewed them). But still, many PHP coders consider it "right OOP" to mark as many attributes as private as possible; neverminding that it only shadows underdesigned interfaces.<br /><br />The likewise silly namespace\syntax also gets quite overused already. Deeply nested namespaces make sense in Java, but add little of the pleaded name conflict protection in PHP. It's just another syntax construct that gets used purposeless because it's hip.Anonymousnoreply@blogger.com