Real World Software Architecture

Real World Software Architecture is dedicated to providing information and experiences from the field of Software Architecture.



Subscribe with RSS or ATOM Add to Google

Links

  • Home Page
  • Real World Software Process Engineering
  • Suggested Reading
  • .NET Dev and Arch Collection
  • SEI Essays on SA
  • Software Architecture
  • Bredemeyer
  • wwisa
  • Product Line Engineering
  • PLEES
  • Software Product Lines
  • MSDN Architecture Center
  • patterns & practices






Wednesday, January 04, 2006

Dependency Injection, Generics, Enterprise Library 2.0, Composite UI Application Block, and the ObjectBuilder Framework

The Composite UI Application Block and the Enterprise Library 2.0 use Generics extensively and introduce dependency injection through the P&P ObjectBuilder framework.

If you plan on using the Composite UI Application Block or the Enterprise Library 2.0, you need to understand dependency injection and Generics.

Both dependency injection and Generics are well worth investigating. Understanding both topics can help you improve you own designs. After getting a better understand of both topics with the resources below, I suggest investigating the Composite UI Application Block and the Enterprise Library 2.0. They have proven to be the best resource I have found for getting a thorough understand of applying dependency injection and Generics in production level code.

Links to both the Composite UI Application Block and the Enterprise Library 2.0. can be found here:
http://www.corporatewebbing.com/rwsa/links.htm

Information on Generics can be found here:
http://msdn2.microsoft.com/en-us/library/512aeb7t.aspx
http://research.microsoft.com/projects/clrgen/
http://www.amazon.com/gp/product/0764559885/104-9495318-2199144?v=glance&n=283155

A great summary on dependency injection can be found here: http://www.martinfowler.com/articles/injection.html

The ObjectBuilder- A little more info...
The ObjectBuilder framework is used to create and inject instances of objects of the appropriate type into the application at runtime.

The following summary comes from the Composite UI Application Block help file:

ObjectBuilder Architecture
ObjectBuilder uses a pipeline of strategies that allows multiple operations to take place as objects are instantiated and prepared for use. This allows you to control the order that the processes take place. It also supports controlled disposal of object instances by executing the appropriate pipeline processes in the reverse order.

ObjectBuilder strategies manage the processes performed on objects during construction and disposal. The ObjectBuilder pipeline is organized into stages, and each stage of the pipeline contains multiple strategies. You can implement your own strategies as a .NET class with a specific interface.

Design of ObjectBuilder
The construction and disposal of object instances is a common process in most applications, and particularly in business applications such as those built using the Composite UI Application Block and the Enterprise Library. For this reason, these blocks take advantage of an underlying sub-system called ObjectBuilder that performs all of the repetitive and necessary tasks for creating object instances, while still providing a high level of flexibility.

ObjectBuilder encapsulates features that simplify the creation of object instances. It can:

  • Ensure the creation of specific concrete class instances, even when requests are for abstract types.
  • Ensure the return of existing object instances when this is appropriate, or always generate new instances.
  • Create the appropriate objects based on configuration data.
    Intelligently select the appropriate constructor when a class exposes more than one constructor.
  • Automatically apply values to public properties that contain attributes, and execute methods on the object, in response to pre-defined policies.
  • Respond to attributes declared on the properties and methods, which influence the creation and naming of the new object.
  • Communicate automatically with objects that support the IBuilderAware interface to indicate, for example, that object creation is complete.
  • Provide a tear down facility that can remove settings from existing objects by reversing the chain of operations.

ObjectBuilder is a low-level utility that, in most cases, you will not interact with directly in your applications. The classes in the application blocks use it to generate object instances in response to your code creating the classes declared within the application blocks.
However, you can use the features of ObjectBuilder directly in your applications and your own frameworks if you wish. You can also influence the behavior of ObjectBuilder by creating your own strategies or modifying the existing strategies.

Copyright © 2005 by Microsoft Corporation. All rights reserved.

posted by tadanderson at 5:19 AM

0 Comments:

Post a Comment

<< Home

Previous Posts

  • .NET 2.0 Tools Evaluation- DSL, GAT, SQL 2005, Mob...
  • Smart Client: Composite UI Application Block Hands...
  • Guidance Automation Toolkit (GAT), Architectural D...
  • The Process Ladder- UP, RUP, EUP, PLE, & Never Nev...
  • Open Source Projects & Code Generation Tools
  • Project Management with Limited Resources
  • SOA and ESB buzz...
  • .NET Software Engineering versus .NET Software Dev...
  • Generics, Patterns, and Software Architecture
  • Where is my Project Manager?



Powered by Blogger