Book a Demo

Author Topic: No "Date" type for a class attribute?  (Read 17032 times)

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
No "Date" type for a class attribute?
« on: April 25, 2016, 08:36:45 pm »
How do I specify a class attribute to be of type ”Date”?
Whether I set the class Language to “<None>” or “Java”, When I want to select the type of a new attribute, I do not get a “Date” option in the select box with types (String, Boolean Integer, ..).
I’m quite puzzled. I’m sure I’m missing something here (I even had to ask a colleague to double-check for me)  – what is it, I don’t see?

(until now, I have used sub elements instead of attributes - because attributes do not satisfy our modeling needs)
« Last Edit: April 25, 2016, 08:38:28 pm by Svend Erik Nygaard »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: No "Date" type for a class attribute?
« Reply #1 on: April 25, 2016, 09:24:35 pm »
You can edit the list of primitive types yourself.

See Project|Settings|Code Engineering Datatypes

Geert

PS. In UML "Date" is not a primitive type.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #2 on: April 26, 2016, 10:18:32 am »
PS. In UML "Date" is not a primitive type.
It's not a primitive type in Java either.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #3 on: April 26, 2016, 07:02:42 pm »
It's not a primitive type in Java either.
If it were, Java should be shredded at once. Dates are one of the most complex "obvious" objects I currently can think of (besides "Person").

q.

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #4 on: April 27, 2016, 06:19:29 pm »
Thanks Geert.

My classes are not implementation classes but logical classes. In such classes, attributes (and attribute types) have no implementation.

Since it's not an implementation, I wanted to use the <none> choice in the Language drop-down box. But unlike Java and the other language choices, I cannot add a new datatype to the <none> 'language'. So, instead, I created a new language (“Logical”) and then associated all needed datatypes to that.

But now I cannot find a way to set "Logical" as the default ‘language’ choice on new classes.
(I did not find it under options, and neither did I find a way to set such default value in MDG for specific stereotypes)
Is that really not possible?
« Last Edit: April 27, 2016, 06:43:37 pm by Svend Erik Nygaard »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: No "Date" type for a class attribute?
« Reply #5 on: April 27, 2016, 07:00:48 pm »
It is possible, and it is also possible to change the language for a whole package (tree).

See Project|Settings|Project Options|Source Code Engineering|Default Language for Code Generation

To change a bunch of elements in a package use

Package Context Menu|Code Engineering|Reset Options for this Package

Geert

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #6 on: April 27, 2016, 09:29:29 pm »
Thanks Geert,

I did not notice that Project|Settings|Project Options|Source Code Engineering had Default Language for Code Generation
(the corresponding page under Tools|Options does not).

Thanks a lot.

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #7 on: April 28, 2016, 08:54:23 am »
Settings are now separated into PROJECT-specific settings and USER-specific settings (Tools | Options). Two separate dialogs.
Best Regards, Roy

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: No "Date" type for a class attribute?
« Reply #8 on: April 28, 2016, 03:12:53 pm »
Settings are now separated into PROJECT-specific settings and USER-specific settings (Tools | Options). Two separate dialogs.

Which is a good thing  :)

Geert

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #9 on: April 28, 2016, 05:00:44 pm »
I Agree, it's a very good thing  :)

DavidM

  • EA User
  • **
  • Posts: 82
  • Karma: +0/-0
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #10 on: October 26, 2020, 09:53:22 am »
Hi Guys,
Picking up on this, I have been told 1-2 million times by Sparx enthusiasts that Logical modelling should be done in UML, but I too cannot locate any date types for what should be a technology agnostic logical mode attribute type.

I also cannot find the settings (using version 13).
Does anyone know where these are now? thanks

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #11 on: October 27, 2020, 06:33:03 am »
Hello David,


I'm afraid you'll have to define them yourself.
This isn't EA's fault as such. Pure UML simply doesn't have any primitive types for dates. In fact, it has only five primitive types:
  • Integer
  • Boolean
  • String
  • UnlimitedNatural
  • Real
That's it.

There are two ways of adding datatypes in EA; either you define a language and create the types for it (which is what Svend Erik was referring to earlier in the thread), or you create them as model elements -- either «primitive»s or «dataType»s.

I would suggest the latter rather than the former if you want portability. Also, there are some hidden traps with defining your own language in EA.
On the other hand, if you set up the language correctly, GUI integration of the primitive types you define is far superior to what you get if you create model elements for them. Simply put, you need more mouse clicks to select a model-defined type for an attribute than you do for a language-defined one.

Regarding where to find all this in version 13, I'm afraid I can't help you there. It's been a while since I used that.
But it's not new functionality or anything, it's definitely there in 13.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #12 on: October 29, 2020, 08:16:42 pm »
Hi Guys,
Picking up on this, I have been told 1-2 million times by Sparx enthusiasts that Logical modelling should be done in UML, but I too cannot locate any date types for what should be a technology agnostic logical mode attribute type.

I also cannot find the settings (using version 13).
Does anyone know where these are now? thanks
Have you tried developing a canonical language in Sparx EA? It is very straight forward - please see https://sparxsystems.com/enterprise_architect_user_guide/15.0/model_domains/developing_programming_languag.html.

This is the way I have always done technology agnostic logical modelling in Sparx.

ngong

  • EA User
  • **
  • Posts: 275
  • Karma: +2/-2
    • View Profile
Re: No "Date" type for a class attribute?
« Reply #13 on: November 08, 2020, 09:33:02 pm »
I'd like to contribute my experience to this subject.
I guess it is of primary importance to every project exposing a system or software architecture to decide on a set of base types. This is the point where a model gets its basic semantics.
In my projects we usually decide very early (!!) on a package of base-types, forbidding to use the EA built-in ones.
Usually we decide on importing XML Schema datatypes because we found them to be the most thoroughly designed ones. Also it is a must-have in case you design packages of data structures that should lead to an XML schema.
In simple projects we decide for a package of Java or C base types, but never on the EA defaults.

Hope that helps.

p.s. I feel that the Sparx professionals yet have not realized that importance. E.g. you can select a designed type in the Features dialog by start typing its name and than Ctrl-Space. However that little very productive trick does not work in selecting the type for an Action-Pin in Activity diagrams.
« Last Edit: November 08, 2020, 09:40:26 pm by ngong »
Rolf