Book a Demo

Author Topic: Class "templates" for business objects?  (Read 4292 times)

joyce

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Class "templates" for business objects?
« on: December 23, 2003, 08:43:21 am »
I'm wondering if there is an easier or more "correct" way to do this:

We are using Rockford Lhotkas CSLA business object framework.

We create business object classes in EA that all are inherited from one of the standard CSLA business object classes (i.e. an Editable Root object, Name-value list object etc).

There are several operations in each of our derived classes that must be there to override the base class.

What we do is we have made a "template" class off each of the business class objects that contains the overriden operation definitions.  Then we copy and paste that as a new object and rename the class and customize it for the business object it represents.

What I'm wondering is if there is a way to have a repository of partially completely "template" classes that we can plunk in at any time.  If we can provide the name to use then it could name all the operations correctly and the attributes in question.

Kind of like a paste / search and replace all in one.

So a sample class we have called "Customers" could become a new "suppliers" class quickly and easily.

As it is now, we are copying and pasting and then having to rename every element of the class that has the template name in it.  (I wish we could switch to text mode or something).

Does this make sense?  Is there a better way to deal with creating a large number of business objects based off a small set of common base classes?

Glenn Walker

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I am just a UML junkie
    • View Profile
Re: Class "templates" for business objec
« Reply #1 on: January 21, 2004, 12:16:00 pm »
Patterns may be the answer. I too am embarking on using RL's CSLA to do some development. I was thinking of doing the same thing and that was what I thought might be workable.

Patterns, from my understanding allow you to specify a generic pattern for something and then import it into your model. Then when you want to use the pattern, you switch to the Resource View, Drag and Drop your pattern onto the diagram and it will ask you for the new name for all of the classes that are part of the pattern.

Let me know how this turns out. I am going to do some playing too to see how this works.
Glenn Walker
Solutuion Architect

Sean Kearon

  • EA User
  • **
  • Posts: 126
  • Karma: +0/-0
    • View Profile
Re: Class "templates" for business objec
« Reply #2 on: January 26, 2004, 01:38:11 am »
This will do exactly what  wants.  You get the option of whether you want the pattern to create new items or use and extend existing items when you create the pattern - "add new and rename" and "merge with exsisting element".  A great feature, or what?