Book a Demo

Author Topic: Modeling arrays in class diagrams  (Read 5515 times)

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Modeling arrays in class diagrams
« on: June 03, 2010, 10:58:25 pm »
What is the proper way to model arrays (e.g. int foo[4];) in a class diagram in EA 7.5.850?
« Last Edit: June 03, 2010, 10:58:50 pm by rkt-med »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #1 on: June 04, 2010, 08:12:12 am »
I recommend reverse engineering one and seeing what EA does.  (It's easier than explaining exactly what EA is going to do)  Look on the Attribute Detail page.  

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #2 on: June 04, 2010, 08:20:35 am »
Ah, OK, thanks.  I see that it's telling me that "Attribute is a Collection", makes sense.  Don't think I would have ever guessed that the array dimension goes into the "Container Type".

EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #3 on: June 12, 2010, 11:41:12 am »
Quote
I recommend reverse engineering one and seeing what EA does.  (It's easier than explaining exactly what EA is going to do)  Look on the Attribute Detail page.  

OK, now I have another problem.

I have a struct that looks like this:

struct VersionNumber
{
      unsigned short major;
      unsigned char minor;
      unsigned char build;
      unsigned char pad[ 10 - sizeof( unsigned short ) - ( sizeof( unsigned char ) * 2 ) ];
};

The struct has to be padded to 10 bytes, hence the "pad" attribute at the end.

I could say "unsigned char pad[ 6 ]" but that would be bad... having the magic number of 10 in there is bad enough.

Now I reverse-engineer that and I get:
[ 10 - sizeof( unsigned short ) - ( sizeof( unsign

Seems the "Container Type" under Attributes->Detail chops off at 50 characters.

Any workarounds for that?  Has it been fixed (or expanded or made variable) in EA 8?

Version is 7.50.850.



fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #4 on: June 12, 2010, 02:21:11 pm »
Eric,

The column "Container" in the EA database schema for 8.0 build 857 corresponding to "Container Type" in the UI) shows as Text[50] in Access (and is, I'm confident, the same length in the other RDBMS schemas), so a change in the schema would be required, it seems.
« Last Edit: June 12, 2010, 02:22:01 pm by fwoolz »
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.


EricP

  • EA User
  • **
  • Posts: 122
  • Karma: +0/-0
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #5 on: June 12, 2010, 10:56:52 pm »
Quote
The column "Container" in the EA database schema for 8.0 build 857 corresponding to "Container Type" in the UI) shows as Text[50] in Access (and is, I'm confident, the same length in the other RDBMS schemas), so a change in the schema would be required, it seems.

Good morning, fwoolz.

I'm just wondering if that sort of change in the database is supported and encouraged by Sparx.  I suspect not.

I did try opening up the database in Access 2000 just to see what it looks like and I got the message box "You can't make changes to the database objects in the database 'MyProject'.  The database was created in an earlier version of Microsoft Access".

An earlier version than Access 2000?


fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Modeling arrays in class diagrams
« Reply #6 on: June 13, 2010, 02:45:10 am »
Believe it or not, yes! Access 97 in fact; the default JET engine provided with EA is 3.5, which is, IIRC, the Access 97 version. There is an option to use JET 4.0 (in the main program/project options), which I think would bring you up to Access 2000. What will happen to EA if you change the length of the column in question is anyone's guess...

I do know that it is possible, when using Access 2007 at least, to upgrade the .eap file to an .accdb file (Office 2007 version of .mdb files) and then add queries, forms, even new tables to the database and have EA work just fine, but I've never tried altering one of the core tables (t_attribute in this case). Other RDBMS repositories (e.g. MySQL, SQL Server) also let you add things to the EA database without affecting the operation of EA, but again I never modified the EA schema in any way.

I would report this as a bug...

BTW - Sparx is verrry reluctant to endorse ANY changes to the database schema. I have on several occasions asked about the possibility of re-purposing a few table columns for use by add-ins, and the answer has always been "not a good idea - we may change how we use this field in the future."
« Last Edit: June 13, 2010, 02:48:00 am by fwoolz »
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.