My First steps in Test Driven Development- A Win-Win strategy

Agile practitioners talk about Test Driven Development(TDD), so do lot of developers who care about their code quality and workability. And I once upon a time, not so long ago managed to read about TDD. The crux of TDD as I have understood is: Write Test, and fail Code, make the tests succeed Automate the … Read more

Why is the legacy code is the way it is?

google search for define: legacy gives:

leg·a·cy/ˈlegəsē/

Noun: An amount of money or property left to someone in a will.

Adjective: Denoting software or hardware that has been superseded but is difficult to replace because of its wide use.

Most of us would have worked on legacy code OR are working on it OR are even creating legacy code (!!). Just the thought of working on legacy code makes developers spend sleepless nights (yeah, slight exaggeration, but required to highlight the pain). We have yelled and cursed while working on legacy code. Lets step back and reflect a bit about legacy code and see how it can be tackled (if at all!)

Read more

Book Review: Essential Skills for the Agile Developer

This book does justice to its title and subtitle- it clearly tells you the basic design principles to write good code which is easy to read, debug and extend. At first glance the title may seem misleading as it uses the word “Agile Developer” but there isn’t much specific to agile in the book, though familiarity with terms like Scrum or Kanaban or TDD would be an added advantage.

Read more

SOLID- Liskov Substitution Principle

Liskov Substitution principle (LSP) states that,

Methods that use references to the base classes must be able to use the objects of the derived classes without knowing it

This principle was written by Barbara Liskov in 1988.

The idea here is that the subtypes must be replaceable for the super type references without affecting the program execution.

This principle is very closely related to Open Closed Principle(OCP), violation of LSP in turn violates the OCP. Let me explain:

Read more

SOLID- Open Closed Principle

Open Closed Principle (OCP) states that,

Software entities (Classes, modules, functions) should be OPEN for EXTENSION, CLOSED for MODIFICATION.

Lets try to reflect on the above statement- software entities once written shouldn’t be modified to add new functionality, instead one has to extend the same to add new functionality. In otherwords you don’t touch the existing modules thereby not disturbing the existing functionality, instead you extend the modules to implement the new requirement. So your code is less rigid and fragile and also extensible.

OCP term was coined by Bertnard Meyer.

How can we confirm to OCP principle?

Its simple- Allow the modules (classes) to depend on the abstractions, there by new features can be added by creating new extensions of these abstractions.

Read more

SOLID- Single Responsibility Principle

The Single Responsibility principle (SRP) states that:

There should never be more than one reason for a class to change.

We can relate the “reason to change” to “the responsibility of the class”. So each responsibility would be an axis for change. This principle is similar to designing classes which are highly cohesive. So the idea is to design a class which has one responsibility or in otherwords caters to implementing a functionality . I would like to clarify here that one responsibility doesnt mean that the class has only ONE method. A responsibility can be implemented by means of different methods in the class.

Read more