In the previous post, we talked about the different ways of creating an object of a class. In this post, we will weight them on several parameters. Line of Code: When you use a constructor, you don’t need to add any extra code just a constructor. When you use a mapper, you have to add…
Read moreWays to create an object of a class
Using constructor: It’s the widely used way of creating objects of a class in most of the programming languages. Based on the need you can overload constructors. See a sample code snippet below. Usage of the above mention code snippet looks like following. Using syntax sugar: Programming languages provide many ways of creating an object…
Read moreWhy should we write unit tests?
When I joined my first organization, my seniors asked me to write unit tests for each and every line of code. I was new to the formal IT industry, hence I just followed my seniors. No one explained any reasoning to me. I kept asking this question to my self, why should we write unit…
Read more