4 ms·
The great mistake is to believe there is something useful called "Object-oriented", or "Data-oriented", or "Functional", or what-have-you-oriented programming.
by ncmncm 5y ago
The great mistake is to believe there is something useful called "Object-oriented", or "Data-oriented", or "Functional", or what-have-you-oriented programming.
Carpenters don't learn "hammer-oriented" building; or "saw-oriented", "screwdriver-oriented", "chisel-oriented", or "glue-oriented". They learn to use hammers, saws, screwdrivers, chisels, and glue, and use them all at different times, sometimes one more than others. Machinists don't learn "lathe-oriented", "drill-oriented", "mold-oriented", or "welding-oriented" fabrication. They do all or any of them strictly according to what they are making, and what they are making it out of.
It is as utterly stupid to design a whole language around one of them as it would be for a carpenter to try to run a screwdrivering business. A language is useful exactly to the degree that it enables building whatever you might be called upon to build.
That is not to say any generally useful language is equally good for any purpose. Wood is better for some products, metal for others. A metal violin would be weird, a wooden gun action would be stupid. But violins often have metal bits and guns often have wood stocks.
- marviel 5y agoI don't have a substantive response except to thank you for giving me a helpful analogy in future discussions on the topic.
- teakettle42 5y ago> The great mistake is to believe there is something useful called … "Functional", or what-have-you-oriented programming. It’s a remarkably substantial mistake — “the great mistake”, even — to blithely discard a concept so fundamental to computer science and programming language theory that we literally could not progress in the field without it. You may as well be an earth-bound carpenter denying the existence of “gravity-oriented design”.
- ncmncm 5y agoYet, we did progress without it. Learning a program organization style is helpful for beginners, if the toy problems they get are more easily solved using the style. But you progress, ultimately, by transcending it. A mature programmer mixes elements freely without labels. Crawling-oriented locomotion is fine for babies. Adults walk, run, swim, drive, pilot, ride, sometimes even crawl. Learning to run does not make you worse at crawling, or make you run when you should crawl.
- teakettle42 5y ago> Yet, we did progress without it. No, we didn't, and claiming so merely demonstrates your profound ignorance regarding the most basic fundamentals of our field.
- ncmncm 5y agoWe must be working in wholly different fields. I make software that, you know, works.
- teakettle42 5y agoSays the carpenter to the architect.
- ncmncm 5y agoPeddle your snake oil where it sells.
- TillE 5y agoThe weird thing about this article's category of OOP criticism is that it makes all sorts of assumptions about class design and memory allocation which are absolutely not intrinsic to OOP. Like, there are plenty of good points to be made here without discarding the entire idea of object-oriented design. It really just needs a little tweak.
- rdw 5y agoThere are different methods of framing a house and roof and builders do tend to specialize in just one. Balloon framing is different than platform framing which is different than mortise and tenon framing. To learn a new system, a carpenter would have to learn a whole new system of rules, measurements, suppliers, attachment methods, and seasonal tolerances. Here's an overview of some of these techniques: https://www.hometips.com/diy-how-to/house-framing.html https://www.hometips.com/diy-how-to/house-framing.html It's actually pretty analogous to programming methods.
- ncmncm 5y agoDifferent methods of framing correspond to different materials available. Long 2x4s are too expensive now for balloon framing to be cost-effective, just as posts and beams, and lath and plaster, became too expensive (for different reasons), earlier. None is abstractly better than the other, even for identical end products. In some places bricks are, or once were, cheaper than lumber. A carpenter who can't build a house with brick walls, or can't add a platform-framed room to one, is no carpenter at all.
- throwaway894345 5y agoThis is just a rephrasing of a boilerplate response to any criticism at all: "there is a time/place for OOP!" followed by precisely zero articulation about when one should use OOP over a rival paradigm. It is one of the weakest arguments I can conceive of (perhaps following "but that's not true OOP" with no assertion about what characterizes OOP, or a definition of OOP that is only esoteric). Why do you feel the need to talk to programmers using a construction metaphor rather than talking about programming paradigms directly? If OOP has merit, shouldn't it be relatively easy to articulate as to programmers? What is OOP good at? When should I use it rather than a data-oriented approach? Why talk in tenuous metaphor?
- ncmncm 5y agoYou just read that the whole notion of object-oriented (or anything-oriented) programming has no merit, and are now asking me for examples where it has merit. You are usually constrained to a particular language or, sometimes, mix of languages. You have access to a set of language features. Use them in any mix that solves the problem. If runtime polymorphism would be useful, use it. If arrays would be useful, use them. If recursion would be useful, use it. If compile-time type matching would be useful, use it.
- throwaway894345 5y agoThank you, I always appreciate a thoughtful critique.
- winstonewert 5y agoI have to disagree with the sentiment you express here. Your metaphor is bit confused. You are comparing individuals tools to methodologies. For example, object oriented programming is a methodology which involves the use of a variety of the tools like inheritance, composition, interfaces, dependency injection, etc. So, object-oriented programming does not correspond to always using a hammer in every situation. It rather corresponds to particular theory about which tools to use in which situations. There have been a variety of methodologies of framing buildings. There was traditional framing, then balloon framing, and now platform framing. These different approach to framing are what would actually corresponding to things like procedural programming, objected programming, and functional programming, not the individual tools. It seems to me that it is pretty clear that there is something usefully termed data-oriented programming or functional programming. Neither is appropriate to all scenarios, but that doesn't prevent them from being useful concepts. Crucially, though, your thrust seems to be that we should use the right approach for the task at hand. That's true to a degree. But what remains is that some paradigms are either bad ideas or frequently get applied in domains they aren't suited to (I'm looking at you OO!). The consequence is that I don't see it as particular helpful to say "use the right tool for the job." Yes, it is true, you should use the right tool for the job. But I think its also true that some paradigms are better then others, just as some framing techniques are improvements on anothers.
- ncmncm 5y agoIf you start building a skyscraper by nailing up 2x4s, you won't get very far. But that says nothing about the merits of nailing up 2x4s. If you start a project thinking, "I'm going to make an object-oriented program", or "I'm going to make a data-oriented program", you are just working with one hand tied behind your back. A mature programmer mixes elements freely with no thought to "orientation". If you demand simple advice: Don't Be Stupid. It's not helpful, but neither is TFA. At least mine is correct.
- winstonewert 5y ago> A mature programmer mixes elements freely with no thought to "orientation". Seriously, you advocate freely mixing radically different architectural approaches? Well... I don't want to share a codebase with you.