DEV Community

Discussion on: Decomposing Composition

Collapse
 
jwp profile image
JWP • Edited

Composition is king because it allows for individual small part changes without affecting other parts.

If we stick to SRP
then each part (or function as some call it) will not do anything outside its responsibility. This makes even functional composition
bullet proof.

I never said OO is king but neither is the Functional programming style, contrary to Elliot.

Some prescriptions should be followed religiously; such as DRY and SRP, which are; in essence, the same thing. Just say no to monolithic code, it's unmaintainable.

Just like continual refactoring to achieve SRP winding up as a function or method (same meaning) doing only one thing the OOP way winds up as being functional in the end.

The point I'm making is; most OOP bashing is done by Javascript adopters who never knew OOP. They don't like to talk about their own use of inheritance of the React or Angular classes. If they do admit the niceties of inheritance in React or Angular they'll always qualify it by saying 'it's shallow inheritance' which is purported to be the only way it's good.

Finally my dislike of Elliot was in calling him out on his TypeScript hatred. His reasons were only his bias, meaning he could care less to how it helped others.

He then later disliked the integration of the Class and other TypeScript inventions into Javascript for no good reason other than his boat was rocked.

Thread Thread
 
parenttobias profile image
Toby Parent

In fairness, class in javascript is unnecessary and misleading, but that's my own personal bias.

I've been coding since the early 80s, I was OOP for a long while when it was the new and shiny on desktops. And I see benefits to that pattern, on occasion. OOP in the sense of SmallTalk, where the intent is very directed and meaningful.

But I don't see OOP and FP in opposition. I see them in balance. Used properly, both tools have a very valuable place.

I do appreciate your perspectives, and thank you for clarifying your issues with him. I can see why you'd feel that way.

Thank you for taking the time, and really looking forward to future conversations!

Thread Thread
 
jwp profile image
JWP • Edited

Likewise Toby.
When I started college in 1981 we only had basic and assembly language.

My first job after school was working on a Navy shipboard computer where everything was in assembly.

When IBM standardized the desktop, assembly was still there. It was Microsoft who first used "c" to write gui programs. Finally adding in C++ later.
I actually worked at IBM in 1987 on a midrange using assembly language.

I distinctly remember people saying things like 'we don't need 4th generation languages, we have assembly". Today we almost always use 4th generation languages and rarely, if ever use assembly.

So it's from that perspective that I find those that reject new features in their own language to be just like the 'we don't need it group'. They are stuck in their own self inflicted technical debt gap.

But what really surprises me are the so called experts in their domain shunning new features.

Elliott still to this day pans TypeScript which had features not introduced to Javascript until many years later. He is to me a 'we don't need it' person.