Book a Demo

Author Topic: Code for legacy components  (Read 5733 times)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Code for legacy components
« on: October 17, 2007, 07:45:05 am »
If I am using Components to model a legacy system, where would be the best place to put the actual code for any given component?  I have a couple of ideas, but it seems like there should be a standard practice covering this requirement.

thomaskilian

  • Guest
Re: Code for legacy components
« Reply #1 on: October 17, 2007, 11:05:10 am »
I may be dreaming, but didn't you ask the same question a short time ago?

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.pl?board=UMLPRO;action=display;num=1188328207;start=0#0
« Last Edit: October 17, 2007, 11:08:11 am by thomaskilian »

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #2 on: October 17, 2007, 11:32:52 am »
Apparently, my Aha! moment didn't stick!

But, perhaps one of the reasons it didn't is that when I look at an Artifact (or Component), there isn't an obvious place that one would put the code itself.  I can see that there is a place for putting the path name to the file containing the code (which doesn't work when the code is a block in a larger file).  I can see putting a URL in a tagged value (or as another entry in file?) to a web location for the code, which might include a location within the page.  But what if I want the code itself in the model?  Notes doesn't seem right.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code for legacy components
« Reply #3 on: October 17, 2007, 12:54:50 pm »
Thomas,

You could always create a (semi) standard tagged value of memo type. This would allow you to store code of arbitrary length in a consistent place, without interfering with the 'normal' use of notes and generation fields.

See Tagged Value Types in the SDK section of the current EA documentation.

David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #4 on: October 17, 2007, 01:55:41 pm »
Well, Tagged Value was certainly one of my ideas, but it sure seems indirect.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code for legacy components
« Reply #5 on: October 17, 2007, 02:25:56 pm »
I agree Thomas,

However, this does have the advantage of getting the legacy code out of the usual places. Since you'll not likely generate or feature the old code, this separation could help with overall model clarity.

What triggered my suggestion was your comment about not wanting to use notes fields. I was trying to extend this paradigm without incurring (too much) additional overhead or indirection.

David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #6 on: October 17, 2007, 02:33:43 pm »
Well, while it is legacy code, I would like to be able to make model changes and regenerate the code, so it isn't as if the legacy code were mere documentation.  In fact, I would like down the line to look into doing transformations on the legacy code and potentially generating new code which may or may not reference old code.  I am also going to want to implement roundtripping, if I possibly can.

thomaskilian

  • Guest
Re: Code for legacy components
« Reply #7 on: October 17, 2007, 10:54:03 pm »
Hard stuff. I suppose your legacy stuff is everything but OO. So making a transformation is not as simple as painting the walls in a new color. It is even not just tearing down a few walls and putting in some others. It is indeed like smashing the whole building and starting from the ground.

So there is not much point in having the old code ready for any code generation. Keep it for analysis purpose and start from scratch. Everything else will simply lead you into desaster (like rebuilding the foundation of a house while you live in it).

My 0.02 EUR

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #8 on: October 18, 2007, 05:37:22 am »
There are small pieces of the old code which are OO, but there isn't actually a mandate for transformation to OO at this point.  At most, it will be a spot change in response to a specific problem or opportunity.  The key in the need for the roundtripping is to keep the model in sync with the code.

Oh, and the other issue about picking where it goes is that I am planning to use an OpenEdge database where normal CHAR fields are limited to 32K (functionally a bit less since there are other fields in the record).  CLOB is available, but limits the kinds of operations one can perform, so one wants to use it carefully.

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: Code for legacy components
« Reply #9 on: October 18, 2007, 08:34:16 am »
Could you perhaps place the code within the respective functions in the "initial code" field? You can then regenerate if you do a clean code generation from the design?
If you're concerned with placement (file location) then for standard OO designs, these can be set on a per class basis and in the generation dialogue, select auto-generate and retain existing filepaths.
hope this helps?

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #10 on: October 18, 2007, 08:50:31 am »
Initial Code is a property of an Operation and Components don't have Operations.

thomaskilian

  • Guest
Re: Code for legacy components
« Reply #11 on: October 19, 2007, 12:47:11 am »
You CAN create operations for components with EA (right click)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Code for legacy components
« Reply #12 on: October 19, 2007, 06:21:21 am »
Ah, mystery affordance, I see ...

Well, that seems to be the trick, then.  Good.