Live data from Hacker News

Don't write clean code, write CRISP code

bitfieldconsulting.com

71–80 of 170 posts

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

#71
In fact there only a few things that matter:

- code, when executed, should do what is expected.

- code should be maintainable.

All the rest are just some ways to get there, but not must-haves.

One great way to get there is:

- discuss architecture, nomenclature and design choices. Document those.

- have your code and docs reviewed and discuss/rework accordingly.

The above in a rinse and repeat manner.

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

#72
Completely agree, except that simplicity is kind of redundant. If the code is correct and readable, I don't see why I need to simplify it any further, to me it's probably simple enough if the complexity isn't causing problems. It seems like engineers, and humans in general, really love simplicity for its own sake, in some deep way I that makes me wonder if I'm secretly a bad person, since it seems to so often be praised as connected to so many other virtues and most every philosopher ever seems to love it.

I'd much rather have DRY than simplicity, because repetition creates the possibility for later divergence and incompatibility and stuff left behind. What if there's a bug in the thing you repeated and only 9 out of 10 get fixed because of an oversight?

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

#74

Earlier quoted context omitted.

It's a bit of an awkward protrusion to thrust into an article that's aimed at general tech audiences. And I did wonder, reading that: IS there actually a dirty coding language for porn sites? Certainly the simplest of erections in that area could arouse some latent skill. Contributions would likely be furious. Though some annoying friction is perhaps practically guaranteed, depending on which executive discovers, in…

Now I want to create this language, thanks!

Would love to see it. May my freshly earned downvotes be good for something, this is the world I like to be a part of.

It's interesting how people love to hate on plain old passion, with passion...this is quite an irrational kink really, tho the bar isn't generally set very high

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

#75

Earlier quoted context omitted.

For best results, set your DRY dial to 8 or 9 out of 10. Settings higher than 9 result in premature or excessive abstraction. But if you hate DRY so much, imagine a word where people set it to 1 or 2. I wouldn’t want to work in that code base.

Whatever you do, never turn it up to 11,

But what if you just need that extra bit of dryness and you're already at 10?

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

#76

Earlier quoted context omitted.

Could you elaborate on the last point?

Uncle Bob has been widely criticized for his political stances, basically being a MAGA republican. This also spilled into some critiques of Clean Code which are sometimes colored by this.

Uncle Bob has been widely criticized for his political stances, basically being a MAGA republican.

I don't think that's a fair representation of his critics. I've been reading (and even occasionally writing) critiques of Uncle Bob for many years, and you are literally the first person I've ever seen even mentioning is political stance. Up until 30 seconds ago I'd not once reflected over who Uncle Bob might vote for.

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

#77
post #13

Earlier quoted context omitted.

> Before that you had to write a for loop every time you wanted something from an array. How often do you do that? I mean, it comes up - but if you're linearly scanning every time you want to select something from a list, that sounds like a surefire way to write slow code to me. Is there a reason you aren't using a map?

Linearly scanning a small array is very likely to be faster than looking up a key in a map. Especially if we factor in memory cost and not just speed.

Now I understand why mordern web is slow as hell.

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

#78
post #68
post #61

Earlier quoted context omitted.

DRY only paired with the rule of three (or more)

That, or the code block is sufficiently big and similar. I remember a ex-colleague of mine who copied a 1000 line function, changed a parameter, and didn't see anything wrong with it.

Why do you have a 1000 line function in the first place? Sounds like an entire class of methods in a single structure.

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

#79
What an excellent post! What I would add though, is that you can gain some simplicity by removing abstractions (e.g. interfaces) and sometimes it's just worth it. For example, a good practice may be to abstract away all implementations and use interfaces instead, but for things like logger (which may be a bit complex to abstract depending on it's API), you may be just fine logging to some buffer instead of maintaining mocks (and in Go you'll probably make expectations what they should be called with). Focus on things that matter - if you want to check logs in your tests too, make it as effortless as it can be (e.g. use snapshots for those).
Post reply on HN