Monday, May 28, 2012

What is a framework?

When someone says they have defined a "framework", what does it mean? Is a framework just a library of resuable components? Or is it something more?

There is a good article on CodeProject on the same topic -

The book "Applying UML and Patterns" by Craig Larman also gives a very good understanding of the concept. Jotting down snippets from both these resources, in my own words.One may consider them the 10 guiding principles while designing a framework.
  1. At the risk of oversimplification, a framework can be defined as a cohesive set of classes/interfaces that provide services for the core part of a logical subsystem. 
  2. A framework contains both concrete and abstract classes that define interfaces to conform to, and other object interactions.
  3. Frameworks usually allow the end-users to define sub-classes of existing framework classes for customization and extension of the framework services.
  4. A framework enforces adherence to a consistent design approach.
  5. Relies on the "Hollywood Principle" - "Don't call us, we will call you". This pattern is also called as IoC (Inversion of Control). 
  6. A framework makes it easier to work with complex technologies.
  7. A framework reduces/eliminates repetitive tasks.
  8. A framework is often re-usable across multiple scenarios -  regardless of high level design considerations. Frameworks offer a higher degree of reuse - much more than individual classes.
  9. A framework forces the team to implement code in a way that promotes consistent coding, fewer bugs, and more flexible applications.
  10.  A framework can be used as a software building block in the system architecture definition.