3 ms·
But a power drill is a single tool, OOP is more like a collection of techniques. I prefer Pike's analogy that OOP is like woodworking. Sure, it is a self-cons
by enriquto 6y ago
But a power drill is a single tool, OOP is more like a collection of techniques. I prefer Pike's analogy that OOP is like woodworking. Sure, it is a self-consistent body of knowledge, and there are very beautiful things that you can make using wood. But that does not mean that everything that can be build in wood sould, nor that basic tenets of woodworking (e.g., the "direction of the grain") make any sense at all when you are using different materials.
- Rochus 6y agoMaybe the comparison with a single tool is too simple, but actually OOP is just another way to organize code. We should not forget that the first C++ compiler just translated everything to plain C including virtual tables an such. So we can obviously write object-oriented programs using plain C. The integration in the language makes programming more comfortable. The level of OO support in a language varies: C on one end, and Smalltalk on the other where even loops and control structures are objects. Wirth identified the essence of OO in extensible types (which is the only OO mechanism available in original Oberon). Kay identified the essence of OO in sending messages to (active) objects. Quite different views under the same term, but both views represent aspects of solid software engineering. The people who flatly devaluate OO have simply not noticed that they also devaluate parts of their favorite ideology.
- wvenable 6y agoI like this analogy -- especially since like with woodworking it's not hard to incorporate another material/paradigm (steel, plastic, etc) into the project as necessary when you need more strength or flexibility. And like with programming paradigms, not everyone has experience in both woodworking, plastics, and steel production.
- amdelamar 6y agoThat's a great metaphor for OOP. What is the full quote or reference from? This is all I could find: https://interviews.slashdot.org/story/04/10/18/1153211/rob-pike-responds https://interviews.slashdot.org/story/04/10/18/1153211/rob-p...
- enriquto 6y agoYes, that seems to be it. Pike's quote from that interview: (...) let me say that I'm not much of a fan of object-oriented design. I've seen some beautiful stuff done with OO, and I've even done some OO stuff myself, but it's just one way to approach a problem. For some problems, it's an ideal way; for others, it's not such a good fit. Here's an analogy. If you want to make some physical artifact, you might decide to build it purely in wood because you like the way the grain of the wood adds to the beauty of the object. In fact many of the most beautiful things in the world are made of wood. But wood is not ideal for everything. No amount of beauty of the grain can make wood conduct electricity, or support a skyscraper, or absorb huge amounts of energy without breaking. Sometimes you need metal or plastic or synthetic materials; more often you need a wide range of materials to build something of lasting value. Don't let the fact that you love wood blind you to the problems wood has as a material, or to the possibilities offered by other materials. The promoters of object-oriented design sometimes sound like master woodworkers waiting for the beauty of the physical block of wood to reveal itself before they begin to work. "Oh, look; if I turn the wood this way, the grain flows along the angle of the seat at just the right angle, see?" Great, nice chair. But will you notice the grain when you're sitting on it? And what about next time? Sometimes the thing that needs to be made is not hiding in any block of wood.
- esperent 6y agoMuch as I love woodworking, I think that's a dismissive analogy, since the immediate assumption is that you can only build small things out of wood. You can't build skyscrapers or highways or particle accelerators out of wood, for those you need metal and concrete. A fairer analogy would be to say that OOP is a particular architectural style, and FP is another.
- PaulDavisThe1st 6y agoOOP is like Japanese woodworking: no screws, no nails, no glue. You can build beautiful things with it (though it requires great skill to do it correctly and accurately). You can mix Japanese woodworking with European woodworking by using screws, nails and glue whenever you feel like it. Its simpler than pure Japanese woodworking, not as pretty, quicker to construct, doesn't last as well. You can even forego Japanese woodworking entirely, but to do so is to throw away an entire culture's worth of knowledge about how to cut, shape and join wood, so likely not a great idea.