• Home
  • RSS Feed
  • Log in

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/Bookmark

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.

Deployment automation for Java application running on Websphere, WebLogic and JBoss

Archives

  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009

Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India

Categories

  • Java (282)
  • Agile (109)
  • General (50)
  • Testing (42)
  • Performance (42)
  • Hibernate (36)
  • Scrum (33)
  • Podcast (31)
  • Architecture (31)
  • Spring (28)
  • SOA (24)
  • Maven (22)
  • Project Management (22)
  • Middleware (23)
    • Deployment (14)
  • Flex (17)
  • JPA (17)
  • Eclipse (15)
  • Xebia Labs (15)
  • Quality Assurance (14)

Tag Cloud

    Agile Introduction to Agile Seam qcon Poppendieck Lean Spring Java esb Ajax Functional Programming Semantic Web Xebia IntelliJ Scala Testing fitnesse Performance SOA Maven JavaOne Closures product owner Groovy Hibernate Agile Awareness Workshop Scrum Grails Architecture XML