Hacker News new | past | comments | ask | show | jobs | submit login

It is true that some parts of your project can benefit from centralised approach (and that sometimes you really need to count every tick) but this fashion of blaming OOP is really weird and should stop.

It is still the best way to architecture big systems. I'm not talking about classes, I'm talking about decentralised, decoupled, small systems, communicating with each other using messages.




I have a hunch that the current trend of applying the actor model to everything is going to be seen as an anti-pattern in a few years. Basically the same way that microservices seemed like the cool thing a few years ago and people now are realizing there's overhead and different classes of bugs/mistakes that aren't always worth the trade-off.


> this fashion of blaming OOP is really weird and should stop

Right. There are many places where OO fits well.

As you mentioned in the medium/large on the services/systems level. But it is also a good paradigm to model pretty much any real, outside thing. A database, a file-system abstraction (loading configs etc.), an external web-service, a peripheral device (keyboard, mouse), a GUI context (the whole thing, not the parts) and so on.

In these cases we want the properties of OOP: local retention, message passing, abstraction through public interfaces and state-machine-like behavior.

The issue arises when we model data with OO: A Person is not an object in your system. It is an associated data-structure. Treat it as such. A User interacts with an interface (CLI, config files, GUI...) treat those as objects. The data about the User is just data about the User.

I don't have an authoritative opinion to offer here. I'm just a dude who writes programs. This is merely the model that works for me.


> But it is also a good paradigm to model pretty much any real, outside thing

If we get to the crux of the matter, what you like there is the tree structure (which definitely is the end result you want) the problem is if you store your data in a tree structure (whether by OO, file system or json document) you cannot easily express that same information but in a different tree layout

Trees couple relationships and things together in such a way that they are hard to tease apart. If you think about your brain what it does is stores the sum of your knowledge in a graph, then at runtime your brain can construct any number of trees from that graph easily

You can think of yourself as being a member of the tree of life and a member of your workplace hierarchy very easily, your data store should be graph like and your query language should be able to pull trees out of at will, checkout Clojure's Fulcro or any EAVT database if you want to see how that works in practise


> In these cases we want the properties of OOP: local retention, message passing, abstraction through public interfaces and state-machine-like behavior.

That's not OOP but Actors or event loops.





Applications are open for YC Winter 2021

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: