Live data from Hacker News

Object-Oriented Programming is Bad (2016) [video]

m.youtube.com

51–60 of 133 posts

Re: Object-Oriented Programming is Bad (2016) [video]

#51
post #13

Earlier quoted context omitted.

"There is no one best way" summarizes what I think is a major unheralded realization in software engineering in the past 10 years. Before that it was the search for the One Way. OOP and functional programming were probably the two biggest opposing schools during that era, but now the trend is languages that easily allow both plus plain vanilla procedural programming. It's the programmer's job to pick a paradigm for t…

"there is no single development, in either technology or management technique, which by itself promises even one order of magnitude improvement within a decade in productivity, in reliability, in simplicity" ~ Fred Brooks, No Silver Bullet (1986)

The explosion of variety has actually pushed the other way. It was expensive, but MVS shops could push out highly available apps with a consistent UI very quickly.

It seems we've really only made progress on unit cost and ubiquity.

I think this is roughly why cloud is popular. It's not cheap, but if you're using their standard pieces (RDS, lambda, ECS, ELB, CloudWatch etc), you're working in a defined box with fewer choices.

Re: Object-Oriented Programming is Bad (2016) [video]

#52
post #46

Where does Domain Driven Design fall? DDD typically has service class that operates on multiple business objects in a pipe-line like fashion. Being business programming, there is always side-effects but usually handle via repository or db manager classes. I.e. no active record.

It is perfectly sensible, easier even, to apply DDD concepts to small functional services. Define a bounded context and aggregates. Under the hood (inside the context) there are a number of strategies for handling side effects, data structures, and state transitions.

I'm finding DDD + functional languages + serverless architectures work quite well together, so far.

Re: Object-Oriented Programming is Bad (2016) [video]

#53
post #28

What else people can do - videos, articles - just to avoid learning a little bit of Java? Stop that laziness and learn OOP properly, you'll find a good use for it!

> Stop that laziness and learn OOP properly, you'll find a good use for it! This is my biggest problem with OOP: proponents keep shifting the goalposts to avoid criticisms. If someone follows OOP practice, and it doesn't work out perfectly, then they must not have been doing it "properly". Hence "OOP" becomes a nebulous term, encompassing a whole bunch of approaches (encapsulation, inheritance, subtype polymorphism,…

> OOP is fraught with gotchas, misaligned incentives and lacks objectively checkable criteria

Like, almost everything in programming these days (especially the frontend part)?

I actually like how functional code looks like, especially ML dialects - OCaml, Haskell, F#

What stopping me from trying to use these languages in prod is the lack of tooling (mostly refactoring), in the sense what Idea can offer.

And when you have >3 people in a project with a language which has no mature refactoring tools, there is a problem then, a big one. Imho of course.

Re: Object-Oriented Programming is Bad (2016) [video]

#54
Good grief.

The reason that OO, FP, functional decomposition, entity relation diagrams, methodology de jure sucks is because modeling is hard.

--

These rules apply to all programming paradigms:

Favor composition over inheritance.

Try to not share state.

Favor dumb objects over active objects.

Favor shorter call stacks, less indirection.

Try to bunch like things together.

Try to DRY.

Re: Object-Oriented Programming is Bad (2016) [video]

#55
post #26

Earlier quoted context omitted.

This advice/reflection could apply equally to any style of programming, except for one particular snippet. You haven't made or refuted any OOP-specific claims. Separation of concerns? Egotistical soapbox speaker? Strong domain layer? What do they have to do with OOP, as opposed to just P? Except for this: > favor composition over inheritence Yes! Inheritance is OOP-specific, and I agree that you should avoid it.

But why? Why avoid inheritance?

Inheritance is a powerful tool. And like anything powerful, you need to think very hard about it use and assess whether another approach might be more well suited to what you are trying to accomplish. In my experience the reason people use inheritance is often simply to share common functionality. There are a lot of ways to get that done that don’t require inheritance.

Re: Object-Oriented Programming is Bad (2016) [video]

#56
I really liked the first half - he provides some insightful thoughts on both why OOP doesn't quite deliver on the promise, and why it continues to be popular anyway.

I am also becoming increasingly enamored of procedural programming as a default approach. Functional is also good - it's one of my first loves - but I find that it can be similarly prone to encouraging premature abstraction. Like OOP, that problem isn't going to become so apparent until you start using it in a large, long-lived business system with ever-shifting business requirements.

That said, I think that I've got to part ways with the video around about the part where it switches to talking about how the speaker thinks good code should be structured. Especially the bit about not keeping functions small - the problem with that is, it makes it way too easy for spaghetti code to sneak in. In the same way that, in the heat of the moment, a developer in an OO language is going to start tangling together the connections among objects a bit too liberally, a developer working in a 300-line procedural function is going to start fiddling with any variable that happens to be in scope a bit too liberally. Factoring out your functions does mean you have to name all those functions (which, I realize takes effort, but I also can't agree that it's a waste of effort), but it also serves as a way of making sure everyone stays honest about shared mutable state. Maybe it wouldn't be so bad in a language that has that "nested functions that aren't closures" feature, but, like he says, such a language does not currently exist.

Re: Object-Oriented Programming is Bad (2016) [video]

#58

In my experience, the thing that's wrong about object-oriented programming is not the object-orientation itself, but the over-application of it. - Sometimes more "procedural" programming provides better clarity. At other times, object-orientation is a cleaner approach. Neither should be a replacement for the other at all times. - The idea that objects should reflect how we think of real objects in the physical world…

One of the seminal books that people read about object modeling “Domain Driven Design” by Eric Evans writes about “transaction scripts”. Not everything needs to be modeled.

Re: Object-Oriented Programming is Bad (2016) [video]

#59

In my experience, the thing that's wrong about object-oriented programming is not the object-orientation itself, but the over-application of it. - Sometimes more "procedural" programming provides better clarity. At other times, object-orientation is a cleaner approach. Neither should be a replacement for the other at all times. - The idea that objects should reflect how we think of real objects in the physical world…

In my experience, the thing that's wrong about object-oriented programming is not the object-orientation itself, but the over-application of it.

Or the misapplication of it. If an app is really about dataflow, but programmers have tried to shoehorn in a pedantic OO model, one can often end up with lots of nouns with names that talk about How (exposing too much detail) and lots of code that serves to stick data in this cubby, with other code taking that data out, then sticking it into another cubby, ad nauseum. In that case, the relationships between the cubbyholes, the data, and the dataflow are only maintained through naming conventions, which can in turn be misapplied or neglected.

This makes following the dataflow into detective work to circumvent missed naming conventions, where it should really just be following implementers/senders/references in the standard way provided for by the language.

since a model is often looked at as a representation of real-world objects, a programmer thinking in OO is likely to stick every conceivable property and behavior around the imaginary object into the model code

This is where YAGNI comes into play. (You Ain't Gonna Need It) Never implement something unless you have empirical data to back up the need. If you implement according to imagination... well, the imagination of creative tech people is often practically unbounded. So just imagine how badly scaled the result could be.

Re: Object-Oriented Programming is Bad (2016) [video]

#60
post #17
post #13

Earlier quoted context omitted.

"There is no one best way" summarizes what I think is a major unheralded realization in software engineering in the past 10 years. Before that it was the search for the One Way. OOP and functional programming were probably the two biggest opposing schools during that era, but now the trend is languages that easily allow both plus plain vanilla procedural programming. It's the programmer's job to pick a paradigm for t…

I'm curious if this is the way older and more established engineering progressed. I would be interested in how, for example, designing and building a bridge to suit a specific use case has evolved over time.

There are two major concerns in software, performance and legibility. These concerns are somewhat orthogonal but neither can be abandoned, and the challenge is balancing them. By contrast in bridge-building (etc.) the two main concerns (performance and aesthetics) have been largely separated by discipline, into engineering and architecture, the former a purely mechanical discipline, the latter almost entirely artistic.

The main result of Modernism has been the subservience of the latter to the former, and in general the almost wholescale abandonment of aesthetic concerns. This is starting to come apart a little bit as people realize that this separation is unhealthy, and maybe we shouldn't build brutal, ugly flyovers through our cities because they have measurable effects on happiness, and thus property values, etc. (i.e., aesthetic concerns have functional consequences).

Similarly I think many software "engineers" take a long time to realize that one of their main functions is writing code that others can read; this is an aesthetic, artistic discipline that I think many developers reject as outside their domain. This, too, is starting to come apart as we slowly figure out that code's maintainability is a key determinant of its long-term success - that is, aesthetic concerns have functional consequences.

Post reply on HN