Eyes, JAPAN Blog > No Code Is The Best Code

No Code Is The Best Code

sascha

この記事は1年以上前に書かれたもので、内容が古い可能性がありますのでご注意ください。

I come across old code quite often. Sometimes it is code I wrote, but probably more often it is the code of others. It doesn’t matter much however: If the code age is more than a couple months there is practically no difference between the two scenarios. We are all different people compared to our past selves.

Keeping in mind that the code we write probably has to be understood by others in the future it is very important to keep everything readable and understandable.

I don’t want to get into details here today – there are lots of articles out there discussing the use of `guard` and `defer`, for example. I leave it up to them. Comment why the code is doing certain things and what it is trying to accomplish.

The number one goal I keep telling myself is to avoid code wherever it is possible and it doesn’t get in the way of readability and comprehensiveness.

Refactoring is a big part of coding, so don’t hesitate to write ugly code at first. It is okay for code to be ugly at the beginning if it works. Cover your implementation with tests and start improving it. Make your code beautiful. Reduce the amount of it.

Comments are closed.