Hacker News new | past | comments | ask | show | jobs | submit login

Really depends on the language and paradigm you're using, but the general aim for writing good code is to aim for loose coupling, high cohesion, don't repeat yourself, the single responsibility principle, and the Open/Closed principle (and several other philosophies) in order to maximize code re-usability and reduce maintenance effort.

You should aim to use whatever features your language provides to attempt to enforce the above, by information hiding, encapsulation, avoiding global mutable state as much as possible, and using design patterns to achieve a good balance.

You could give two similarly experienced programmers a fairly trivial problem and they might come up with wildly different solutions, because the best solution is a myth, but we know the wrong solution if we see it (that comes from the experience of making the same mistakes.)

If you give details on the language(s) you're using I may be able to point you to some literature on good design.




Sorry for the late reply.

Recently, mostly Python and Javascript




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: