A Programmer’s Mindset
A Programmer’s Mindset Before we finish the chapter, we need to have a word about programming style . Obviously the point of writing a computer program is to make it do what it’s supposed to do, but the style of the program is also important. Your code should be clear and concise, and also be consistent in the way it follows conventions—from the names you choose for variables to the amount of whitespace you leave between blocks of code. Your code should also be easy to read and include comments that explain what the code does. You should always be looking to improve your code to make it more efficient and easier to follow. This process is called refactoring , and should be done regularly so that your code stays up to date and doesn’t become stale. An important principle in programming is the rule “Don’t Repeat Yourself”, or DRY . This means that you should always be looking to avoid repeating lots of code. Following this principle will help make your code more f...