Sponsored by HTC
Who knows you better than your phone? view!
youtube.com - See you from the perspective of your phone.
90 Comments
- fleetskeet, on 10/12/2007, -5/+26There are advantages to both and anyone who says one is clearly superior to the other is a zealot.
- elnerdo, on 10/12/2007, -1/+18"Myth: OOP is a proven general-purpose technique
Myth: OOP models the real world better
Myth: OOP makes programming more visual
Myth: OOP makes programming easier and faster
Myth: OOP eliminates the "complexity" of "case" or "switch" statements
Myth: OOP reduces the number of places that require changing
Myth: OOP increases reuse (recycling of code) "
From any of my use of OOP, I would strongly disagree with most of these. OOP has greatly increased the amount of code I reuse. It has also greatly reduced the amount of places that need changing. I don't know about reducing complexity, I've never had it do that, but it has certainly made programming much easier and faster for me. OOP has also made programming MUCH more visual, which is a good thing.
I don't see how this person can just make stuff up like that. - orange, on 10/12/2007, -4/+21This is more an article about how PHP's OOP support sucks than OOP being bad in itself.
- Moocat, on 10/12/2007, -3/+19I dugg the link down because it's useless and it's way over the line misinformation. Take a look at the page again, it compares OOP with COMMUNISM. And then goes on to say OO is Xenophobic.
He continues with such comparisons that not only don't make sense but borderline on the crazy juice. I realize there's a lot of OOP pages out there, and it's a popular concept, and there's even a share of OOP pages that bash procedural, but this page amounts to ~80k text of GARBAGE. He even uses a common eye trick to make it look like OOP is "messy" by not using right angles when constructing a tree layout and then uses neat right angles for the procedural one.
Yes, there's reasons to use each programming language, and sometimes a "bashing" page has good opinions and factual reasons for not using one or the other, this however, is not one of those pages.
I agree with the comment below, there are advantages to both, anyone who says use one over the other ALL the time is clearly a zealot. - jayf, on 10/12/2007, -7/+21I read the article and it sounds more like a list of reasons why PHP sucks. Not about OOP failings.
Misleading title. Shoveling dirt back in the ground. - crbaker, on 10/12/2007, -4/+16Pisses me off when Digg links to anything thats more advanced than 'CSS is better than table layout'. The average digg user can't spell polymorphism, let alone tell you what it is. Please post articles on slashdot that require an IQ over 100.
- Luuvitonen, on 10/12/2007, -0/+9...yet the average response on Slashdot would be one of these:
1. In Soviet Russia objects orient You.
2. Imagine a Beowulf cluster of OO Drupals.
3. First post!
4. ...
5. Profit!
+5 Funny - Itkovian, on 10/12/2007, -1/+10Well, Dries helped develop Wonka. But it goes to show that a good programmer uses more than one style and refuses to get stuck on a single concept.
- burritoKing, on 10/12/2007, -6/+14 Yeah it's not as if any big sites are running PHP *cough* Flickr *cough* Digg.
It's about using the best tools available. Smart engineers will do their homework and decide which is best, stupid ones will make blanket comments and rule out options based on personal bias. Which one are you?
- Optron, on 10/12/2007, -2/+10headzoo, I think bean1975s article is being dugg down, because, if you read the Drupal article, it doesn't criticize OOP, it just shows how to make (more or less) object oriented code without the use of classes in PHP.
- Otto, on 10/12/2007, -2/+10rompom: Depends on the project. Doing projects in OO can be faster to code if the project is complex enough and lends itself well to the OO paradigm of breaking things apart into self-contained bits. For any project big enough for multiple programmers, this makes it fairly straightforward to break the whole thing down into a tree and assign individual objects to developers, and then build the tree from the top down/bottom up (depending on which way you want to look at it).
However, not all possible programs lend themselves well to that sort of thinking. Especially for quick prototyping, OO tends to be overkill, because a lot of time is wasted on writing bits that don't get immediately used. Also if you do quick development in the OO style, you have problems later as you have to come back and add functionality to existing objects to fit in additions to the system. Even inheritance, as great as it is, doesn't solve that problem.
OO is faster for big projects that are going to take a long time anyway, basically. But, you tend to get better code out of it and you tend to be able to reuse a lot of that code, making later projects easier as well. It just takes a lot of forward planning in the process of development to get the benefits out of it. - anamanaman, on 10/12/2007, -3/+11Whatever. The whole "all approaches are equal" is a bunch of baloney.
There are clear generalizations that can be made about which software engineering practices are better for most cases. - drumm, on 10/12/2007, -1/+8PHP isn't the best language in the world for programmers, but it is everywhere. Making a CMS which is accessible to lots of people is something we value in Drupal, so PHP it is. If you don't need as much portability, use another language and throw objects in if you want.
It is surprising to see that old writeup on Digg. This was written around the time PHP 5 came out and we got a flood of people dropping in and telling us to rewrite to use the shiny new objects. Can't really do that and have the thing still run on as many servers. And major rewrites aren't worth the effort. - rompom7, on 10/12/2007, -3/+10spot on taylorwood.
also, from my experience, OOP is faster to code.. which means your project is done faster.. which is what most business' are after. - SuperSloth, on 10/12/2007, -2/+9Look, I can't be bothered to evaluate a programming language and sytle when I want to develop a successful project. That's clearly a waste of everyone's time.
Tell me what to think, Internet!!! - maffiou, on 10/12/2007, -2/+8Completely agree with you there... This article is too PHP specific to draw general conclusions about object oriented programming... All the drawbacks expressed in this article aren't "portable" to any other object oriented language... This is all too implementation related rather than concept related... Misleading title if I may say... No digg sorry
- inactive, on 10/12/2007, -0/+6LONG LIVE THE PUNCH CARD!!!
- cmplus, on 10/12/2007, -0/+5You forgot:
6. I for one welcome our polymorphic overlords. - DigitalDud, on 10/12/2007, -7/+12OOP arguments died out in 1998, moving on...
- CaughtThinking, on 10/12/2007, -1/+6"I agree; these are all reasons PHP should not be used for new code. For modern programmers the choices are Perl, Python, or Ruby."
LOL?!?! Let me just add to this, no longer should we eat a Banana, and from now on everyone should only eat a Pear Apple and Walnut. - decrusoe, on 10/12/2007, -1/+6He, he. Drupal framework is written by Dries Buytaert, person that wrote Java Virtual Machine and is now doing PhD research in adaptive optimization of Java, the paramount of OO world. Ain't that funny? :)
- Luuvitonen, on 10/12/2007, -0/+4and:
7. But does it run Linux? - bean1975, on 10/12/2007, -28/+32Also see http://www.geocities.com/tablizer/oopbad.htm
- jesusphreak, on 10/12/2007, -0/+4> That sounds like OOP to me. Regardless if they use classes or not.
No, it sounds like breaking down the program into different modules. That does not = OOP. You can do that in C if you want. - geezusfreeek, on 10/12/2007, -1/+5PHP's OOP support is, to put it lightly, terrible. Let's just leave it at that.
- ilitirit, on 10/12/2007, -2/+5Very misleading title and summary. The article says nothing about why OOP "is not always good", and to a certain extent the summary implies that "virtual object oriented code" is better than "real" OO code.
- burke, on 10/12/2007, -1/+4Yeah, PHP's OOP is subpar to say the least.
- Crazen, on 10/12/2007, -0/+3Lot more to OOP then "modules"
- digitalsin, on 10/12/2007, -1/+4Most of the people I see around me who criticize OOP are dinosaurs who never made it out of ADABASNATURAL programming.
OOP works, but it works only if the designers know how to use it properly just like any other technology. - veracon, on 10/12/2007, -0/+3Indeed OOP isn't always good. But that's no reason to say "OOP sucks", because it in many cases can be far better for the tool than procedural or prototype-based programming. I've personalyl saved lots of code using it, but of course I don't use it all the time - who does that, anyway?
- jo42, on 10/12/2007, -0/+2PHP Object Oriented Programming => POOP
- EiderDuck, on 10/12/2007, -2/+4I dugg the article down because the author of it is on a soapbox and doesn't recognize that just because some of the wackier marketing claims of OOP didn't pan out doesn't mean it's completely worthless.
- rfoos, on 10/12/2007, -0/+2Actually, it explains how OOP is used all over the place in drupal. If anything, this article is in favor of OOP. Very good article, very bad submission.
- kkaefer, on 10/12/2007, -0/+2Well, the linked page points out why using non-OOP code is not bad for *this* particular purpose. Of course it does not say that OOP is good or bad in general.
- adolfojp, on 10/12/2007, -0/+2Sir, your comment is magnificent in its humorous, yet effective simplicity. I just hope that the people that don't understand it don't mod you down as a troll.
- headzoo, on 10/12/2007, -2/+4Conveniently with PHP5, all classes can be loaded dynamically using the __autoload() function. You don't need to load a single class that isn't actually being used.
Oh well, like the Drupal developers said, their use of PHP is all about portability, which pretty much rules out using PHP5 for, oh, at least another 2 years. :) - jalefkowit, on 10/12/2007, -0/+2"If anything "the databases will win"."
Tell that to all the Web 2.0 AJAX Ruby on Rails pastels rounded-corners kiddies who think a database should be nothing more than a dumb content store...
See http://www.loudthinking.com/arc/000516.html for details. - FuManchuX, on 10/12/2007, -0/+1Forgive me if I don't understand the issue correctly, but usually we deal with stuff like by using data transfer objects (from the design patterns book).
What I mean is that you might have a simple Java object with nothing but getter and setter methods (sometimes called a POJO -- plain old java object).
Then there are other objects with little state of their own that have methods capable of working on them. E.g., the data access object can query the database and produce the 'data transfer object/POJO'. Then perhaps something like a JSP displays it on screen. Maybe later the user does something and a command handler object will create a new POJO and send it to the DAO to persist.
So to me, the data feels unbound from the operations. No? - marillion, on 10/12/2007, -0/+1"There are clear generalizations that can be made about which software engineering practices are better for most cases."
Yes, there are clear generalizations about software engineering practices. But, there are times when for pragmatic, practical or other reasons those generalizations don't hit the "sweet spot." The important thing is to know why you've chosen the practices you've chosen, what benefits and compromises you'll gain and lose, and how you'll defend those choices.
As I see it drupal has done that. - ventaur, on 10/12/2007, -2/+3I gave him a digg-down because there are no alternatives given to the OOP problems he is proposing. Most of us can point out flaws in many things. Even more so, we can point out incorrect uses of systems. Most things can be completely mis-used. Many of his statements are ways inexperienced programmers use OOP in a way it was not intended.
And I love the reference to Communism! I think that was a bit overboard. A simple reference to a less devastating fad would have been more appropriate.
Constructive criticism comes with explanations and possible solutions. Don't label it "criticism" when it should be labeled, "bashing". Great! The real-word usually consists of C and D, unlike OOP's idea of A and B. Well, how would you model it if not with OOP?
Help us learn from your experiences. Don't filibuster us to virtual death. - inactive, on 10/12/2007, -0/+1So, PHP sucks at OOP, and that's why they don't implement it. Fine. They go on to say how they implement most of the principles of OOP anyhow. Well, doesn't that mean that, if POOP wasn't *****, you'd have implemented your dinky ass web portal thingie using OOP? Best line in the whole article: "Drupal does not have a way of strictly limiting access to an object's inner workings, but rather relies on convention to accomplish this." Lol. Way to expose yourself to all kinds of wickedness, guys.
- JQP123, on 10/12/2007, -0/+1Any compromise will take place on the programming side so essentially, yes, the databases are winning.
In my opinion, OOP is somewhat utopian in that it is best suited for problems where the data, storage and behaviors are all well defined and fully controlled by the application. GUI widgets are a classic example. Any sort of business process is a counter-example. Business rules, data storage and interface requirements are subject to frequent and unpredictable change and external influences which can play havoc with the most well designed class hierarchy. - craigtheguru, on 10/12/2007, -0/+1Umm, I even implemented many PHP 5 OO features in PHP 4. Its not hard and works fine. Switching to PHP 5 meant that PHP could handle some of the gotchas and enabled certain features like abstract classes, but not having abstract classes is hardly a deal breaker.
Regarding the code inclusion issue. What is so hard about having a smart loader system that knows what to load when requested? A child class can always require_once the parent class, and this should all be using OO methods anyhow. If you're calling random top level functions everywhere you're only partly using the OO model anyhow! - logic11, on 10/12/2007, -2/+3Folks, I graduated in 95 and much of the focus of my programming units was OOP (I went to an insanely overpriced private college, still paying off the loans more than a decade later...) and the key that they stressed was that while some languages force you into OOP (VB, C++) you can use OOP techniques in almost any language (they even showed us ways to do it in x86 Assembly Language, but then pointed out that we would have to be phsychotic to actually attempt to use those methods).
PHP's class structure is one of the most annoying I have ever dealt with, but the basic concepts of OOP (compartmentalization, inheritence) can be achieved without resorting to the damn class structure.
Of course, if what I want to do is look up a name based on a users selection in a list box, I pretty much write it procedurely (because it takes about thirty seconds). If I want to have the option of looking up the name amidst a thousand other features, I write it comptartmentally, but only rarely using the class structure. - TheNik, on 10/12/2007, -0/+1Since when does PHP use CASE/SWITCH operators? I dislike OOP for some reason. I guess after using PHP for so long, it's hard to grow into the PHP OOP environment (and you can do much more without it).
Although, certain things are far easier with OOP. I couldn't see games being made otherwise (efficiently, that is). - Crazen, on 10/12/2007, -0/+1The "webmaster" of the millenium.
- tablehead, on 10/12/2007, -0/+1I am the author of the geocities "OOP Criticism" site. As far as why it is on geocities, it is mostly because moving it will result in losing google ranking. As far as complaints about my OOP criticism style, the most important complaint is that there is no solid evidence that OOP is better, at least in the domain of custom biz apps. In open source thinking you put code up for inspection and scrutiny. Why not do the same with OOP claims, along with some realistic change scenarios? I want to see code being better, not yet more anecdotes about how OO cured cancer in your dog. The biggest problem with OOP is that it either depends on hierarchies, which don't change well to the real world, or the "navigational" structures that were discredited in 1970's. Adding function pointers to navigational structures didn't solve the original problems; they are still with us in OO's version of navigational. The Set Theory in relational makes for a better classification and variation management tool and relational offers more discipline and consistency than navigational. OOP is the GoTo of structuring.
- codahale, on 10/12/2007, -0/+1Once you've worked with a real OOP language (e.g., Java or Ruby these days) PHP looks like an April Fool's joke. It's gotten better, yes, but mainly because a kick in the sack would have been an improvement on PHP4 -- it's a far cry from being up to the standards of the competition.
More importantly, the object model in PHP5 is welded to the bumper of an ungainly Franken-mess of a language. Coming back to PHP after spending some time doing client-side development in C# and Java... well, you can really see the bolts on its neck.
The good thing about PHP is that it's damn near ubiquitous and fast as hell for a scripting language. The bad thing about PHP is everything else. - dlogic, on 10/12/2007, -2/+3the title says that OOPs is not ALWAYS good. It dosnt say its BAD
- inactive, on 10/12/2007, -3/+4"In fact, it is true that Drupal does not use many of the OOP features of PHP, but it is a mistake to think that the use of classes is synonymous with object-oriented design. "
They don't say OOP is bad and they do say that they DO use some OOP methods.
"Drupal code is highly compartmentalized into modules, each of which defines its own set of functions."
That sounds like OOP to me. Regardless if they use classes or not. -
Show 51 - 90 of 90 discussions



What is Digg?