DEV Community

Discussion on: Decomposing Composition

Collapse
 
parenttobias profile image
Toby Parent

I've read and reread this a number of times, and I honestly can't make heads or tails of it. You do raise some very valid points:

  • Yes, functional composition predates object-oriented development by some time, it has been practiced since the early 1950's. The core concepts have solidifed while the field and terms around it have evolved.
  • SOLID and SRP are goals to work toward, and a good metric that your code should be more performant.

And then things get subjective. Your comment about Eric seems to me much like those I'd heard from a fellow magician, back when I was a family performer. He would watch other magicians doing well, having great stage or closeup shows, and he couldn't celebrate their success - he had to pigeonhole them to define what he perceived as their limits.

You have your opinion of the man, and you're entitled to it. I've never met him, only read blog posts and watched some podcasts. But the way he approaches this subject resonated with me, and if I get the chance, I'll thank him for it.

Composition is not king. OO is not king. These are tools, different tools which have different applications in a mature, rounded developer's tool box. Religiously following any paradigm is a great way to block out the benefits of any other.

If I've misread any of this comment, I do apologize. You have some very valid points, and you're welcome to your opinions. While I agree to the benefits of much of what it seems you believe, I don't and won't hold them as dogma.

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.