Live data from Hacker News

Solid Relevance

blog.cleancoder.com

21–30 of 55 posts

Re: Solid Relevance

#21
post #17

Software is still if statements, while loops, and assignment statements — Sequence, Selection, and Iteration. That seems an extremely narrow view of modern programming. But then isn't this the same man who made the claim about there not being any new programming languages left to find?

I believe you're referring to his statement that essentially no new programming paradigms have been discovered since the 60s? Are you saying you disagree? Basically every major programming paradigm had been discovered by the 60s. I'd be happy to hear otherwise.

Basically every major programming paradigm had been discovered by the 60s.

At the most coarse, generic level, perhaps. But there's been huge amounts of research both academically and industrially into, for example, how to structure functional programs, how to manage side effects, and working within concurrent/distributed/asynchronous environments. Saying that nothing new has happened in programming languages since the 1960s because the major paradigms had all been discovered already is like saying nothing new has happened in automotive design since the 1960s because private vehicles still usually have 2 or 4 wheels.

Re: Solid Relevance

#22
post #8

SOLID is just a random arbitrary acronym about some principles that are somewhat obvious. However most people don't fully understand these principles deeply. What happens is if you are using OOP you are not using SOLID to its full extent. Ironic that SOLID comes from OOP. Either way SOLID are arbitrary rules of thumb. Grouped together arbitrarily to spell out SOLID and kind of maybe sort of right depending on your op…

> All things should be ungrouped as much as possible. Why?

Because you cannot predict the future of your program. Coupled logic that seems correct now may need to be uncoupled in the future.

By having every sector of logic be ungrouped it leads to maximum reusability for the future.

Technical debt is at the lowest possible level in projects where every piece of logic is uncoupled. In fact the very phenomenon of Technical debt arises from logic that's hard to uncouple. By having every sector of your program be a lego brick you are preparing your program for an inevitable future where the structure must be reconfigured.

Grouping logic together is like super gluing lego bricks together because it seems like they belong together.

There's a term for this style of coding that's actually negative. It's called ravioli code. But the negativity mostly applies to when this style of coding is used in OOP.

Re: Solid Relevance

#23
post #2

There's 2 approaches to programming: - make it easy to extend (lets's call it SOLID in this context) - make it easy to rewrite (let's call it KISS) OO developers think that the first approach is The Only Way but both can be right, especially with high-level declarative languages and with tasks small enough (relative to the language expressive power). SOLID makes it easier to modify programs (in predetermined directio…

I look at it with the rubrik: KISS is for coding. SOLID is for system design.

There is overlap obviously but SOLID becomes even more important when you have N+2 systems that interoperate. KISS is one way to help ensure you have a SOLIDly designed system when you are coding it. But it helps to understand the principles in SOLID when you are designing a monolith or a set of microservices.

Re: Solid Relevance

#24

Earlier quoted context omitted.

> SOLID makes it easier to modify programs (in predetermined directions) without understanding the whole. In my experience, in predetermined directions is almost never the direction the piece of code needs to evolve. Maybe I'm bad at reasoning about the future changes, but I'd guess that most people are utterly bad about this. This makes OCP more like an ideal to be aspired to, and beaten with when one inevitably fai…

If you look at it objectively. There's a very clear reason why OOP inevitably fails. Maybe a better way to put it is that SOLID is an ideal that OOP aspires to be but fails. Either way SOLID is a bad set of axiomatic design principles. It's sort of an arbitrary group of rule of thumb principles picked to spell out SOLID.

[deleted]

Re: Solid Relevance

#25

Earlier quoted context omitted.

There's a style of programming with no concept of loops or jumps. It's called functional programming. There's other styles that are drastically different as well. Most of these styles aren't new though.

Well, at the risk of being pedantic, I think you're being pedantic: at the machine-code level, all those function calls resolve to jumps and their recursive base-cases are terminating cases of loops. Functional programming is a great way of organizing loops and jumps, but they're still loops and jumps.

He's not talking about machine level code. He's talking about while loops in regular programming. I don't think the person was aware that there are paradigms that avoid looping.

To be more pedantic and get even lower level than machine code, at the theoretical level the basis of computation can be either procedural or functional. See lambda calculus and Turing machine for more info.

Re: Solid Relevance

#26

Earlier quoted context omitted.

I can see how SOLID and OOP seem to be related, but the principals of SOLID can (and IMO should) be applied to FP as well. In fact one of the clarifications in Uncle Bob’s letter hints at this, by expressing that substitution is about subtypes, not inheritance. This is of course common in statically typed FP languages like Haskell (or FP approaches in statically types imperative languages like TypeScript, Swift, so o…

I feel that SOLID doesn't even work well with OOP. Overall it's just saying "be more modular" in a programming paradigm that's one of the least modular styles ever created.

Agreed, though I also feel that even OOP doesn’t work well in OOP.

Re: Solid Relevance

#27

Earlier quoted context omitted.

> All things should be ungrouped as much as possible. Why?

Because you cannot predict the future of your program. Coupled logic that seems correct now may need to be uncoupled in the future. By having every sector of logic be ungrouped it leads to maximum reusability for the future. Technical debt is at the lowest possible level in projects where every piece of logic is uncoupled. In fact the very phenomenon of Technical debt arises from logic that's hard to uncouple. By hav…

Very, very wrong.

> In fact the very phenomenon of Technical debt arises from logic that's hard to uncouple.

No, one kind of technical debt arises that way. Not the only kind. There's another kind that arises when everything is in such small pieces that nobody can tell how the pieces relate to each other. You can easily understand each piece, but you have to go through a chain of a bazillion function calls to see what's actually going on.

> By having every sector of your program be a lego brick you are preparing your program for an inevitable future where the structure must be reconfigured.

This is like economists, who have correctly predicted nine of the last two recessions. Sure, you're prepared for when the change comes (if you can find where to make it - see above). You've also prepared for all the changes that never come. That's rather wasteful.

> Because you cannot predict the future of your program. Coupled logic that seems correct now may need to be uncoupled in the future.

Sure, it may. And when that happens, we'll decouple it. And in the meantime, we'll enjoy the coupling that, at the moment, is the correct thing.

See, this is all in the context of SOLID, the very first piece of which is "Single Responsibility". We don't couple things on a whim.

Re: Solid Relevance

#28
post #17

Software is still if statements, while loops, and assignment statements — Sequence, Selection, and Iteration. That seems an extremely narrow view of modern programming. But then isn't this the same man who made the claim about there not being any new programming languages left to find?

I believe you're referring to his statement that essentially no new programming paradigms have been discovered since the 60s? Are you saying you disagree? Basically every major programming paradigm had been discovered by the 60s. I'd be happy to hear otherwise.

I think that generic programming wasn't really a thing until Stepanov with the STL in the 1990s. There may have been glimmerings of it, but I know of no actual, significant implementations before that.

Corrections welcome...

Re: Solid Relevance

#29

Earlier quoted context omitted.

Well, at the risk of being pedantic, I think you're being pedantic: at the machine-code level, all those function calls resolve to jumps and their recursive base-cases are terminating cases of loops. Functional programming is a great way of organizing loops and jumps, but they're still loops and jumps.

He's not talking about machine level code. He's talking about while loops in regular programming. I don't think the person was aware that there are paradigms that avoid looping. To be more pedantic and get even lower level than machine code, at the theoretical level the basis of computation can be either procedural or functional. See lambda calculus and Turing machine for more info.

You don't think Uncle Bob knows there are paradigms that avoid looping? Sorry, but that is absurd. This isn't some random internet blogger. Uncle Bob has proven himself knowledgable enough to know something as basic as that, even if he is a controversial figure.

And please let me know if "the person" refers to someone else. I've read the comment chain all the way up and can only make sense of what you said if "the person" == Uncle Bob.

Re: Solid Relevance

#30

Earlier quoted context omitted.

Because you cannot predict the future of your program. Coupled logic that seems correct now may need to be uncoupled in the future. By having every sector of logic be ungrouped it leads to maximum reusability for the future. Technical debt is at the lowest possible level in projects where every piece of logic is uncoupled. In fact the very phenomenon of Technical debt arises from logic that's hard to uncouple. By hav…

Very, very wrong. > In fact the very phenomenon of Technical debt arises from logic that's hard to uncouple. No, one kind of technical debt arises that way. Not the only kind. There's another kind that arises when everything is in such small pieces that nobody can tell how the pieces relate to each other. You can easily understand each piece, but you have to go through a chain of a bazillion function calls to see wha…

No you're very wrong.

>No, one kind of technical debt arises that way. Not the only kind. There's another kind that arises when everything is in such small pieces that nobody can tell how the pieces relate to each other. You can easily understand each piece, but you have to go through a chain of a bazillion function calls to see what's actually going on.

All this logic must exist regardless of whether it's coupled or uncoupled. You do not alleviate the logical burden by coupling logic together or uncoupling the logic. If you call this "technical debt" then you cannot get rid of it. Why even call it debt then as logic is intrinsic to application.

In fact decoupling logic can improve readability as it marks each piece of logic with a contextual function name. Either way you do not alleviate complexity by coupling logic. You alleviate this complexity problem by providing logical layers, using namespaces, and using good function naming.

Coupling logic into Objects does nothing objectively as it does not eliminate complexity it only makes sure that the complexity is LESS modular.

Let's be clear though. I am saying that the lower levels of your application should be ALL uncoupled logic. Then you build logical layers on top of your primitives that consists of compositions of your logic that build higher and higher. So a person on layer 5 only needs to go to layer 4 to understand it, and does not need to go to layer 1 to understand every primitive.

>This is like economists, who have correctly predicted nine of the last two recessions. Sure, you're prepared for when the change comes (if you can find where to make it - see above). You've also prepared for all the changes that never come. That's rather wasteful.

Analogies don't offer proof of an argument. Additionally it's not a good analogy. Economists don't completely understand what causes recessions and how to prevent them. We do, however, completely understand the difference between uncoupled logic and coupled logic.

>Sure, it may. And when that happens, we'll decouple it. And in the meantime, we'll enjoy the coupling that, at the moment, is the correct thing.

This is the main point of tech debt. It is hard to decouple. You can have all logic decoupled at the lowest layer and still have everything be readable. I think the previous sentence is just a type of programming you haven't dealt with. You've never wrote a program with decoupled logic that was readable. Think deeper. There is no reason why coupled logic should be more readable then decoupled logic. The Logic still exists either way, you either compose two modules and give it a name or you don't even use modules shove all your logic into a module with a single name.

>See, this is all in the context of SOLID, the very first piece of which is "Single Responsibility". We don't couple things on a whim.

The problem is OOP does this all the time. It couples state with logic. These two things should be uncoupled.

Post reply on HN