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

> Most sites I see nowadays are not in any way more effective for their deep use of frameworks.

It’s both amusing and sad to see modern web developers criticize Java for being “bloated” because they don’t understand the Abstract Factory-pattern (fairly light-weight, 2 levels), while themselves are using infinitely more complex and heavy frameworks to render what is more often than not is just static HTML.




The problem with OOP patterns is not that they are complex. It's that you gain incredibly little by using them.


You can gain a huge amount using OOP patterns, if your problem domain maps well to the OOP paradigm. I know this from personal experience on many projects.


Even on problems that map well into the OOP paradigm, the gain does not come from the standard patterns.

Proof of that is that in languages where there are alternative patterns (like Python), people rarely create a factory, they use functions that return classes; they don't use singletons, they just use module static variables; they don't create observers, just just gather callbacks on a list; and so on.

There are many less formal patterns that do add a lot of value. And there are syntactic and type level patterns that are great, but typically OOP programs use those less than code in other paradigms. OOP has one common less formal pattern that is very useful and less used elsewhere - it's the abstract API, but this one people on the internet mostly recommend not using, because it requires inheritance.


There is no such thing as "standard patterns". There are a large number of different popular patterns which many developers have found useful for a broad range of uses.

Don't get too hung up on the implementation details in any particular language. A Python function that returns a class is just a factory by another name. The essential point is deferring the decision of which implementation class to instantiate until run time.

Inheritance is one way of handling abstract APIs, but not the only way (depending on language). And don't believe everything you read on the Internet. In some limited circumstances inheritance can be a great way to simply code and eliminate duplication, far outweighing any additional complexity it introduces.


> OOP has one common less formal pattern that is very useful and less used elsewhere - it's the abstract API, but this one people on the internet mostly recommend not using, because it requires inheritance.

Or just use interfaces. As in "design by contract".

And that's just common sense programming wise, not some OOP specific solution.


Yup. The actual issues with the design patterns come from a) most problems not mapping well to OOP, and b) patterns that exist only to compensate for low expressiveness of a language (e.g. all the patterns that compensate for not having proper closures).


I agree with point B, but A is objectively wrong, borderline trolling.

You can successfully apply OOP and OOP design-patterns to a lot of problems and come up with equally functional solutions as you would with FP.

And for certain domains, better.




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

Search: