Dependency Inversion Principle and Abstract factory Pattern

DI Principle says high level components/classes should not directly depend on low level components/classes instead both should depend on the abstraction.

direct dependency Object tree

Object tree through abstraction
From these figures the object tree has been reversed which is dictated by DI principle.

Guidelines that help us avoid violation of DI principle:

  • No variable should hold a reference to the concrete class
  • No class should derive from concrete class
  • No method should override an implemented method of any of its subclasses

Abstract factory patterns is an extension to the factory pattern which helps in creating families of related or dependent objects without specifying their concrete classes.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Mostly technology with occasional sprinkling of other random thoughts


Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates


A topnotch site


Just another site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey

%d bloggers like this: