Archive for May, 2010

SQL Performance improvement

Monday, May 3rd, 2010
  1. Make sure there are indexes available.
  2. Not too much denormalization. The joins cause performance problems.
  3. Are triggers causing an insert operation?
  4. Select only the columns needed.

Dependency Injection

Sunday, May 2nd, 2010

The dependency injection is a hype in the unit tests world. Some hate it, some love it. The dependency injection is injecting the dependency in a system where the objects are disconnected with loose coupling and require dependency injection to make the system to work. For example, a data retrieval manager can have a data connection object. Before the data retrieval is created, the connection object is created in it’s constructor. This dependency can be broken, and the connection object can be passed as a dependency. That’s what dependency inject is. Now both the connection and manager can be tested separately. There are few ways this injection can be done – constructor injection, setter injection. The third type of injection is through service locater. The service located is a container that creates the objects. This takes the responsibility out of the client to create the objects.

There are few things that are bad about DI. Too much decoupling is bad. The client has to create all the objects for a simple thing to work. The overhead of service locater using the reflector can’t give you an idea of how much time some methods to execute in reality.