Sunday, 14 December 2014

Neat Code

Code written in javascript, css, html, etc. is all very free-form, which means that taking care to organize code neatly is particularly difficult. As I work on a project, I often find that there are many ways to write a certain part of my code, but that I'm not sure which one is the nicest, most readable way to write the code. Given that the different options are nearly identical in performance, I don't have an easy tie-breaker for the different styles. Shorter code is not always easier to read, but longer code is not always sufficiently succinct. If a single css file is becoming thousands of lines long, it seems like I should refactor some of it, but isn't it uglier to have the code split between css files than have it all be in one easily searchable document? My solution to this has typically been to read others' code and model it off theirs. For this reason, I spend a fair amount of time browsing websites like codepen.io and various web design blogs to catch a glimpse of others' programming paradigms. But who is to say that their code is better? For this reason, I've read various books on general code organization, e.g. Code Complete and The Pragmatic Programmer, two books that I plan on looking back upon over the break.

No comments:

Post a Comment