Software craftsmanship

Opensource Software vs Free Software vs Freeware Software

Reading Time: 3 minutes In this article, we will look at the differences between open-source software vs free software vs freeware software. While growing up and trying out various software on our computer, we often come across the terms like free software, freeware, opensource, etc but we never pay much attention to it. A lot of people think that freeware software is the same as free software and they Continue Reading

TDD: What & How?

Reading Time: 3 minutes Programming is like exploring a dark house. You go from room to room to room. Writing the test is like turning on the light. Then you can avoid the table, furniture and save your shins i.e resulting clean design from refactoring. Then you are ready to explore the next room. There is famous saying in software development that If it isn’t tested, it’s already broken. Continue Reading

ATDD, ScalaTest, Cucumber and respecting DRY

Reading Time: 3 minutes In our last post we looked at how it was easy to use ScalaTest for doing acceptance testing. In a post prior to that, we had looked at doing the same with Cucumber. We had also concluded that though acceptance tests could be written in the way described however, there was an issue. Writing the feature files with individual features having multiple scenarios which would Continue Reading

Code Smell : Primitive Obsession

Reading Time: 2 minutes Primitive Obsession is when the code relies too much on primitives. What this means is that a primitive value controls the logic in a class and this primitive value is not type safe. For example, there are multiple situations in which we might consider the use of String for comparison and driving the logic even though we are fully aware that it might result in Continue Reading

Respecting Open Closed Principle with Visitor Pattern

Reading Time: 3 minutes One of the common principles in the bouquet of SOLID principles is the Open Closed Principle (OCP) which states that software entities should be open for extension but closed for modification. This means that if we have to add any new functionality then ideally, we should be able to extend the current set of software entities by adding a new entity rather than creating a Continue Reading

Long Method? Move Accumulation to a Collecting Parameter

Reading Time: 2 minutes You would have definitely come across long bulky methods which accumulate information to a local variable and pass back that information. Here the local variable goes through a lot of changes throughout the logic of the method before it is finally returned back. Let us see how the combination of compose method, that we covered in the last post, and moving accumulation to a collecting Continue Reading

Long Methods? Try Compose Methods

Reading Time: 2 minutes We all have seen long winding code that goes on and on. By the time you have hit page down a couple of times, you forget what the method was doing. You forget because the method is doing a lot. It is failing the SRP principle and needs to be broken down into smaller pieces. According to me if you are looking at a method Continue Reading

What is the Correct Caching Strategy?

Reading Time: 3 minutes While uncovering ways to speed up our application on the Google App Engine, we decided to use Memcache. This led us to an interesting discussion which I am reproducing here to get your inputs. As you would observe, if you are following our blog, that there are 2 potential ways to cache, invasive and non-invasive. May be there is a third way which you would Continue Reading

Google App Engine: Understanding Non-Invasive Caching

Reading Time: 3 minutes In the last post on understanding caching we talked about the general support of GAE for caching and how we could easily incorporate caching in our application. You would also recollect that we talked about the invasive form of caching in which the business layer was aware about the caching framework. In this post let us talk about the non-invasive way to cache. Since caching Continue Reading

Duplicate Code? Chain Constructors

Reading Time: 2 minutes After the ‘Introduction of Null Object’ and the ‘Replace One/Many Distinctions with Composite’ let us do an easy one this time. It is easy but of course it is present in a lot of code samples else we would not be discussing it here. If there are a lot of constructors which have duplicate code then see if there is a reasonable possibility to chain Continue Reading

Duplicate Code? Replace One/Many Distinctions with Composite

Reading Time: 3 minutes After the first post on how to introduce Null Object, in this second post on how to write clean(er) code, let us look at one of the very frequent occurrence. At least something that I have seen quite often. You too would have noticed that many APIs provide two methods to do the same thing. One of the methods expects one object and the other Continue Reading

Duplicate Code? Introduce Null Object

Reading Time: 3 minutes One of the most significant code smells is having duplicate code. There are primarily 2 forms of code duplications Explicit – These are the ones where there is blatant copy paste of the code. Methods are repeated within classes and it is easy for the CPD tool of PMD to figure out that lines are copied thus leaving us red faced. Subtle – This is Continue Reading

Open Closed Principle in Action

Reading Time: 4 minutes Ivar Jacobson stated that all software entities change during their life cycle and this must be borne in mind when developing systems which are expected to last longer than the first version. A design principle which helps you with long lasting software is OCP (Open Closed Principle). Open Closed Principle was coined by Bertrand Meyer. It states that “Software entities should be open for extension Continue Reading