Hi,
I'm new to the Csla framework, and well, to object oriented programming in general.
First off let me say that it is a really impressive framework indeed. Thanks for sharing it with us Rocky and all the other contributors.
I have this question that that I've got several ways to solve it, but not sure which one would be preferable:
I have several database tables that relate to type tables, for example Customer and Document tables
that relate to CustomerType and DocumentType tables (I like calling these type tables metadata tables because they are static, and never change).
Now, let's use the customer example. I know that I can differentiate the customer types by either
using composition or inheritance. So in the case of inheritance for instance, I would have an abstract
base class like CustomerBase that other customer classes would subclass, like Private, Store, Company etc.
whereas, by using composition, I would have an instance of a CustomerType (using Enum perhaps?)
exposed by a property, indicating the customer's type. Somehow using inheritance might be a little bit more flexible i think because I can have the base class have the common
fields and properties and add the relevant stuff in the derived classes, for example the ContactName
field might be irrelevant for a private customer. In the end of the day, this might not add anything to the
solution because they (the base class and the derived ones) are all persisted to the same single table
in the database. Just thought that it might be nice to show to the user only the relevant options in the UI, depending on the type of customer/documnt etc that he chooses.
Can you please help with with this? I just want to be sure that I make the right decision here.
P.S
Is there any advantage of using architectures like MVC/MVP? I know that the business objects in
the Csla framework do a perfect job of encapsulating their logic within them, leaving the UI layer
to just calling methods on them. This is the kind of seperation that these solutons try to achive, isn't it? Or am I missing something here?
Thank you so much for your time.
Ben
Contact objectA Candidate is a Contact within my application. Basically, follow the OOP pricinples. "Is a" for inheritance and "Composed of" for composition....something along those lines. Again as i said i am no expert.
Candidate : Contact
I see.
Do you also have in the databse a Contact table and a related table table, like ContactType or something similar, as I do?
Thank you for your time.
Ben
What if I make a CustomerType class with a CustomerCollection, where each entry will reference a
different customer type, just like in the database? Is it a flawed design? well, sounds rather too db-ish to me.
Oh, this whole db/oo thing is givin me a headache :(
Copyright (c) Marimer LLC