DATS2/BATSLite DAO/ORM Library

by Moridin8 10. May 2007 20:00

If you are from the world of Java the term ‘Data Access Object’ is probably more familiar to you.  In J2EE they are considered best practice as the advantage of using DAOs is that any business/domain objects that contains operation specific logic do not need to be aware of the actual physical data implementation of the system.  Thus, if any changes are made to the data sources layers they shouldn’t affect the (usually) more complicated business/domain logic.  They are also exceptionally useful for enforcing rules on the data and how it is to be used in general. 

Some developers consider DAOs and ORMs a different paradigm, however I have yet to see a convincing argument to say that they are substantially different fundamentally and the differences seem to stem from marketing convenience and personal choice than any real semantic difference. 

In this area .NET has a little catching up to do, although there are plenty of implementations available on the web (including a .NET port of the Java Hibernate tool).  However despite this many firms prefer to either create their own or bodge something together that invariably ties the project to a specific data source. 

History

Recognising this rather early in 2002 I decided to step back and write an implementation to fit the requirements of a personal project, but that I would be able to evolve over time.  I developed the original with the help of a friend of mine (Andy “Smellyhippy” Jump) in my personal time and he and I went on to successfully implement it into an EPOS system and then a later into a CMS before Andy moved on and I continued with various other systems for clients as my contracts came and went.  A cut down version of the largest and most complicated revision known as BATS (used in a CMS system) is currently in use by a UK utilities firm.  A version of “BATSLite” (butchered to avoid copyright issues) will be available soon for completeness on this page; I am currently trying to ensure that the code fully works despite several items specific to the client being removed. 

A New Breed

Dats Core Diagram. Click for larger image. When the new year came around a few individuals came to me asking if a newer less ‘hacked’ version would be made available.  After some conversation I decided that it was about time that a re-write was due and set about re-creating the core.  The result of which is ‘DATS2’.

DATS2 *is* another BATS implementation; however I felt that the rename was essential for various reasons (including legal ones).  It represents a complete re-write, restructure and departure from the quirks that have over time made their way into the BATS code set.  The implementation as it currently stands is also somewhat specific to the requirements of the individuals who came to me requesting the change; as such this version more or less represents the first ‘revision’ so to speak.  (More accurately I made it work to a basic level and handed it over). 

So I am releasing the current version to the public domain.  I may create a sourceforge place for it in the coming months as revisions from the few individuals already in possession of the code add and revise it.  Please feel free to do the same!  This version represents the cleanest and rawest condition I have ever released DATS and it’s predecessors in and I hope this benefits the project.  There is currently no documentation, for which I can only apologise, yet I hope that over time this situation will be rectified. 

Oh... one more small thing, due to the requirements of those who essentially commissioned this work, the supplied (incomplete) DAL generates the SQL queries in a JIT fashion.  This was due to limitations on their behalf and nothing to do with my own choice.  I am planning a CLR stored procedure implementation of the DAL for use with SQL2005 and a WebService DAL in the future - depends on what comes up though...

DATS2.zip

Future Implementation Thoughts

  1. Add associated objects functionality.
    This would allow you to associate other DATS based objects to a DATS object.  This is something I have been thinking about for a while as part of BATS and there have been instances where this would have been an exceptionally useful feature.
     
  2. Create a Facade system to allow for smoother Object Oriented implementations.
    The 'object-relational impedance mismatch' problem is a nasty issue that everyone seems to dislike and a solution is certainly required.  An easy way out includes some thoughts bouncing around in my head to help this somewhat.  
     
    Other proposed solutions include the Nordic O/R dbms model (see the article in Architecture Journal 8), which while seems like a good solution, involves a lot of work for the everyday programmer whenever a new object needs to be created... the lack of Multiple Inheritance in .NET also makes this issue sizeable.  DATS has always aimed to reduce the the amount of code needed to be written by the developer so the Nordic model is out for DATS.  Another issue is that the Nordic model requires an underlying RDBS - which also flies in the face of the DATS philosophy of detachment from underlying data implementations.
     
    Suggestions on this are most welcome...

BATSLite

Until I can make BATSLite available, here is the class diagram.  Notice the complexity difference.

BATSLite diagram.  Click for larger image.

Tags: , ,

Articles

Comments

10/30/2009 2:45:17 PM #

cash loans

I always wanted to write in my site something like that but I guess you'r faster Smile

cash loans United States |

11/27/2009 9:49:23 AM #

payday loans

I like what I see. keep it going

payday loans United States |

Powered by BlogEngine.NET 1.5.0.7

About Matt R.Warren

MeMy name is Matt and I am the current tenant of this small corner of the internet. I mostly architect, design and prototype applications that use .NET with C# and a little C++/CLI for Enterprise although I am aware of and enjoy fully embracing Java based solutions and alternatives such as Mono/Linux.  

I have worked on projects ranging from small tools to large distributed real-time Enterprise systems ranging from EPOS and real-time/JIT stock management systems, to distributed applications for National/International Utility, Healthcare, Insurance and Finance  in the private sector in both the USA and the EU.

My LinkedIn Profile (Opens new window/tab)

“Matt is one of the brightest people I've worked with. His in-depth knowledge of the .NET frameworks has been a tremendous benefit to nVISIA and our clients. His knowledge of software architecture in general allows him to architect systems for the best fit to his client's needs.” 
Dan Christopherson , Technical Director , nVISIA

“I had the distinct pleasure of working with Matt at nVisia. Matt's understanding of the Microsoft Technical space is outstanding. He is constantly working on improving his technical skills and rapidly masters any new technology that he encounters. He is an excellent teacher and a wonderful asset for any size team.” 
Jim Harnden , Senior Technical Architect , nVISIA

“Matt Warren is a very talented developer with great capacity for self study, investigation and adapts to new languages and frameworks with ease. He has an excellent grasp of software architecture and modern development principles. He has proven himself time and time again to be a hard worker and someone who can get the job done when you're in a tight spot.” 
Andrew Jump , Partner, C# Developer , Contegra

This website represents some of my spare time.  My small presence on the web between my family and my career.  I hope over time you find many useful things here.