Live data from Hacker News

Nobody cares about your clean code

felipecsl.com

11–20 of 177 posts

Re: Nobody cares about your clean code

#11
Weird post. The main insight is easily captured by the phrase "technical debt is a resource, not a vice".

It also disregards that developers who care about clean code do exist, such that the title becomes merely metaphorical, and is more accurately rendered as "users don't care about clean code".

Except that they do, they just don't know it. Time to new features and time to bug fixes (both of which users do care about (though, of course, not unanimously)) is inversely proportional to how easy a codebase is to navigate and understand (read: how clean it is).

Finally, all software developers (or all workers?) prefer their work to have a high ratio of accomplishment to drudgery. The primary benefit of clean code is developer quality of life, as indicated by the nascent field of DX (Developer Experience).

Re: Nobody cares about your clean code

#12
I think it's ironic that the author claims that clean code is.......

  Package your code down into small, atomic and reusable units
  Follow the single responsibility principle
  Use frameworks and libraries to avoid reinventing the wheel
  Whatever language you pick, don’t pick PHP
These are best practices. It is possible to follow every one of those rules and still have a pile of broken, insecure, garbage code. Likewise you can have a very elegant one-liner that fits none of those and gets a job done cleaner and easier than any alternative. You can even have a single page app that fits most of those, and I would argue that it would probably stay cleaner without adding a framework. Frameworks in many ways bind you to a certain style.

It's all about keeping the scope of what you're doing in mind and using the correct tool for the job. Saying "this tool is better for every job" is going to get you a lot of arguments.

Also, with the exception of the third bullet point, you can follow all of those practices and still fit your app into a single file. There is nothing more frustrating than working on a codebase that puts 12 lines of code in each file and then spreads that code into 1,000 files.

And the final bullet point in regards to PHP is just false. But I digress.

Re: Nobody cares about your clean code

#13

"throw the first one away" When I'm prototyping or hacking something together, I don't write tests, I don't comment/document much, I use lots of shitty variable/type names, lots of commented out code, debugging printfs, not much organization of files (often one large file). The prototype software is write-once, read-maybe. Maybe I'll want to see what I did down the road, but more likely I'll be shortly rewriting what…

When I'm prototyping or hacking something together, it eventually becomes production. I cannot relate to people who make prototypes to throw away, I've never done it, and I don't know why I'd do it.

Due to that, I write my first line of code as if it's going to be on production forever, because it will.

Re: Nobody cares about your clean code

#14
post #9

Nobody cares about what materials you used in your bridge! https://www.courthousenews.com/34m-settlement-reached-for-de... But seriously, they call it "tech debt" for a reason. It's not a problem until suddenly you're no longer able to add needed features to your project, because every little bit of development takes hours and weeks and months. There are so many posts about how "Engineers Need To Learn About The Busi…

Except that technical debt is not about writing bad code, and the author of this article gets it completely wrong.

"The metaphor of debt is sometimes used to justify neglecting internal quality... Teams who do this end up maxing out all their credit cards, but still delivering later than they would have done had they put the effort into higher internal quality."[1]

"the whole debt metaphor, let's say, the ability to pay back debt, and make the debt metaphor work for your advantage depends upon your writing code that is clean enough to be able to refactor as you come to understand your problem"[2]

"write the best code possible given a partial understanding of the problem so later when you do understand it better you improve the solution"[3]

1. https://martinfowler.com/bliki/TechnicalDebt.html

2. http://wiki.c2.com/?WardExplainsDebtMetaphor

3. https://www.youtube.com/watch?v=pqeJFYwnkjE

Re: Nobody cares about your clean code

#15
The fatal flaw of this article is assuming that having a single PHP file implies ugly code, or at least uglier than the average codebase.

I would, in fact, guess that its code is much cleaner than the average Fullstack Javascript app.

If you're capable of writing a full, functional website in one PHP file, you know what every line of code does, you have only what you need and the ways to factor your code become more obvious.

Using the "modern" Javascript stack usually means that you had to spend months or years trying to learn this mishmash of Javascript libraries (React, react-redux, Express, an auth library, an ORM, etc.) and you don't know what most of those things do under the hood.

The lesson I take away is: Simple (PHP + Jquery) can be better than complex (React, Redux, Express, Passport, etc).

Re: Nobody cares about your clean code

#16
tl;dr Here's a web site that made a lot of money despite being a single file of code that we presume is ugly. From this we conclude that one must choose between writing clean code and focusing on what the user wants.

(In case it isn't obvious, I disagree. Maintainable code lets you adapt to an evolving understanding of what the user wants.)

Re: Nobody cares about your clean code

#17

"throw the first one away" When I'm prototyping or hacking something together, I don't write tests, I don't comment/document much, I use lots of shitty variable/type names, lots of commented out code, debugging printfs, not much organization of files (often one large file). The prototype software is write-once, read-maybe. Maybe I'll want to see what I did down the road, but more likely I'll be shortly rewriting what…

When I'm prototyping or hacking something together, it eventually becomes production. I cannot relate to people who make prototypes to throw away, I've never done it, and I don't know why I'd do it. Due to that, I write my first line of code as if it's going to be on production forever, because it will.

[deleted]

Re: Nobody cares about your clean code

#20
This article seems to focus on clean code not having a significant effect on the software in production for the experience of the end user.

One example where I have experienced the benefits of a clean codebase is when onboarding new developers. It takes a few days of handholding but once they've started working with the code there's very little room for gotcha situations where they get stuck or inadvertently introduce bugs due to being misdirected by the code that was already there.

Post reply on HN