What the hell is dependency injection?

Hazard warning: this post is not about Java though it might appear to be so if you go through the first few paragraphs. If anything, it is about how we call the same thing by seemingly different names. One of the worst hellish concept that any programmer has to learn when moving over to the world of Java is the notion of dependency injection. The beast itself goes by many.. Read More

Object composition implementation styles

  In the first part, we looked at conceptual implications of the various styles of object implications. Now we shall look at a few common implementations of object composition in conjunction with the concepts presented in the earlier post. Association v/s composition First off, we shall start with an example in C to understand the difference struct node { int data; node *next; };struct node { int data; node *next;.. Read More

Implications of object composition styles

Object composition is a concept older than object oriented programming itself. Let us start off with a well understood example of how to represent a rectangle on a Cartesian plane: struct point { int x; int y; } ; struct rectangle { point tl; /* top left corner */ point br; /* bottom right corner */ }struct point { int x; int y; } ; struct rectangle { point tl;.. Read More