Live data from Hacker News

Don't write clean code, write CRISP code

bitfieldconsulting.com

61–70 of 170 posts

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

#61

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.

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

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

#62

Earlier quoted context omitted.

I‘d like to extend it to SIMPLED: D - Duplicated: it's always good to have backup code at hand.

I'd go with SSIMPLEDD - because it needs to Scale and more Duplication must be better?

Great! Let me propose SSIIMPLEDD:

I - Iteration: As we showed over the last 2 hours, iteration is always the way to go.

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

#63

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.

Totally agreed. I've tried explain exactly this issue in a talk [1], trying to find a useful synthesis between different paradigms like KISS, DRY and YAGNI. [1] https://www.youtube.com/watch?v=0FIZn2trkoA&pp=ygUXbWljaGVsI...

I asked everyone's favorite chat AI to come up with a new buzzword using the letters from those.

The best was KINDergartener (uses all the letters). I would describe this as a programming paradigm for people who are new to the programming and real work and havn't found out that the getting shit done and shipping the code to users is the most important state for code to be in.

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

#65

Earlier quoted context omitted.

I'd go with SSIMPLEDD - because it needs to Scale and more Duplication must be better?

Great! Let me propose SSIIMPLEDD: I - Iteration: As we showed over the last 2 hours, iteration is always the way to go.

All you need to do is get Y in there and we'd have recursion covered as well.

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

#66
post #43

I can't stand the insistence on "idiomatic". Taken to extreme it is essentially gate-keeping and dogma: "We have always done it so."

I think is has value for code to be idiomatic. It's a very dynamic goal post for sure, which is a problem in a rule but not in a principle like in the article.

To me, code that is not idiomatic sounds wrong, which is at least a cognitive hurdle (you need to spend more thinking power to unravel/decode it to figure out the meaning). I believe this is in line with the usage regarding natural (human) languages. A sentence might be syntactically correct but if its non-idiomatic it sounds wrong and throws the listener(s) for a loop understanding it.

A very simple example is that in C, I greatly favor allocations to be written according to:

    P = malloc(N * sizeof *P)
where P is the pointer variable receiving the return value, and N is an expression yielding the number of desired elements. The sizeof is completely idiomatic, always present unless I'm allocating an actual byte buffer, and always de-references P like that to lock the size to the receiving pointer. So this is my idiom for how an allocation is written. It might (should!) be yours, too but that's not a requirement in a personal principle I guess.

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

#67

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.

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,

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

#68
post #61

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.

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.

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

#69
post #39

> Who wants to write dirty code, unless maybe it's for a porn site? Even porn sites need to write great code to handle huge traffic. I am offended by this

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!

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

#70
Don’t write clean code, write the best way to express your idea without caring too much about how dirty that looks like, and let the AI chat bot rewrite it in the cleanest version that follows all the best practices!

I’m not even joking, that’s basically my process since ChatGPT-4 has been released :) That’s a dream for boilerplate heavy languages like Go, C#, and C++.

Post reply on HN