Ask HN: What are alternatives to OO programming?

2 points by ErotemeObelus ↗ HN
Don't say functional. It combines the power of abstract mathematics with the learning curve of abstract mathematics. Any programming paradigm that requires me to write a dissertation to use shouldn't morally speaking count as a programming paradigm.

I want a programming paradigm that doesn't breakdown after 500k LOC. That rules out structured programming also.

9 comments

[ 2.9 ms ] story [ 33.0 ms ] thread
Take a look at the Golang model, it uses duck typing and also CSP for parallel exec'n
This is a question that’s been on my mind ever since I did my master thesis in 1997. And yes, I agree that FP is not it (my school was heavily FP-influenced).

IMNSHO, architecture-oriented programming is what OO wanted to be. Or maybe it should be called connector-oriented.

In short, in addition to a library of data types / classes you can use, compose and adapt, you get a library of connectors you can use, compose and adapt.

Another way to think of it is tamed metaprogramming or language-oriented programming on rails.

To be honest, there isn't any mainstream alternative to OOP, when it comes to building software professionally because of the very wide use of OOP , because of multiple reasons like security (provided by private & protected classes) or data hiding or Abstractions or Encapsulation.

If you are having difficulty with OOP & objects, then go through the reference, but do it, there's no better mainstream alternative.

Functional
* Something fundamental as input and outputs was an open problem for decades.

* Has the gentle learning curve of abstract mathematics.

No thank you.

Sorry, I should have said "pragmatic functional". Pure functional is borderline useless. Push the impurity (I/O, Infrastructure, UI) to the outer edges of whatever application you're making. Any popular functional language will make purity easy and idiomatic, but will also make the ugly parts possible, albeit a little verbose, to encourage avoidance.

Was it easy to learn how to do OOP well? If you're looking to move away from OOP, are you sure you ever learned how to do it well? I've been doing OOP for 20 years and I've found far more practical application from functional ideas than any design patterns I've come across.

You don't have to go all in on any paradigm, you can mix and match. The parts of any system should be small. If the part is easier to design in OOP (UI comes to mind), then use that. If the part is just manipulating data (just about everything else comes to mind) functional can be very nice.

When I took programming classes in uni it was the OOP section where I would consistently get 100% on tests. Everything else was 75-80%.

OOP is one of the few parts of programming that are genuinely enjoyable. Sometimes I open up Ruby and make an OO model of something from my work (mathematician). So I'm not asking because I'm bad at it.

But it seems like there are only two programming paradigms: object-oriented and structured (classical functional programming (like you find in Scheme) is really structured programming without loops and variable assignments). And the problem is that structured programming is not temporally infinite: it breaks down most ungracefully past 150k lines of code.

You can't tell me that the only temporally infinite programming paradigm is OO and that nobody invented anything else in the intervening 30-40 years.