Clean code and University

29 Sep 2010

I’ve now finished my summer internship at Eden Development. The summer was a blast, I learned so much about shipping real products to real people (compared to university where one mostly works on short-lived solutions to small problems).

I learned a bunch about what ‘good code’ looks and feels like, mostly from discussions with everybody at eden, and just the inherent learning that comes from pairing. Enrique showed me some very nice examples of code he’s written, which really helped.

Since coming back to university, I’ve been bemused by my coursemates attitude towards ‘clean code’ and testing; for the most part, they don’t care about either very much. I think this is one of the side effects of university projects being short lived, when you only work on the code for a month, its quality seems to matter less.

The counterpoint to that is that lecturers (or more often, their assistants) have to read your code so that they can grade it. If the code is really horrible and hard to understand (even if it does solve the problem), then it is likely you won’t get a good grade.

With tests, it turns out that lots of problems set at the university level have sample input and output. This situation is just ripe for testing, as you can be sure that your program does the right thing (and check that instantly).

The other point about ‘clean code’ at university is that it really comes down to caring about your output. Everybody I worked with over the summer was fanatical about the quality of the product they turned out. That kind of passion shows through in your code, and makes good impressions on lecturers (which often leads to better grades, and helps you get into any further education prospects with the university). For me, this is the real reason I strive to write clean code at university. It puts me in a mindset of only writing clean code, which is a good habit to have.