Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Is your code Clean enough?

Name: Anonymous 2016-01-20 13:09

Hi, Everyone. I'm slowly learning Haskell and something that slows me down is how different the culture and style is from Clean Coding. (I.e., Clean Code: A Handbook of Agile Software Craftsmanship)

I'm coming from Ruby, and CC is hugely influential. E.g., Code should be self-documenting with descriptive variable and function names. Functions should be very short and each one's expressions should all be at a similar level of abstraction.

Sandy Metz's Rules are also very prominent. E.g.:

Methods can be no longer than five lines of code.
Pass no more than four parameters into a method.


But the Haskell docs and code examples in posts are pretty far from this style, e.g. I see one-letter identifiers, multiple levels of nesting, functions which are many lines long, etc.

EDIT: Cf. Elixir, where Haskel's a becomes any.

What do haskellers think of this? To me, much Haskell code is unnecessarily obfuscated.

Name: Cudder !cXCudderUE 2016-01-21 5:30

Methods can be no longer than five lines of code.
I really wasn't sure if this was really meant to be serious, or just a sick joke, but then I Googled it... :facepalm:

These are the things the ENTERPRISE cargo-cult is constantly raving about. These idiots got brainwashed into the shorter=better mindset, completely ignoring the fact that it adds overhead and turns the nice linear control-flow into a hairy nested spaghetti mess of fragments, making the whole program bigger. One 500-line method is better than 100 one-line methods, if only for the fact that you don't have to go jumping all over the place to figure out how it all works.

This rule would be better (and I've had to use a variation of it on some embedded systems):

Function calls can not be nested more than five deep.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List