Cell Phone Software Forum
| View previous topic :: View next topic |
| Author |
Message |
Gabriel Gonzalez Guest
|
Posted: Wed Mar 07, 2007 1:44 pm Post subject: UML to no-OOed languages |
|
|
Hi there,
Is out there any standard, or something close to it, about how to
translate OOed designs to no-OOed design such as C?
Maybe there is any extension to UML that helps to achieve the
translation but I am not aware of it so any comment would be more than
welcome :)
Cheers,
Gabriel Gonzalez. |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
H. S. Lahman Guest
|
Posted: Wed Mar 07, 2007 9:44 pm Post subject: Re: UML to no-OOed languages |
|
|
Responding to Gonzalez...
| Quote: |
Is out there any standard, or something close to it, about how to
translate OOed designs to no-OOed design such as C?
Maybe there is any extension to UML that helps to achieve the
translation but I am not aware of it so any comment would be more than
welcome
|
To the extent the OMG's MOF, MDA, and UML specifications all provide
standardization that supports translation, yes. However, these standards
are all meta standards so they won't write the transformation engine
code for you. If you want to build a transformation engine, you treat it
like any other new application.
Transformation engines (the MDA buzzword for model compilers/code
generators) are non-trivial to do properly. The technology has been
around since the early '80s but it was not until the late '90s that
optimization techniques advanced to the point where automatic code
generation from OOA models was competitive. The computing space may be
deterministic, but it is enormously complex so the transformation engine
faces a much tougher optimization problem than a 3GL compiler.
(Traditionally it took the better part of a decade for a compiler for a
new language like C to fully mature.)
Bottom line: If you are planning on launching your own commercial
product, then I hope you have deep pockets and a whole lot of time. B-)
(Trust me on this; Pathfinder has been in that business for more than a
decade.)
FYI, the transformation engine does not go through any non-OO design
step to produce C code. The engine goes directly from the PIM (Platform
Independent Model aka OOA model) to the 3GL language of choice (or even
Assembly for some RTOS environments). It is actually rather common for
commercial transformation engines to target C. That's because procedural
languages will usually provide better performance and one does not have
to maintain the 3GL code. (I know of one vendor who deliberately made
the generated C code difficult to read to prevent the user from
by-passing the models when making changes.)
That's possible because of MDA-style mappings between meta models. The
3GL code is just a text model of the executable rather than a graphic
model that happens to be at a lower level of abstraction. The syntax
specification of the language and the associated semantics forms the
meta model for the specific language instance. The transformation engine
then just maps the PIM meta model (mostly the UML meta specification)
into the language meta model and uses that mapping to convert specific
PIM model elements into specific code elements. The mappings and
transformation rules are provided for the specific environment through
MDA Marking Models and Transformation Models. That allows one to have
1:* mappings between PIM elements and 3GL elements to deal with
optimization.
For a template-based transformation engine like PathMATE, the OTS tool
can produce any mix of C, C++, Java, Javascript, XML encodings, or even
MS Word documentation from a single PIM. (That happens to be the main
market, but all we would need is more templates to target other languages.)
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
hsl@pathfindermda.com
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info@pathfindermda.com for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Gabriel Gonzalez Guest
|
Posted: Mon Mar 12, 2007 1:06 pm Post subject: Re: UML to no-OOed languages |
|
|
Thanks for your reply! But my question was far more simple and less
ambitious. I wasn't thinking about building a code generation tool, I
just meant whether any standard method for translating UML to no-OOed
languages exists.
Let's say the developer reads a OOed design e.g. sketched in UML, and
using some guide this developer will be able to translate this Class
to a struct and this private method to a static function belonging to
a module with these global variables... etc
Cheers,
Gabriel Gonzalez.
On Mar 7, 5:44 pm, "H. S. Lahman" <h.lah...@verizon.net> wrote:
| Quote: |
Responding to Gonzalez...
Is out there any standard, or something close to it, about how to
translate OOed designs to no-OOed design such as C?
Maybe there is any extension to UML that helps to achieve the
translation but I am not aware of it so any comment would be more than
welcome :)
To the extent the OMG's MOF, MDA, and UML specifications all provide
standardization that supports translation, yes. However, these standards
are all meta standards so they won't write the transformation engine
code for you. If you want to build a transformation engine, you treat it
like any other new application.
Transformation engines (the MDA buzzword for model compilers/code
generators) are non-trivial to do properly. The technology has been
around since the early '80s but it was not until the late '90s that
optimization techniques advanced to the point where automatic code
generation from OOA models was competitive. The computing space may be
deterministic, but it is enormously complex so the transformation engine
faces a much tougher optimization problem than a 3GL compiler.
(Traditionally it took the better part of a decade for a compiler for a
new language like C to fully mature.)
Bottom line: If you are planning on launching your own commercial
product, then I hope you have deep pockets and a whole lot of time. B-)
(Trust me on this; Pathfinder has been in that business for more than a
decade.)
FYI, the transformation engine does not go through any non-OO design
step to produce C code. The engine goes directly from the PIM (Platform
Independent Model aka OOA model) to the 3GL language of choice (or even
Assembly for some RTOS environments). It is actually rather common for
commercial transformation engines to target C. That's because procedural
languages will usually provide better performance and one does not have
to maintain the 3GL code. (I know of one vendor who deliberately made
the generated C code difficult to read to prevent the user from
by-passing the models when making changes.)
That's possible because of MDA-style mappings between meta models. The
3GL code is just a text model of the executable rather than a graphic
model that happens to be at a lower level of abstraction. The syntax
specification of the language and the associated semantics forms the
meta model for the specific language instance. The transformation engine
then just maps the PIM meta model (mostly the UML meta specification)
into the language meta model and uses that mapping to convert specific
PIM model elements into specific code elements. The mappings and
transformation rules are provided for the specific environment through
MDA Marking Models and Transformation Models. That allows one to have
1:* mappings between PIM elements and 3GL elements to deal with
optimization.
For a template-based transformation engine like PathMATE, the OTS tool
can produce any mix of C, C++, Java, Javascript, XML encodings, or even
MS Word documentation from a single PIM. (That happens to be the main
market, but all we would need is more templates to target other languages.)
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
h...@pathfindermda.com
Pathfinder Solutionshttp://www.pathfindermda.com
blog:http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
i...@pathfindermda.com for your copy.
Pathfinder is hiring:http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH |
|
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
H. S. Lahman Guest
|
Posted: Mon Mar 12, 2007 7:56 pm Post subject: Re: UML to no-OOed languages |
|
|
Responding to Gonzalez...
| Quote: |
Thanks for your reply! But my question was far more simple and less
ambitious. I wasn't thinking about building a code generation tool, I
just meant whether any standard method for translating UML to no-OOed
languages exists.
Let's say the developer reads a OOed design e.g. sketched in UML, and
using some guide this developer will be able to translate this Class
to a struct and this private method to a static function belonging to
a module with these global variables... etc
|
But that is essentially transformation of one model representation (UML)
into another (3GL code). If one just creates header files and body stubs
one has an elaboration round-trip transformation. If one does full code
generation, one has a translation transformation. Either way the
standard is MDA. Either way the semantics of the representations on both
sides are subtle and complex so there is no "cookbook" approach until
one gets to the MDA level, however intuitive the mapping of class to
struct might superficially appear.
IOW, even if you only want to do part of the job you will still have to
implement the same sorts of infrastructure for meta-semantic mapping,
Marking Models, Transformation models and whatnot that MDA formalizes.
The only other choice is to do it in a purely ad hoc manner.
*************
There is nothing wrong with me that could
not be cured by a capful of Drano.
H. S. Lahman
hsl@pathfindermda.com
Pathfinder Solutions
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
"Model-Based Translation: The Next Step in Agile Development". Email
info@pathfindermda.com for your copy.
Pathfinder is hiring:
http://www.pathfindermda.com/about_us/careers_pos3.php.
(888)OOA-PATH |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Phlip Guest
|
Posted: Tue Mar 13, 2007 7:39 am Post subject: Re: UML to no-OOed languages |
|
|
Gabriel Gonzalez wrote:
| Quote: |
Let's say the developer reads a OOed design e.g. sketched in UML, and
using some guide this developer will be able to translate this Class
to a struct and this private method to a static function belonging to
a module with these global variables... etc
|
You describe a situation where one engineer writes OO designs and another
reads them and implements their code.
This rarely happens in real life, because when it does it causes all kinds
of waste and extra work.
When engineers implement code, they should use UML at the same time as they
are writing the code. The goal is right-sizing the amount of effort.
What makes code OO is how it handles "callback" situations. OO has built-in
support for callbacks as virtual methods, and non-OO programs make you use
function pointers, or worse, to call a module back. The only place where UML
specifies this is the generalization arrow -|>, so that's where you would
install a callback system.
Everything else you can do with structures, and functions that take handles
to these in their first arguments.
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!! |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Gabriel Gonzalez Guest
|
Posted: Tue Mar 13, 2007 3:46 pm Post subject: Re: UML to no-OOed languages |
|
|
On Mar 13, 4:39 am, "Phlip" <phlip...@yahoo.com> wrote:
| Quote: |
Gabriel Gonzalez wrote:
Let's say the developer reads a OOed design e.g. sketched in UML, and
using some guide this developer will be able to translate this Class
to a struct and this private method to a static function belonging to
a module with these global variables... etc
You describe a situation where one engineer writes OO designs and another
reads them and implements their code.
This rarely happens in real life, because when it does it causes all kinds
of waste and extra work.
|
Why? I bet this happens more often than you say, I have always seen
groups of designers and groups of developers which just code. Sure
there will be feedback in both directions and from my experience it
does the opposite to generate extra work.
Anyway this is irrelevant to the subject of the post.
| Quote: |
When engineers implement code, they should use UML at the same time as they
are writing the code. The goal is right-sizing the amount of effort.
|
Do you mean an engineer should take both roles designer and
programmer?
| Quote: |
What makes code OO is how it handles "callback" situations. OO has built-in
support for callbacks as virtual methods, and non-OO programs make you use
function pointers, or worse, to call a module back. The only place where UML
specifies this is the generalization arrow -|>, so that's where you would
install a callback system.
|
callback != abstract method
You can design a callback system applying e.g. Observer Pattern
| Quote: |
Everything else you can do with structures, and functions that take handles
to these in their first arguments.
|
I don't get this sentence at all.
Cheers,
Gabriel Gonzalez. |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
Phlip Guest
|
Posted: Wed Mar 14, 2007 6:49 am Post subject: Re: UML to no-OOed languages |
|
|
Gabriel Gonzalez wrote:
| Quote: |
You describe a situation where one engineer writes OO designs and another
reads them and implements their code.
This rarely happens in real life, because when it does it causes all
kinds
of waste and extra work.
Why? I bet this happens more often than you say, I have always seen
groups of designers and groups of developers which just code. Sure
there will be feedback in both directions and from my experience it
does the opposite to generate extra work.
|
It can't scale, because the designers will always be the slowest ship in the
fleet. While their paperwork says they are the fastest!
| Quote: |
When engineers implement code, they should use UML at the same time as
they
are writing the code. The goal is right-sizing the amount of effort.
Do you mean an engineer should take both roles designer and
programmer?
|
There are those who claim that's the most efficient way to do it.
To turn your question around and hand it back to you, would you trust a team
with a designer who _can't_ code and a coder who _can't_ design?
| Quote: |
What makes code OO is how it handles "callback" situations. OO has
built-in
support for callbacks as virtual methods, and non-OO programs make you
use
function pointers, or worse, to call a module back. The only place where
UML
specifies this is the generalization arrow -|>, so that's where you would
install a callback system.
callback != abstract method
|
One uses an abstract method so old code can call new code. One typically
does that in C (for example), using a function pointer. Call that a
"callback", for want of a better term that doesn't drag in too much extra
terminology.
| Quote: |
Everything else you can do with structures, and functions that take
handles
to these in their first arguments.
I don't get this sentence at all.
|
OO (roughly):
foo.bar();
Object Based C (roughly!):
bar(&foo);
bar is a de-facto method of foo. At translation time, the UML method
notation translates into a function that takes a handle to foo as its first
argument.
--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!! |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
xpyttl Guest
|
Posted: Wed Mar 14, 2007 7:36 pm Post subject: Re: UML to no-OOed languages |
|
|
"Gabriel Gonzalez" <gabriel.gonzalez.garcia@gmail.com> wrote in message
news:1173786393.407482.174870@64g2000cwx.googlegroups.com...
| Quote: |
Why? I bet this happens more often than you say, I have always seen
groups of designers and groups of developers which just code.
|
This only happens in organizations that have to meet schedules and budgets,
and in spite of what some people believe, this does happen occasionally.
There are apparently people, however, who don't need to deal with those
annoyances, and they take the view that everyone should just have fun, build
what looks interesting, and ignore the rest.
... |
|
| Back to top |
|
 |
| |
Ads |
Advertising
Sponsor
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|

231 Attacks blocked
Powered by phpBB © 2001, 2005 phpBB Group
|