Live data from Hacker News

OOP Is Dead, Long Live OOP

gamedev.net

351–357 of 357 posts

Re: OOP Is Dead, Long Live OOP

#351

Earlier quoted context omitted.

Where are there company executives that actually know and care about these kinds of things? Some of what you're talking about can be overdone by engineers (i.e. 100% line coverage), but a lot of what you're talking about are tools engineers have developed to make their lives easier and to improve their code quality. A linter checks for common mistakes, clarity problems, and can help ensure code is written in a consis…

I think that a lot of the tools and processes that we use these days are counter-productive overall. I think that a lot of rules enforced by code linters are rules that are good 90% of the time, but they're bad 10% of the time. Having 100% test coverage is great to guarantee that the software behaves like it's supposed to but it's terrible when you want to change that behavior in the near future. Most systems should…

I don't disagree that things like testing are overdone. I'm currently consulting on a project that was largely written by another consultant who was fanatical about TDD. Most of the code was very poorly structured, but had hundreds of brittle tests (where it wasn't exactly clear what was even being tested). Since this project is still pretty new, one of the first decisions we made was to disable the tests and do a major refactoring (then rewrite maybe half of the tests). As a result we've been much more productive and the app is if anything _more_ stable now and much easier to understand.

And I agree that project management tools (especially JIRA) are pretty frustrating and provide a dubious value proposition. Project management is going to need to have a reckoning some day w/ the fact that it's very difficult to glean any insight from estimates and velocity (and that very few places actually even measure these things in a consistent fashion). The only value to "agile" and the ecosystem surrounding it IMO is that it de-emphasized planning to some extent and pushed the importance of communication. These are ultimately human problems though, not ones that can be solved by technology. Also I think there's a laughably small amount of interest in giving software engineers the time to train and learn.

Software engineering as a discipline is still in the dark ages. We don't really have solid data on the impact of things like programming language choice, development methodologies, etc. Most of the conceived wisdom about these things is from people who are trying to sell their services as consultants and offer project management certifications. That's not to say that there is no value in tools, techniques, language features, etc. to software engineering, there's a huge value, but we need to better understand how contingent the advantages to these decisions are.

As always, I think the things en vogue in software engineering are somewhat of a wash. I'm very happy that statically typed functional programming languages have seen a resurgence because I think they offer an enormously better alternative to TDD-ing your project to death by allowing you to make error states unrepresentable and discouraging mutable state (also I think encoding invariants in types actually makes it faster to adapt to changing requirements, especially w/ the refactoring abilities in editors). On the other hand, there are lots of bad ideas about architecture and scaling today, particularly with the "microservice" trend and I think people poorly understand how these things were mostly created as a response to organizational growth, not per se in search of better performance or some kind of invariant best practices about architecture.

In any case, I think there is an inherent tension w/ management that has indirectly lead to some of these practices, but I would push back on the idea that we only adapt some of these to satisfy management. Tools that push you towards correct and safe code IMO make the job less anxiety-inducing and gives your code a chance to actually meet the expectations users invest in your project by using it. In my experience these are the kinds of things management couldn't care less about until it impacts their profitability.

Re: OOP Is Dead, Long Live OOP

#353

Earlier quoted context omitted.

Someone with 15 years programming OOP told me once: here is the best way to describe object oriented programming: you asked for object “monkey”, and you got the whole jungle, as well as monkey’s bananas.

You're quoting Joe Armstrong, creator of Erlang > Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

Steve said it too, but he said it like he was proud of it: https://www.youtube.com/watch?v=Gk-9Fd2mEnI&feature=youtu.be...

"You need all the objects that come with it to make it work"

Re: OOP Is Dead, Long Live OOP

#354
post #9

If we just had made inheritance as something to be avoided unless absolutely needed then OOP would have probably never got such a bad reputation. All the other concepts make perfect sense.

Or… if you're talking about languages like C# and Java (and presumably C++), just make sure all of your classes are either sealed or abstract. This turns classes into proper algebraic data types. To wit, implementation inheritance gives you a sum type (e.g. a Shape is either a Circle, or a Square, or …) whereas interface inheritance gives you a product type (class Foo : IBar, IBaz means that Foo is an IBar and an IBa…

"languages like C# and Java" Not particularly your post, because compared to e.g Haskell you could say that, but I usually cringe when people say "C# and Java", and often list a hsot of bad attributes that are more particular to Java. Java is such an utterly verbose, dull, ugly, clumsy to use language that falls over its own feet all the time, expecially when adding new features that are at best half as useful as they could be because of early design problems... Whereas C# is, comparably, such a joy to use... ;)

Re: OOP Is Dead, Long Live OOP

#355

Earlier quoted context omitted.

For some reason 'arguments' against OOP seem to follow a common pattern. You have said many things against OOP, but you haven't actually presented an argument for why it's bad. I'll present each of your assertions here individually to clarify. > OOP is prove a poor model for computation > OO code is almost always significantly more complex and error prone than an equivalent computation written in a concurrent, functi…

The pattern you talk about is mainly a product of not wanting to squeeze a whole essay into an HN comment. I also suspect the problems with OOP are hard to communicate. I for one always had a problem with OOP, but I could never quite point it out. Sure, when faced with an OOP design, I could almost always find simplifications. But maybe I never saw the good designs? Maybe this was OOP done wrong? I do have reasons to…

You do realize that a lot of people could have "a sense of uneasiness and distrust towards FP"?

Re: OOP Is Dead, Long Live OOP

#356
post #235
post #219

Earlier quoted context omitted.

I upvoted you. Why OOP is bad: In 8 years professional (for money) programming experience i had zero use cases for OOP. Every time I tried to use OOP it backfired and I abandoned it. Maybe I just never really understood OOP or maybe I already use OOP all the time without calling it OOP.

What were the types of problems and systems you have worked on? Which languages and programming styles (eg functional) did you end up using to solve them?

Mostly math, optimization and data transformations. Since java8 I use functional style (map, filter, monads..). A lot of business logic is also in sql queries.

Re: OOP Is Dead, Long Live OOP

#357

Earlier quoted context omitted.

Well, my original point is that thread-safety is easy with the right abstractions, and that choosing your abstractions is a conscious thing. So I don't see how mutability is "inherently thread-unsafe." Rather, programmers are "inherently thread-unsafe" and we have a responsibility to understand the problem domain and choose abstractions that make sense to us and that actually solve the problems we're encountering. No…

I just doubt that those abstractions are easy and would say that they often break. Blaming the programmer for thread-unsafety in e.g. Java is like blaming programmers for memory unsafety in C. I agree if you stay in purely functional programming languages you run into points that are solved better with mutability. However those parts of a program are small and most parts are expressed better by pure functions.

I wouldn't say that they "often break" considering that we never had a single issue with our software that could be linked to any of our threading abstractions in the 4 years of rigorous development and testing. But rather it's important to be clear about how your abstractions are to be used, and that you don't inject a lot of special-case logic into it. In our case we had to accept significantly reduced performance in exchange for the abstractions, but in the end it was worth not having to debug everyone's thread-safe code separately. A lot of it came back to choosing an abstraction that was simple enough to be well-understood and about not pushing the envelope too far.
Post reply on HN