News for hackers. Stuff that matters.
Re:“Clean Code, Horrible Performance” Discussion by robalni on Saturday March 11, 2023 @02:30AM (#35106273)
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 danger; good code is easy to change so it will easily get rewritten until it's not easy to change anymore.

Re:“Clean Code, Horrible Performance” Discussion by foo42 on Saturday March 11, 2023 @02:50AM (#35106367)
that last paragraph is an excellent description of the problem!
Re:“Clean Code, Horrible Performance” Discussion by jackblemming on Saturday March 11, 2023 @03:10AM (#35106453)
Strong disagree. This is something people say to sound clever. It’s not true at all. The real cause is basic entropy and complexity are always increasing. Rarely does a project manager request a feature be deleted. This is compounded by most companies having a few good programmers and mostly mediocre programmers, so the codebase will tend toward the mean over time.
Re:“Clean Code, Horrible Performance” Discussion by namaria on Saturday March 11, 2023 @03:17AM (#35106484)
Hm... Ad hominem, truism, truism, ad hominem. And not even disagreeing with the conclusion in the end...
Re:“Clean Code, Horrible Performance” Discussion by kubanczyk on Saturday March 11, 2023 @04:14AM (#35106767)
I'd say false dilemma fallacy.
Re:“Clean Code, Horrible Performance” Discussion by tpoacher on Saturday March 11, 2023 @04:06AM (#35106726)
so ... sounds like you agree?
Re:“Clean Code, Horrible Performance” Discussion by Ygg2 on Saturday March 11, 2023 @04:59AM (#35106971)
What is the alternative? Bad code?

It's exactly same as arguing you should not educate your workers. Cause they might leave. So you get only the least knowledgeable ones.

Re:“Clean Code, Horrible Performance” Discussion by lucumo on Saturday March 11, 2023 @04:23AM (#35106801)
It's really not.

Software solves business problems. Code that meets its requirements needs to be left alone. Developers just changing code because they feel like it need some coaching. They're wasting everybody's time for reasons that amount to "I like it My Way".

So, with normally performing developers, the only code that changes is the code that needs to change. Good or bad only has an influence on the cost of a change.

Re:“Clean Code, Horrible Performance” Discussion by regularfry on Saturday March 11, 2023 @04:42AM (#35106889)
That's not inconsistent with "good code will get rewritten until it's not good code." Good code that you need to change is code that can degrade as a result of that change.

Nothing to do with "just changing code because they feel like it".

Re:“Clean Code, Horrible Performance” Discussion by lucumo on Saturday March 11, 2023 @06:51AM (#35107527)
The good code will be changed after it has ceased to be good code too. And bad code can become good code in the process of changing it.

There is nothing that makes good code more or less likely to change than bad code.

Re:“Clean Code, Horrible Performance” Discussion by namaria on Saturday March 11, 2023 @03:15AM (#35106477)
>good code is easy to change so it will easily get rewritten until it's not easy to change anymore

Sounds like the 'bad currency drives good currency out of circulation' problem. Bad code drives good code out, because good code is easy to understand and change.

Re:“Clean Code, Horrible Performance” Discussion by iovrthoughtthis on Saturday March 11, 2023 @03:27AM (#35106543)
exactly
Re:“Clean Code, Horrible Performance” Discussion by Derbasti on Saturday March 11, 2023 @07:39AM (#35107822)
Without concerted effort, any easy-to-change code naturally will be replaced by hard-to-change code.
Re:“Clean Code, Horrible Performance” Discussion by tome on Saturday March 11, 2023 @08:49AM (#35108244)
> Bad code drives good code out, because good code is easy to understand and change.

I call this the Peter Principle of Programming:

"Code increases in complication to the first level where it is too complicated to understand. It then hovers around this level of complexity as developers fear to touch it, pecking away here and there to add needed features."

http://h2.jaguarpaw.co.uk/posts/peter-principle/

Re:“Clean Code, Horrible Performance” Discussion by waynesonfire on Saturday March 11, 2023 @12:13PM (#35110341)
Very cool point.

I will highlight though that I have worked with people that choose the path of least resistance regardless of complexity of the code that would need to be changed. It's as if they refuse to read code.

Re:“Clean Code, Horrible Performance” Discussion by lll-o-lll on Saturday March 11, 2023 @04:54AM (#35106944)
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. So why is this good? Because it only allows the framework to be extended in the ways intended by the original designer. Anyone wanting to update this unholy beast will be a master programmer who’s investing significant effort. That implies the updates will be good.

Good code is easy to change. Great code is near impossible to change, but easy to extend.

Re:“Clean Code, Horrible Performance” Discussion by QuadmasterXLII on Saturday March 11, 2023 @09:09AM (#35108387)
The ITK experience
Re:“Clean Code, Horrible Performance” Discussion by jonbronson on Saturday March 11, 2023 @03:27PM (#35112333)
you just sent shivers down my spine
Re:“Clean Code, Horrible Performance” Discussion by lll-o-lll on Saturday March 11, 2023 @06:02PM (#35113691)
Shivers of excitement surely
Re:“Clean Code, Horrible Performance” Discussion by bcrosby95 on Saturday March 11, 2023 @09:35AM (#35108562)
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 by lll-o-lll on Saturday March 11, 2023 @05:59PM (#35113668)
With great effort. That’s kind of my point though. It’s when you are changing the design from the originally understood “these are the ways to extend and add”, to a new paradigm, that you should be expending great effort.

In such a code base, it quickly becomes understood that if changes are required to “framework Doom” in order to achieve a new feature, the time budget will need to be large. It’s built in tech-debt prevention.

Re:“Clean Code, Horrible Performance” Discussion by simplotek on Saturday March 11, 2023 @09:41AM (#35108619)
> (...) 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 by edflsafoiewq on Saturday March 11, 2023 @09:47AM (#35108660)
> 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...