Beautiful, elegant code
I stumbled upon this guideline for clean HTML code, today. Although meant for HTML, the guidelines can apply to almost every form of structured language. This includes various kinds of code used for software programming, hardware design, document formatting and what nots. I'm currently designing my processors in Verilog, programming kernel code in C, writing up my thesis in LaTeX, drawing diagrams with GraphViz and DrawTiming. So, it's very important for me to keep a clean coding style in order to manage the project easily.
I regularly judged code quality by how ugly it is. My logic is this: if the coder does not even bother to make his/her code beautiful, the design itself cannot possibly be elegant. It doesn't matter how great the design is, if nobody else can appreciate it. I get to see more than my fair share of ugly code. I'm currently the demonstrator for 1A C++ labs. I cringe when I see most of their code. But I just bear in mind that for many of them, it's their first time, and learning the concepts is more important than having beautiful code. But, I still cringe, nonetheless.
I try my best to challenge them. But not many of them are willing to take it up. Most of them end up hating me and just ask some other demonstrator. The few who do take up the challenge, end up learning something. Programming is a task, best learned by doing. The others, will have trouble with their work for the next few years. These days, programming is a required skill. Everyone uses it. So, it's important to learn how to do it, and do it well.
Having beautiful, elegant, clean code is the first step to doing it well.
No comments:
Post a Comment