Comments – Bad Comments (Part 1)

In our previous post, we looked at cases where  including comments in your code is a good thing. This time we will look at the cases where comments are a bad thing. The examples that we mention below, are bad, mainly because they are used as a compliment to code that can be cleaner. The…

Continue reading

Comments – Good Comments

Even though you should generally try to write your code in a way that doesn’t need comments, there are cases where they can be valid. Below are some examples. Legal Comments Sometimes your job will require you to put some legal comments at the beginning of your file. Maybe you’re using some open source code…

Continue reading

Comments – Introduction

All of us have written comments for our code. Many times we have relied on comments to try to make sense of the code we’re seeing. As Uncle Bob puts it in his book, “comments are, at best, a necessary evil” and shouldn’t be used carelessly. Why we need comments To put it simply, we…

Continue reading

Functions – The DRY Principle

A very important lesson that every programmer has to learn at some point, is that duplication is bad. This is what the DRY Principle addresses. What is duplication? Simply put, duplication is having lines of code in your application, that are repeated in multiple places. Whenever you copy and paste a snippet of code, you…

Continue reading