Hi Friends, Welcome to GUVI Blogs again!! It’s story time and rewind to my college days!!
That was my first reasonable project in programming. I had written a parser for 2-pass macro assembler using C. It was around 2500 lines of code, I was happy that my code worked in my machine. Better yet, my code worked during the demo as well. 🙂 That’s a miracle.. So I had a great milestone to brag about – THE WORKING CODE. But after I finished the project, I sat after a few weeks to just review the beautiful art that I had created (hehe, I am talking about the code that I had written). I was hardly able to understand anything in my own code !!!!!!!! 😦 That’s when I learnt some important lessons in programming.
Modules please
My working code contained 2500 lines of C code in the main function. Wow… What an achievement, I thought. But when I reviewed it, I realized that things should not have been this way!!
Lesson Learnt: I should have split the code into nice modules, that would have saved a lot of time during maintenance.
Comments please
I didn’t put comments wherever necessary, so I was caught trying to figure out what each and every line or piece of code did. It was difficult as hell and I wasted a lot of time literally trying to find out what the code did. Remember, this was just few weeks after I wrote the code.
Lesson Learnt: I should have added enough comments for even myself to understand the code in the future 🙂 Continue reading →