• Home
  • RSS Feed
  • Log in

Serge Beaumont

Article: The Creational Problem (The Creational Series 1)
Posted by Serge Beaumont around lunchtime: July 19th, 2006

We’ve put up a new article. Summary follows:

Polymorphism is the main mechanism to create maintainable object-oriented code. Client code uses other code through an abstract interface, and as long as we don’t break the behavioral contract, we can change the implementation behind that interface at will.

You will only achieve real maintainability if client code has dependencies to other code through an abstract interface and nothing else.
Unfortunately creational logic will – by its very nature – break this rule. When you create an instance, at some point you will
need call the constructor on the actual implementing class. This creates a dependency that prevents you from changing the implementation transparently, effectively cancelling the advantages of polymorphism.

The solution to the creational problem is to protect the abstraction by hiding the creational logic from the client code. Dependency injection is the ideal solution, in this case the client does not use creational logic at all. But in its turn the injecting code needs to create real instances.

This article is the first of a series of three: this article will illustrate how the creational problem manifests itself, the second will deal with some advanced implementations of creational code, and the third will deal with dependency injection.

Share

Filed under Articles, Java | No Comments »



No Responses to “Article: The Creational Problem (The Creational Series 1)”



Leave a Reply

Click here to cancel reply.


Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India
  • Xebia Sweden

Categories

  • Java (311)
  • Agile (181)
  • General (136)
  • Scrum (67)
  • Architecture (64)
  • Testing (59)
  • Performance (46)
  • Middleware (56)
    • Deployment (38)
  • Xebia Labs (39)
  • SOA (31)
  • Podcast (31)
  • Project Management (28)
  • Tools (26)
  • Uncategorized (20)
  • lean architecture (20)
  • Quality Assurance (17)
  • Articles (13)
  • Requirements Management (13)
  • Virtualization (19)

Tag Cloud

    Architecture agile architectuur Oracle Java TDD Grails product owner JPA Groovy ACT Moving to India Flex Scala Javascript Agile Frameworks Eclipse Concurrency Control Xebia SOA Hibernate lean architecture Lean Maven lean architectuur Ajax Scrum JPA implementation patterns XML Spring

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
Avatars by Sterling Adventures