Otis wrote:
Composition can work out fine...
Otis, if possible, please do comment on my message below to Steve, our project's Tech Manager, regarding implementing an interface for LLBLGen classes.
Note-- I know that there exists some kind of "code table implementation framework for LLBLGen, or something like that, but I do not want to use that for various reason. So, let's set that aside for the sake of this discussion right now.
Note-- We are working in .NET 1.1.
So, Otis, what do you think?
Please advise.
Thank you.
--Mark Kamoski
-----Original Message-----
From: Kamoski, Mark
Sent: Tuesday, April 18, 2006 11:57
To: Steve
Subject: implementing an interface for LLBLGen classes
Steve--
I have some questions about how our team should be implementing an interface (or some other generic object referencing schema) for LLBLGen classes.
Basically, this is the case where one wants to handle a set of objects (such as code table objects) generically.
Since LLBLGen does not support the use of Interfaces directly, then one has to do something else.
As far as I tell, there are at least 3 options.
(1). Use code preservation tags. Put them in the generated classes as-needed. The code will not get overwritten.
Pros-- Solves the problem.
Cons-- Nasty code to write. Not very clean. Complicates the build process given that generated classes are not kept in SourceSafe. Makes it such that one should not "just delete all the generated code from your local machine before regenerating to avoid file locking issues" during the LLBLGen regeneration from the LLBLGen project file. May not support the complete variety of code that one wants to add and whether or not it does support what one wants to do probably requires some test implementation.
(2). Create a composite object that can hold any object in a given list of compatible objects. The composite holds a reference to the specific type but exposes common properties and methods via a generic interface.
Pros-- Solves the problem. Does not use code preservation tags, so it avoids the cons to code-preservation.
Cons-- There is a lot of casting that needs a lot of manual maintenance if new implementing objects are added. The collection object for such a class is non-trivial.
(3). Use a combination of inheritance and an interface. Create a simple helper class for each entity that needs to be generic. Have this helper class inherit from the actual specific entity class and, at the same time, implement a generic interface.
Pros-- Solves the problem. Has the minimal maintenance of these 3 options. Is simple. Is direct. Use OOP. Can then add additional implementation code if the implementing objects need to do special processing.
Cons-- Requires some maintenance to the interface and implementing classes. Require the addition of a class for each object that needs to be generic.
...or, maybe there is a better way?
I think that Option (3) is best?
What do you think?
Please advise.
Thank you.
--Mark