Author Topic: Code Generation from Activity Diagram  (Read 7008 times)

zdaw

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Code Generation from Activity Diagram
« on: April 25, 2008, 01:14:17 am »
Hi everyone,

Lately I've been working with activity diagrams on Enterprise Architect and I'm willing to generate C++/Java code out of it. When I create class diagrams I'm able to convert them to C++/Java, though when I'm describing an activity diagram the program doesn't even give me the option to generate the code. Why is it so? Isn't it possible with EA to generate code out of activity diagrams or am I missing something?

I thank you in advance,

Kevin G. Watson

  • EA User
  • **
  • Posts: 217
  • Karma: +0/-0
  • I love EVERYTHING including Microsoft
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #1 on: April 25, 2008, 01:16:25 pm »
Hi there

I'm sorry but the answer is "No! EA doesn't do that". :'(

EA's fairly consistant tho, it doesn't generate code for Components or even State Charts.  I think it's got something to do with EA's audiance, who are 'Analyst' types.  Rose RT, Rhapsody and Tau did state machines... all owned by IBM now :-/, so don't hold ya breath.

You might be able to write an addin. ;D ;D..

 [smiley=2vrolijk_08.gif]Kevin

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #2 on: April 25, 2008, 08:17:59 pm »
Hey,

Yes, no. More's the pity since it'd be a hugely valuable feature.

The (kinda) reverse is possible, though: you can generate sequence diagrams from executed code. You'll find that described in the Help, "Debug and Profile" - "Profiling and Debugging".

However, since the process is one-way it's mainly of use for documenting existing software, not designing / implementing new stuff.

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

salayande

  • EA User
  • **
  • Posts: 224
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #3 on: April 26, 2008, 08:34:35 pm »
I am sorry someone holds the opinion that EA is for the analyst types. It is not true. I think that EA tries to cover the needs of several stakeholders - Data Architects, Process Architects, Application Developers (Programmers) and many more.

EA is based on UML which facilitates code generation as class stubs. It is true that EA must step beyond that to meet a need which is valid. Recent developments in the market (executable BPMS tools that hold the features of CASE tools and code generators ) suggest that a rule based code generation is the way forward for tools like EA.

About three years ago, I suggested that EA be developed to generate code from decision tables based on decision trees / rules. Today most of the BPMS tools are doing that.  This is the capability IT shops are now using to control outsoursing because we discovered that no matter how hard we try, we can never specify requirements correctly enough for correct code development in an outsourced programme.

The most difficult part of code development is managing the logic, and running a simulation to test the invariance of the rules. The ANSI standard for decision tables has been around for so long. This tool is what bridges the Business Analyst and Developer view transparently.

I recommend that people consider adding a tool known as Logic Gem (www.catalyst.com) to their development toolkit. Unfortunately, given that I dont code, I am unable to create a bridge between EA and Logic Gem. I will leave that some brilliant developer in the EA community.

I am sure that with the inclusing of the state table, Sparxsystem will one day soon provide code generation based on their state machine feature.

About Logic Gem:
LogicGem 3.0
Logic Processor and Decision Table Analysis Tool
LogicGem has a two-fold audience, software developers (programmers) and business analysts (non-programmers). The common thread between these two diverse groups is that they both need to design logically complete business rules. For the programmer, the business rules are in fact functional requirements for a software application that are translated into a programming language that becomes part of the application. For the business analyst or domain expert, the same need exists with the exception of translating the logic to a programming language. Business analysts need to develop concise business rules that represent real life or proposed business processes and these processes need to be every bit as logically robust as a software implementation. Collectively, we can refer to both groups of programmers and business analysts as a "logic engineer".

Much of the effort in software development does not involve writing code, but rather the process of covering every possible combination of circumstances – user input, database transaction, or any other event – that the program will encounter. When the programmer or analyst overlooks a possible combination of inputs or events, the program may do things essentially at random. Even worse are errors made during program maintenance, usually by programmers who do not fully understand the interaction between dozens of different possibilities. As it is, logical analysis is tedious and error prone: it's easy to omit, duplicate, or contradict conditions.

LogicGem is a software tool called a "logic processor" that addresses these issues using decision table theory. LogicGem consists of a logic editor, and logic compiler. With the logic editor, you can create logic tables – spreadsheet-like constructions that encapsulate a set of logical rules. One part of a table contains conditions that can be linked to create a rule, and the other part contains actions that are related to the rules. Once you've defined the rules, the editor will automatically analyze them, add missing rules, and remove those that are redundant or contradictory. Decision table technology is the vehicle by which logically complete business rules may be constructed. When you're done, the logic compiler is available to generate source code in Basic, C, C++, Fortran, FoxPro, Java, Pascal, PowerBuilder, SAS, Visual Basic, Visual Basic.NET, Visual C#.NET, or Xbase. The compiler will produce a set of English, Spanish, French or German rules that can be used as documentation or as a knowledge base.

The LogicGem logic processor software tool is designed to provide a familiar, easy-to-use way to create, edit, verify and compile decision table logic. LogicGem's logic tables express a problem visually, making it easy to understand. LogicGem provides the means to prototype and expand a high-level procedural concept into a decision table, work it through analysis and design phases, and then generate English language documentation and programming source code in various programming languages. LogicGem provides tools to ensure that a table's logic is complete, unambiguous and contains every applicable rule in an expanded or reduced forma

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #4 on: April 28, 2008, 09:37:42 am »
Quote
I am sure that with the inclusing of the state table, Sparxsystem will one day soon provide code generation based on their state machine feature.
Indeed. Have a look at the MDG Technology for RealTime UML, currently in Beta:

http://www.sparxsystems.com/products/mdg/tech/rtuml/beta.html
The Sparx Team
[email protected]

salayande

  • EA User
  • **
  • Posts: 224
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #5 on: April 30, 2008, 04:34:32 am »
Sparxsystem has again demonstrated support for software programming.

This valuable information might have arrived a bit late for me given that I have already acquired the LogicGem 3.0 software.

Even then, I am tempted to download and evaluate the Real-time Add-In.

I would love to see EA support the OMG standards for Business Rules:
SVBR for Requirements and PRR for MDA PIM modeling. I anticipate the rules to drive rule engines like ILOG and others playing in the Business Rules Management and Business Process Management space. I have raised a formal feature request for this.

I am sure I will get an EA Add-in from Sparxsystem before purchasing another vendor's product which is a pain because of the integration and re-use issues.

kind regards

Segun
« Last Edit: April 30, 2008, 04:35:38 am by salayande »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #6 on: April 30, 2008, 08:44:22 am »
Still, I'm a bit disappointed that this feature has shown up in an add-in - a rather special purpose one at that - instead of the main product.
No, you can't have it!

salayande

  • EA User
  • **
  • Posts: 224
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Code Generation from Activity Diagram
« Reply #7 on: May 03, 2008, 04:23:36 am »
Hi David,

Sparxsystem can be generous.

At some point in the near future, most of the EA Add-Ins which are currently market differentiators and thus sources of competitive advantage will become common across competing solutions.

Sparxsysteme may then merge them with the Core product, example the Visio and BPMN Add-Ins.

kind regards

Segun