3 ms·
Ask HN: What are the most important principles you follow?
I see a lot of beautiful code in GitHub and other places and wonder how they can write such amazing software? How you do it? How you manage to write good code? What are your main principles?
- jbax 12y ago1 - Keep it simple. Then simplify. 2 - Write code that can be unit-tested 3 - Don't try to use a new framework for every little thing you could do on your own. 4 - Organize your code so it can be reused by others 5 - Write code as if you were writing for someone else to see and understand 6 - No duplication, no duplication, no duplication, no duplication. Write for reuse. 7 - Try to solve complex problems and develop good algorithms, you'll get better over time. 8 - As a rule of thumb, a class with more than 300 lines of code is a bad smell, unless it is an utility class of some sort, some core thing that is intrinsically complicated.
- kevan 12y agoTrying to avoid cleverness is a big one for me. Also, learning about patterns (both from books and from existing software). It can be pretty overwhelming to start a new project from scratch, but patterns provide a reference point to start from.