Tuesday, May 18, 2010

Unity 2.0 Design pattern in simple words

As part of my search for perfection in technology, I come accross many different technologies. Some of them are worth delving into. One of them is Unity 2.0 design pattern. In this article I will try to explain the basic premise of Unity 2.0 design pattern, where it should be used, where it should not be used and simple steps to implement Unity 2.0 Design pattern.

Unity 2.0 design pattern in simple words:
  • Unity 2.0 is a type of design pattern that can be used to implement composite application library.
  • Unity 2.0 design pattern lets us to view different modules of our composite application to appear as signal entity.
  • It allows objects belonging to different modules to implement dependency on each other.
From the above mentioned points, the most important word here is dependency. So in more simpler words

"Unity 2.0 design pattern is used to implement dependency injection"

How to implement Unity 2.0 design pattern?

Step 1: Download Unity 2.0 library. This can be found here.

Step 2: Create composite application using Composite Application Guidance. You can find the details about this here.

Step 3: Override the boot strapping class in composite application to use Unity bootstrapper.

Step 4: Identify classes in your composite application that are dependent.

Step 5: Create a dependency injection (DI) container using the Unity 2.0 library.

Step 6: Implement dependency injection using one of the following techniques:
  1. Using build up to wire up objects not created by the container
  2. Using injection attributes
Happy coding!

Wednesday, April 28, 2010

Silverlight 4.0 - Best practices

Any technology company that pursues excellence, bases their work on some patterns and practices. For some these practices are part of their vault of company secrets and for some their practices are not so secret. I am big fan of sharing knowledge in order to acquire more knowledge.

Following are some best practices that I came across during my search for perfection in Silverlight 4.0 technology.

1. Head first design pattern: If you look at the evolution that Silverlight been thorough since its inception, you will realize that now it has evolved in a complete development platform. Due to this fact, I think anyone who wants to create a solution in Silverlight 4.0 has to think about the architecture first. Also, the technologies that complement Silverlight 4.0 can fully be appreciated if we have good architecture. Specially if we implement the separation of concerns design pattern.

2. Harness the power of WCF: One of the great things about Microsoft is the fact that they come up with a great technology that makes you excited. Although most of the times it takes Microsoft three releases to produce such a technology but still I think it is a great feat. Similar is the story of WCF. I have been working on services development since 2002 and had a close tab on all web services technologies. I think in regards of WCF, Microsoft has got it right. One of the amazing things in WCF is its support for Silverlight. Especially the advent of WCF RIA services. If you are implementing any line of business application for web, you should definitely look into this as development platform.

I welcome all comments.