6 ms·
Writing as little code as possible to fully accomplish a goal has recently become a fundamental principle that I live by. If I can write a piece of code in few
by GotToStartup 15y ago
Writing as little code as possible to fully accomplish a goal has recently become a fundamental principle that I live by.
If I can write a piece of code in fewer lines, I'll do it. That pretty obvious, we all would. But I try to take it a step further and consciously seek solutions that lead to fewer lines of code. Chopping down a large block of code is an incredibly gratifying feeling for me.
I find that writing less code while maintaining expressiveness usually leads to simpler solutions and, IMO, it is simplicity that reduces the bug count.
- iandanforth 15y agoI find that in a team environment that I would prefer my co-workers write more lines of code, and longer lines at that. While, given a moment or two, I can unpack a dense list comprehension (a one liner) I would rather read several statements that add up the same thing. Of course there are many times when you could do the same thing with fewer lines, in a more elegant, straight-forward way. However I have a hard time believing that just having fewer lines is a sufficient goal for flexible, maintainable code. Then again I'm pretty new at this :)
- revscat 15y agoYou will probably enjoy this, then: http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html http://binstock.blogspot.com/2008/04/perfecting-oos-small-cl...