Ask HN: What has heavily influenced your coding style?
Aside from books, has there been any major events or issues that stemmed from your code while in production, etc that has shaped how you code and how do you think you improved from there? Generally curious and want to learn more.
5 comments
[ 4.9 ms ] story [ 22.4 ms ] threadJust the KISS principal. I'll take repetitiveness over obfuscation anyday.
But it also needs to be readable/pronounceable: and it needs to be readable even on cruddy screens / bad printouts. No "i" and "j" for loop counters, for example: the compiler doesn't care how long you make your names, so I use things like "kt" or "ndx" (because typos happen, and fewer characters that still convey the same meaning is acceptable).
I also do my best to never write overly clever code. Shared another [HN](https://blogs.msdn.microsoft.com/oldnewthing/20170719-00/?p=...) [post](https://news.ycombinator.com/item?id=14810014) with a little commentary on G+ last night:
The second thing that has really influenced my coding style for the better (making it clearer and easier to understand) is writing a medium-sized program using a strictly functional language like Erlang. This will force you to use global state less, to write functions in such a manner that the function itself includes all the information required to understand it, simply because global state cannot be used and everything on which the function operates must be passed into it explicitly via its parameters.
[1] Clean Code (Robert Martin) http://amzn.to/2uewcpB
[2] Refactoring (Martin Fowler) http://amzn.to/2vnD7vx