Author Topic: [SOLVED!] A pattern question  (Read 678 times)

son-of-sargasso

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
[SOLVED!] A pattern question
« on: November 24, 2009, 03:25:23 pm »
(I spent most of yesterday arvo and all of last night dragging out my old Fowler/Ambler/Hay books and links trying to get a clue on this one.  Although they mention it no-one seems to have provided a solution. So here goes.)

I'm trying to decide on an ORM strategy for this project.  That is to say, a plan for generally when to use which ORM pattern for a particular piece of the old "impedance mismatch" problem.  In this particular case I cannot come up with a decision, in fact even to come up with a answer.

In one specific area of the application, solution, we have a situation where the user is presented with a list of items (and key attributes) in the top of the UI and an editor panel in the bottom half of the form used to maintain the currently selected item.  This situation is a "utility" use case, say "Manage CodeValues" where codevalues are a set of codevalue objects which are a key+attributes classifier that is used throughout the rest of the application to decorate, sort etc etc business objects.  Clear as mud?  Consider an (Australian) bushfire warning sign, like this
http://theland.farmonline.com.au/multimedia/images/full/492714.jpg  - the object "day" has a fire risk rating that is presented to the user by the attributes of the pointer location and the sector color.  In this project we have quite a few (dozens) of this type of attribute in the business objects.  For example, one business object has an overall status, a scheduling status, a run status, two risk attributes and several "sizing" attributes (complexity, LOR, etc)  
Now, our fire ratings system in Aus has undergone a lot of scrutiny recently and the warning signs have been changed to
this -->
i.e. new categories, labels and color schemes.  This happens in my application quite a lot, in fact different jobs for different customers may use completely different schemes for the same attribute.  That is fine, in fact that is what this utility is for, to allow easy maintenance of schemes on a per job basis.  So, ...
http://www.abc.net.au/reslib/200909/r436236_2097106.jpg

So much for background.  Here's the core issue.

I am trying to develop a generalized way of accessing these data sets and their contents.  (N.B. not the data, this is already taken care of by postgresql very well via inherited tables.)   Here's the prototype UI (ignore the errors please!)
Behind this facade is a collection, CodeValues, of the four listed codevalues for this type, viz "Normal", "Bad", "Other", "Indifferent" i.e. CodeValues is a collection of CodeValue's.

O.K. Does anyone know of a DAL pattern for accessing (read and write) for this dual view, list and entity?  

(Phew, that took a bit of writing.  I was hoping I would have solved the thing by the time I'd written it.  Nah.)

tia
bruce

p.s. The images are copyright "The Land" and the ABC, I hope I haven't broken any L..A.W. by posting their links here.
« Last Edit: November 25, 2009, 09:56:05 am by barrydrive »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8030
  • Karma: +183/-22
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: A pattern question (WARNING: Big with Pic's)
« Reply #1 on: November 24, 2009, 10:01:24 pm »
Ah, the "CodeTable" issue.
This is subject on which I've seen several clients struggle.

If I understand your problem correctly you have a CodeTable with a fixed set of attributes (code, value, description, FG Color, BG Color, isDefault and Order) is this correct?

In your example you show "Code &Type = Test" so there must by something like "Type" as well.

Question: is the list of types static (defined at design time) or dynamic (you can add code types at runtime)?

Here at my current client we have four types of enumerated datatypes divided according to dimension (1D and 2D) and dynamic/static.
The enumerations are 1 dimensional (we model the rows rather then the columns) where the "Code Lists" are two dimensional (so we model the "columns")

Here's a diagram that shows how we did it in our meta model:
http://hosted.umlcanvas.org/Meta_enum


Geert
« Last Edit: December 05, 2009, 04:49:03 am by Geert.Bellekens »

son-of-sargasso

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: A pattern question (WARNING: Big with Pic's)
« Reply #2 on: November 25, 2009, 09:54:17 am »
Thanks Geert!   :) :) :)

That's a 199% fit to the problem.  I had overengineered the problem to the point where I really could not see a way to a solution.  Your model is in fact not "meta" for this situation, with a couple of name changes it is the solution.

Have 5 gold stars.

bruce

p.s. What do the grey dots that appear at the corners of elements in your diagram mean?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8030
  • Karma: +183/-22
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: [SOLVED!] A pattern question
« Reply #3 on: November 25, 2009, 03:55:57 pm »
Bruce,

They indicate that you've selected an element.
Try dragging an element, you'll be surprised.
(this really only works in a decent browser :-X)

Geert