Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sorry, this sounds a lot like motivational "feel good" advice that's in essence empty and confuses more than helps.

"write small functions" sure, how does it help managing complexity? Now you have several tiny functions and need to jump across files and functions to understand how everything works (+ the overhead each function adds - parameters, return values, etc)

Sure, small functions have their place, but sometimes it is easier to have a big block of code that does what you need. Or as another comment said, write small functions but big procedures.

Now for my favourite pet peeve: that 80 columns is some kind of "best practice". In reality it has been cargo culted since the days of the initial IBM PC and there is no reason for such an arbitrary number to exist. But the church of 80 columns keep repeating their mantra mindlessly, mindlessly uglyfying lines of code which go over only a couple of characters beyond 80 columns and wasting coder time with this instead of actually asking the question: is the code actually easier to read now or not?

Because to me, calling a function with one parameter in each line is extremely ugly (especially under-indented as the examples presented in the article)

Is a line that's 85 characters essentially harder to read (especially now with multiple screen sizes and widths) than an 80 char one? No.

I'm not advocating for writing 200 character lines of code, but to not be absolute about it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: