Blog

Filter posts by Category Or Tag of the Blog section!

Does it cause any kind of performance issue using a base class in Layer SuperType pattern?

Thursday, 12 September 2013

I had a long discussion with one of my colleague about using a base class in Data access layer or repository instead of implementing all common scenario like CRUD operation for every aggregate. it's Layer SuperType pattern that I'm talking about. I've posted about Layer SuperType pattern before, but now I'm going to know that what will happen in an application with large amounts of requests and transactions to performance in the case of using a base class for Common methods of DAL.

This this the answer of Scott Millet on Twitter for my question, here is the discussion 

 

          LayerSupertype

As you can see in the StackOverflow link suggested by Scott here, when you inherit from a base class and construct an object, the runtime never separate instances of the base class from inherited class. In other words, it's not like that you have two objects in memory when you have the variables of a base class in inherited class. When you inherit from a base class you have all variable of the base class and runs the base class constructor and also Both abstract and normal base classes act the same.  So it's not like that when you have an Insert method for a large application with lots request, you are using just the same insert to cause a performance problem!

 

comments powered by Disqus