9 09, 2016

Readable, maintainable tests using the builder pattern

By |2019-04-13T10:22:19+08:00September 9th, 2016|C#, Design Principles & Patterns, TDD / BDD|0 Comments

One of the most important aspect of TDD is writing unit tests that are more readable and maintainable. Lot of people fail with TDD because when they add more unit tests to the code, they don’t put the effort to make them more readable and maintainable. I have seen cases where adding an extra dependency to a class would mean that the developers needs to modify 100 tests where they were creating an instance of that class. This is a [...]

11 03, 2015

Resharper Tips & Tricks

By |2019-04-18T16:43:37+08:00March 11th, 2015|C#, Tools & Utilities|0 Comments

Resharper is perhaps one of my most frequently used tools, I use it every day and It is one tool that I have gotten so addicted to over the years that I find it very hard to work on a machine where Resharper is not installed. Today I will share with you some of the Resharper features that I use every day and I find very useful. I am using Resharper's IntelliJ key bindings and NUnit project, so the [...]

2 03, 2015

First rule for writing clean code – Naming

By |2019-04-18T17:11:35+08:00March 2nd, 2015|C#, Clean Code|0 Comments

Writing clean code is an art, it takes lot of discipline to write code that can be read by other developers. The most comprehensive book on this topic is by Robert C. Martin (Uncle Bob) and if you have not read his Clean Code book, then that is definitely the next book you should read! Initially I thought of writing a single post and cover some of the things that Robert Martin mentioned in his legendary book, but then [...]

17 02, 2015

Abstraction vs Encapsulation

By |2019-04-13T10:41:56+08:00February 17th, 2015|C#, OOP|1 Comment

Abstraction vs Encapsulation is one of the most confusing concept for new developers. I have seen even experienced developers getting confused over the question, that what is the difference between abstraction and encapsulation? Both these concepts seem related to data hiding and many people use them interchangeably which results in increasing this confusion even more. Let’s try to understand the difference between abstraction and encapsulation in this article. Abstraction If you search for Abstraction on Wikipedia, you will come [...]

16 02, 2015

Liskov Substitution Principle

By |2019-04-13T11:01:06+08:00February 16th, 2015|C#, Design Principles & Patterns|3 Comments

In the previous post I discussed the Open Close Principle, today I will talk about Liskov Substitution Principle. Liskov Substitution Principle is the third principle in SOLID principles. Original definition of Liskov Substitution Principle states that Let q(x) be a property provable about objects x of type T. Then q(y) should be provable for objects y of type S, where S is a subtype of T. This definition is not very clear to understand, later Robert C. Martin (Uncle [...]

16 02, 2015

Open Closed Principle

By |2019-04-13T11:19:02+08:00February 16th, 2015|C#, Design Principles & Patterns|1 Comment

In the previous article, we discussed the Single Responsibility Principle. Today we are going to discuss the second SOLID Principle that is the Open Closed Principle. Open Closed Principle states that Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. In first look it might seem like a contradictory statement, how can a class be closed for modification but at the same time open for an extension? To answer this question take a [...]

14 09, 2014

Use Provider Pattern to Make Code More Extensible

By |2019-04-13T18:14:30+08:00September 14th, 2014|C#, Design Principles & Patterns|0 Comments

Provider pattern is an extremely useful pattern that allows you to write loosely coupled components in .Net framework. .Net CLR injects these components at run-time. The concept of provider model is very simple, yet extremely powerful. We create an abstraction for our components and define which concrete implementation we want to use in the configuration file. When the code executes, we can create an instance of the concrete component mentioned in the configuration file. Using a Provider for Logging Let's look at a simple [...]

13 09, 2014

Writing Your First Unit Test – Part 2

By |2019-04-13T19:48:08+08:00September 13th, 2014|C#, TDD / BDD|0 Comments

In the previous post, I gave an overview of how to get started with TDD. I tried to highlight the thought process and steps that I take when doing TDD. In this article I will continue building further on the shopping cart from the previous post and show how I can add further functionality to it using TDD. The tests that I want to focus in this article are the following: Adding an item multiple times Removing an item Adding [...]

7 09, 2014

Writing your first unit test – Part 1

By |2019-04-17T15:58:31+08:00September 7th, 2014|C#, TDD / BDD|2 Comments

In this post, I am going to show you the thought process and steps that I take while doing TDD. I am going to focus on a simple scenario. This will show you the baby steps that I take while writing my unit tests. This is going to be a two-part tutorial. In this first part, I am going to show you how to follow the 3 step process of TDD i.e. Red, Green & Refactor. I am going to [...]

25 05, 2014

Useful Tools and Utilities That I Use

By |2016-11-24T14:12:50+08:00May 25th, 2014|C#, Tools & Utilities|0 Comments

Over the years I have used a lot of tools and utilities that I found really useful. Some of these tools increase my productivity and some just make life easier for me. Some tools made me addicted to them and I started each similar software with their perspective. Here I will share a list of tools and utilities that I use everyday. I will keep on adding new tools. I am just writing about these tools because I love them and [...]