Book a Demo

Author Topic: Where to put code  (Read 10538 times)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Where to put code
« on: August 28, 2007, 10:10:07 am »
If one is modeling a legacy system using Components, where is it normal practice to put the actual code relating to the Component?

thomaskilian

  • Guest
Re: Where to put code
« Reply #1 on: August 28, 2007, 11:04:04 pm »
Hm. I'd use the Files tab to locate the source code. Not actually put it into EA since most likely it is not OO.

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #2 on: August 29, 2007, 05:43:45 am »
OK, a lot of it isn't OO, but where would you put it if it were OO?  And some of it is OO.

BTW, one of my reasons for wanting to put it in the model is that some of the components are smaller than a file.  Another reason is wanting to be able to generate new code from the model.
« Last Edit: August 29, 2007, 05:44:56 am by tamhas »

thomaskilian

  • Guest
Re: Where to put code
« Reply #3 on: August 29, 2007, 07:08:37 am »
Hm. That definitely depends.

If you're going to model classes afterwards and fwd-engineer that stuff, then you should put it into a class' code section. A good idea is to have your project organized for CIM/PIM/PSM so you may create abstractions of the concrete classes in the PSM in the upper PIM level. Then late creating a different PSM branch with the new system.

For small non-OO code you could create artifacts where you can put the code in the notes section. So you have an easy reference.

For large files I would create a sub-directory where you could store them in your project folder. Then you can use the Files tab with a relative path.

But in the end, it all depends ;)

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #4 on: August 29, 2007, 07:54:24 am »
Very long term, the hope is to be able to create more abstract classes and transform the architecture.  Short and medium term, though, there are no resources for that, so the best I am hoping for is to use the very concrete PSM built of Components to use in understanding the system and then hopefully to provide roundtripping while modifying it.  Modifications might involve identifying a subsystem and replacing it with new code or something as simple as identifying a block of components which is a candidate service for an SOA and providing a wrapper.

Creating a separate Artifact paired with every Component isn't an immediately attractive idea, although I don't suppose one has to include the Artifact in the diagram.

But, one of the key pieces here is that one Component is likely to have a number of subComponents corresponding to internal procedures.  The Component corresponds to a disk file, but the internal procedure is just a little block of code within that larger disk file, and the overall file can easily run to thousands of lines of code.  In some cases, the Component functions like a library and actually has no code in its own main body, but the typical Component also has code it its own main body.

thomaskilian

  • Guest
Re: Where to put code
« Reply #5 on: August 29, 2007, 09:25:18 am »
You could also embed the artifacts in the components.

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #6 on: August 29, 2007, 09:43:26 am »
I do believe that is exactly the right solution.  One of these days, maybe I'll think of it first!

thomaskilian

  • Guest
Re: Where to put code
« Reply #7 on: August 29, 2007, 12:56:33 pm »
No sweat. Probably you have to try several approaches. I almost never get it right the first time. Only after fiddling around in several ways I believe having found a good path. And - if not too late -  I try to make my model consistent (yes, Paolo, I learned a few lessons) ;D

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #8 on: August 29, 2007, 01:11:15 pm »
I am also intrigued by discovering that one can embed Artifacts within Artifacts as well as within Components.  This might be useful for decomposing code into blocks.

thomaskilian

  • Guest
Re: Where to put code
« Reply #9 on: August 29, 2007, 01:29:40 pm »
EA is full of nice and useful features (despite EAUI). I still discover hidden places that now become useful once I understand what they can be used for. Modeling rocks!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #10 on: August 29, 2007, 01:39:52 pm »
Thanks for your help.  A few lights are beginning to go on ... they might only be a few candlepower thus far, but I am feeling some real progress.

Good thing we have such a strong forum for support!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Where to put code
« Reply #11 on: August 29, 2007, 04:35:26 pm »
Quote
You could also embed the artifacts in the components.
Hi Thomas,

That's the conclusion I came to early on.  However, just a clarification, if I may?  When you say "embedding", do you mean nesting (as in the browser) or by composition?

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Where to put code
« Reply #12 on: August 29, 2007, 07:36:30 pm »
Naively ... as is appropriate at this point ...  what I have experimented with is adding the artifact to the diagram, locating it so that it is visually nested, and then using the project browser to make it physically nested.

One of the things I am ****very**** aware of is that creating the logical structure doesn't translate into wanting to *see* that structure in any given diagram.  E.g., I have experimented with creating a diagram which expresses the linkages which are appropriate at the source code level, then copied it and moved links from internal elements to the container and deleted the internal elements to create a compiled view.

I haven't quite gotten to the point of figuring out how composition can help me in this.

thomaskilian

  • Guest
Re: Where to put code
« Reply #13 on: August 29, 2007, 11:39:11 pm »
Quote
...

Paolo,
I'm always behind your level in regards to modeling. So, simply speaking, I meant nesting. Just to put the things in a container. Composition is something I use in modeling in order to show a logical relation between different elements. Hope, I'm not wrong with that, but to me this was an intuitive approach.