Live data from Hacker News

“Clean Code, Horrible Performance” Discussion

github.com

141–150 of 220 posts

Re: “Clean Code, Horrible Performance” Discussion

#141
post #65

I don't recommend to juniors any of the books of people like Uncle Bob, Fowler, etc... Those are full of advices that seem reasonable but extremely generic and tend to be followed with religious fervour by people with limited experience resulting in an unreadable bug-ridden mess. When I think about those authors a single question comes to mind: What have they ever built? Reading code from popular opensource projects…

I read through a decent chunk of Patterns of Enterprise Application Architecture for class in college in ~2006 and while I was indeed young and impressionable, it left a very bad taste in my mouth for heavily OO’d systems to the extent that it had the opposite effect - I largely avoided them likely longer than I should have.

Re: “Clean Code, Horrible Performance” Discussion

#142

Earlier quoted context omitted.

This begs the question: what do you recommend instead?

"The pragmatic Programmer" is one I would recommend. That, and "Team Geek", in term of relationship with codes and teammates.

The pragmatic programmer is really keen on code generators. Which is the right thing to do. It's also very difficult to do in practice as the languages that are sufficiently impoverished to need external code generators are invariably bound to build tools that can't sanely deal with them.

edit: oh, and also it's hard to avoid people checking in and/or editing the generated code

Re: “Clean Code, Horrible Performance” Discussion

#144
post #26

Earlier quoted context omitted.

I used to like to rewrite code that I thought was "ugly" because it was not written in the modern way or it was not very generic or whatever. I thought that doing that was often pretty easy so I thought "why has no one done this already?" Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated. That's the dange…

This is why I think the most powerful abstraction for framework with extension points is c++ template meta programming. Wait! Hear me out! Template meta programming is an entirely separate, incredibly complex, programming language distinct from c++. The only people I have ever seen use it in production are exceptionally skilled programmers. Everyone else flees and cowers. If they try to change it it will not compile…

The ITK experience

Re: “Clean Code, Horrible Performance” Discussion

#145
post #65

I don't recommend to juniors any of the books of people like Uncle Bob, Fowler, etc... Those are full of advices that seem reasonable but extremely generic and tend to be followed with religious fervour by people with limited experience resulting in an unreadable bug-ridden mess. When I think about those authors a single question comes to mind: What have they ever built? Reading code from popular opensource projects…

> What have they ever built?

You have to be careful with that though. We've had a few people who'd "channel Torvalds", so to speak, by parroting his opinions with abrasive fervour. Any dissenters were treated as either thinking they knew better than him, or being ignorant of his work, or not having an appropriate appreciation for his work. And since Torvalds is very opinionated, so were they. It wasn’t exactly a fun work environment.

I’d also like to challenge the premise of the question. Being a maintainer for example is just as valid as being a “builder.” In fact, you’ll probably gleam more wisdom from being a maintainer than a builder since you are, by definition, trawling through other people’s code and maintaining it.

Look, it’s perfectly valid to consider someone’s body of work while considering their opinions. But dismissing them out of hand is wrong, in my opinion.

Re: “Clean Code, Horrible Performance” Discussion

#146
post #68

Earlier quoted context omitted.

This begs the question: what do you recommend instead?

"Code Complete" by Steve McConnell and "A Philosopy of Software Design" by John Ousterhout.

I second this about Code Complete. (Also I think it's at its 2nd edition, maybe 3rd?)

It's more up to the point instead of going into dogmatic diatribe

It's more evidence based (giving examples, etc)

Go for this one and Bob's your uncle! (or maybe it stops being your uncle, I guess)

Re: “Clean Code, Horrible Performance” Discussion

#147

Earlier quoted context omitted.

Clean code is defined as code that improves programmer efficiency and program readability, eschews premature optimisation by optimising for simplicity, makes code less complex and objectively better by optimising for readability, allowing virtually anyone to safely and easily change it when really needed. So you're actually a clean code proponent. As is usually the case with such debates, it is a debate of differing…

Ok. Fair enough. I just find that what Uncle Bob calls clean code is often not clean code for me. E.g. preferring inheritance over switch is less readable. Flexibility/extensibility and readability are different things.

Agree. Inheritance is a code smell. And clean code does not smell :)

Re: “Clean Code, Horrible Performance” Discussion

#148
post #26

Earlier quoted context omitted.

I used to like to rewrite code that I thought was "ugly" because it was not written in the modern way or it was not very generic or whatever. I thought that doing that was often pretty easy so I thought "why has no one done this already?" Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated. That's the dange…

This is why I think the most powerful abstraction for framework with extension points is c++ template meta programming. Wait! Hear me out! Template meta programming is an entirely separate, incredibly complex, programming language distinct from c++. The only people I have ever seen use it in production are exceptionally skilled programmers. Everyone else flees and cowers. If they try to change it it will not compile…

What happens when you have new requirements that weren't envisioned by the original designers, who are no longer there? How do you unravel the design to the point where you can create a new one?

Re: “Clean Code, Horrible Performance” Discussion

#149
post #26
post #8

It is debatable if Clean Code actually improves the programmer efficiency and programs readability. I find people applying it religiously often create over-complex designs like FizzBuzz Enterprise. Even Uncle Bob's examples are not the state of the art in readability: https://qntm.org/clean The main problem seems to be that Clean Code is mostly a premature optimisation in code flexibility. It makes code more complex…

I used to like to rewrite code that I thought was "ugly" because it was not written in the modern way or it was not very generic or whatever. I thought that doing that was often pretty easy so I thought "why has no one done this already?" Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated. That's the dange…

> (...) because it was not written in the modern way or it was not very generic or whatever.

Premature generalization is a well known problem and a never-ending source of complexity. I lost count of the times I had to push back on PRs of clueless developers who felt the need to generalize one-liners that pop up twice in the whole project, and for that their proposal was to add a strategy pattern, ultimate replacing two expressions with three classes.

Re: “Clean Code, Horrible Performance” Discussion

#150
post #26
post #8

It is debatable if Clean Code actually improves the programmer efficiency and programs readability. I find people applying it religiously often create over-complex designs like FizzBuzz Enterprise. Even Uncle Bob's examples are not the state of the art in readability: https://qntm.org/clean The main problem seems to be that Clean Code is mostly a premature optimisation in code flexibility. It makes code more complex…

I used to like to rewrite code that I thought was "ugly" because it was not written in the modern way or it was not very generic or whatever. I thought that doing that was often pretty easy so I thought "why has no one done this already?" Later I realized that the fact that it was easy to change was what made it good and the changes I wanted to make to it would probably just make it more complicated. That's the dange…

> Software has a Peter Principle. If a piece of code is comprehensible, someone will extend it, so they can apply it to their own problem. If it’s incomprehensible, they’ll write their own code instead. Code tends to be extended to its level of incomprehensibility.

https://nigeltao.github.io/blog/2021/json-with-commas-commen...

Post reply on HN