3 ms·
I agree with several other users on this thread about maintaining existing code. If you aren't already working in a position in which you have to modify code w
by technofire 9y ago
I agree with several other users on this thread about maintaining existing code. If you aren't already working in a position in which you have to modify code written by others, try to start fixing bugs or writing features for an open source project. In either case you should immediately see how frustrating it is to try to figure out why things in the code base are the way they are, and I think the best solution is not documentation but clear, clean code that self-documents, not with comments but with small focused recipe-like functions. Bob Martin's book Clean Code[1] is a quick read that makes clear how this can be done effectively. Martin Fowler's book[2] is another obviously good illustration.
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 http://amzn.to/2uewcpB
[2] Refactoring (Martin Fowler)
http://amzn.to/2vnD7vx http://amzn.to/2vnD7vx