Book a Demo

Author Topic: Class Discriminator - UML Best Practice  (Read 13415 times)

Rouven

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Class Discriminator - UML Best Practice
« on: May 02, 2013, 11:54:36 pm »
Hello everyone,

I am looking for some input regarding a UML domain model. We have chosen a UML class model to represent our business domains. Now we encounter situations such as:
Class A abstract with attribute a
Class B is specialization of A with attribute b
Class C is specialization of A with attribute c

As a Java programmer a concept like "instanceof" comes naturally to me, but talking to business users this is obviously a problem. Does anybody have a best practice on chosing a model representation that allows the business users to describe that they have a list of object of type A, but only wish to process those that are of type B?
  • introduce an attribute "type" as a discriminator? if so, how do you model it (static, read only, ...)?
  • introduce the concept "instanceof"?
  • other ideas?

Thanks & best regards,
Rouven

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Class Discriminator - UML Best Practice
« Reply #1 on: May 03, 2013, 03:36:42 pm »
I would simple write something like:
Code: [Select]
IF variable IS AIn an actual context that could be something like:
Code: [Select]
IF currentDocument IS Invoice
or a variation to do
Code: [Select]
FOR EACH Invoice in DocumentsToTreat
I would of course be even better to avoid any possible ambiguity by using the concrete subtype as much as possible.

I believe that would be clear for both business users as technical users, without the need to define "difficult" concepts such as "type" or "instanceof"

Geert