Live data from Hacker News

Don't write clean code, write CRISP code

bitfieldconsulting.com

31–40 of 170 posts

Re: Don't write clean code, write CRISP code

#31
"The problem, of course, is that few of us can agree on what "clean code" means, and how to get there. A rule like "methods should only do one thing" looks great on a T-shirt, but it's not so easy to apply in practice. What counts as "one thing"?

I don't agree with this statement at all. From my experience this is perfectly possible. Maybe I'm misunderstanding the statement... why would it be hard to write methods that only do one thing?

Re: Don't write clean code, write CRISP code

#32
post #23

Don't follow the concrete practices in the best-selling book* vetted by industry leaders for years, instead follow this set of 5 high level goals that I've generally described and grouped together into a catchy acronym. Yay me! * - Granted the book was written by an asshole.

Could you elaborate on the last point?

Possibly: https://gist.github.com/unclebob/2508746

Re: Don't write clean code, write CRISP code

#33

It is laughable talk about "Don't Repeat Yourself principle" on a strongly biased towards Golang article. A language that took 13 years to add a simple method (Index) that helped the programmer to find an element in an array (slice). Before that you had to write a for loop every time you wanted something from an array. Talk about "DRY" ... That is everything but "simple" as described in the article.

An amusing aspect of DRY is that the moment you think "great, with that last patch I'm no longer repeating myself," you now have an opportunity to look around and really just take in how much repetition happens everywhere, at multiple levels. You are still repeating yourself, and will likely continue to repeat yourself, forever. (Phew, look at that word "everywhere", it should just be "vrywh")

Great example of how refactoring is a neat way to introduce bugs and break features

Re: Don't write clean code, write CRISP code

#34

"The problem, of course, is that few of us can agree on what "clean code" means, and how to get there. A rule like "methods should only do one thing" looks great on a T-shirt, but it's not so easy to apply in practice. What counts as "one thing"? I don't agree with this statement at all. From my experience this is perfectly possible. Maybe I'm misunderstanding the statement... why would it be hard to write methods th…

“One thing” can mean different things depending on the level of abstraction.

If you don’t understand that, I can understand how the rule could seem confusing

Re: Don't write clean code, write CRISP code

#35

"The problem, of course, is that few of us can agree on what "clean code" means, and how to get there. A rule like "methods should only do one thing" looks great on a T-shirt, but it's not so easy to apply in practice. What counts as "one thing"? I don't agree with this statement at all. From my experience this is perfectly possible. Maybe I'm misunderstanding the statement... why would it be hard to write methods th…

It seems like the author could be looking at your method at the statement level, for example. What does that if/else do? One thing or two? What does this say about the method?

But as I commented elsewhere, there's not a lot of attention to topical scope in the article either, so it also sets out to do the metaphorical "one thing", and then somehow merges with the broader philosophical world...

Re: Don't write clean code, write CRISP code

#36

"The problem, of course, is that few of us can agree on what "clean code" means, and how to get there. A rule like "methods should only do one thing" looks great on a T-shirt, but it's not so easy to apply in practice. What counts as "one thing"? I don't agree with this statement at all. From my experience this is perfectly possible. Maybe I'm misunderstanding the statement... why would it be hard to write methods th…

[deleted]

Re: Don't write clean code, write CRISP code

#37
DRY is probably my least favourite programming meme. There are far too many overzealous juniors who learned it and have a bee in their bonnet about creating absurd abstractions around any two lines of code (or config) that have vague or imagined similarities, locking in all sorts of annoying indirection.

Re: Don't write clean code, write CRISP code

#38

Earlier quoted context omitted.

Go does actually embody the DRY principle (Do Repeat Yourself).

I prefer calling it WET (We Enjoy Typing)

These days Copilot tremendously helps me with those kinds of repetitive code.

Re: Don't write clean code, write CRISP code

#40
post #23

Don't follow the concrete practices in the best-selling book* vetted by industry leaders for years, instead follow this set of 5 high level goals that I've generally described and grouped together into a catchy acronym. Yay me! * - Granted the book was written by an asshole.

I've worked with people following the book to the letter and the quality of their work would vastly improve if they took the time to understand the catchy acronym. The author is not the only problem here.
Post reply on HN