Live data from Hacker News

Don't write clean code, write CRISP code

bitfieldconsulting.com

51–60 of 170 posts

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

#51

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...

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

#52
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 which way, which particular feature set of their corporate software project was conceived...

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

#54
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."

Ah but idioms change as languages evolve. To me idiomatic is ‘the way it’s done now’ rather than ‘the way it’s always been done’

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

#55
> So, while readability isn't quite as important as correctness, it's more important than anything else.

In most cases, readability is more important than correctness. If you have readable code, you can always make it work correctly later. But if you have code that merely works correctly, it isn't necessarily easy to back and make it more readable.

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

#57
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.

Gentle reminder that industry leaders could be wrong too, and domain-specific knowledge, even if gained from experience, may not necessarily be universal truths especially in platforms that may follow different patterns or paradigms. Programmers really should be more discerning about the people whom they are looking up to.

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

#58
post #17

Since we’re adding new backronyms every day, I propose SIMPLE. S - Spaghetti: write tapestry of code like a chef. I - Interlinked: if the project has modules, they should all depend on each other (we are strongest when we can depend on one another). M - Micromanaged: if the product owner doesn’t expect reports in the daily stand-up, do they even care? P - Perplex: diversity for the codebase. L - Lazy: Bill Gates once…

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?

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

#59

"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…

The point (which I don't 100% agree with, but can see) is that what it means to "only do one thing" is sometimes debatable.

Say I write a 1000-line method that implements a red-black tree data structure, including returning closures that allow you to search for, add, or remove nodes. I could claim that this method does precisely one thing: it implements a red-black tree.

Or, say I write a ten-line method that takes a list of names and returns the unique names ordered alphabetically. Someone could complain that the method does too much, because it both finds unique names and sorts them alphabetically.

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

#60

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.

I put it second behind "premature optimisation" which is used to justify never caring about performance at all (until it's too late and you can't do anything about it).
Post reply on HN