Clean Code
I have recently been reading a book called Clean Code by Robert Martin. I have found much of this book extremely interesting from the perspective of a student and a software engineer. Working on smaller projects, especially academic projects, many parts of the code are definitely not clean. Code smells reign, but as long as the code works and can be turned in as a working sample for the project, most everything is OK. However, this is not something that is remotely near OK for production code or code that will need to be maintained. A somewhat funny quote that I have seen online many times gives another reason: "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
Code Smells
A lot of code "smells". All too often code is written with the intent of getting it to work, and then instead of making it extensible, readable, or maintainable, we move on to the next piece. Slowly the gunk in our code fills to the point that touching it carefully will break not only the part we touched, but everything else. A good portion of the book goes over the various smells to watch out for.
Refactoring
Students especially rarely will refactor. Once the code is ready to be turned it is considered done. Without a refactor, our code is left in its smelly state that does not help bring out the principles we should strive for. Refactoring takes time. There is no doubt about it but the time savings of cleaning up our code as we go is important.
Time Savings
Taking more time now, once a new feature is working, is somewhat counter-intuitive for many. Now that this is done, it is time to move to the next task, the next deadline. The problem is we slowly grow in technical debt and eventually changing anything will take more and more effort. The extra time and preparation now will make us ready to continue forward. I highly recommend reading through Clean Code as it has tons of wonderful information and insight for how to write so that code is readable and maintainable. And remember, the next person maintaining your code may be a psychopath....