Version: 1.4.0 (using KDE KDE 3.4.0) Installed from: Fedora RPMs OS: Linux Some software like "Rhapsody", "Real-time Studio", and others, propose a code generator for c language. I think it's a really lack not to be able to generate c code from uml class diagram...
C isn't object orientated. How do they get round that?
Selon Jonathan Riddell <jr@jriddell.org>: [bugs.kde.org quoted mail] Well, I don't know how they can generate c code from uml diagram, because I've never use these soft. Indeed, c is not object orientated, but nevertheless it's possible to have an approach of that... I think the most difficult part in c code generation are : - the virtuality mechanism - and the class derivation mechanism May be they introduce some limitations... I believe I've read an article about an UML modeler (under gpl) that generate c code, but I can't find it again. I'm asking me if such a free software really exists !
GB <silverhawk.os@free.fr> [050925 21:43]: > Well, I don't know how they can generate c code from uml diagram, because I've > never use these soft. > Indeed, c is not object orientated, but nevertheless it's possible to have an > approach of that... > I think the most difficult part in c code generation are : > - the virtuality mechanism > - and the class derivation mechanism > May be they introduce some limitations... It can be done, because UML is not just class diagram. For example you can take state diagrams to describe algorithms. Also think of the abstract datatype concept in C. It was introduced before OOP came up. Also take a look at the GNOME project, they use C in an object oriented way. In the end you can do everything with a programming language. The question is just if it is the best solution to use C for object oriented programming. Sebastian
Selon Sebastian Stein <seb_stein@gmx.de>: [bugs.kde.org quoted mail] I know that it is possible to use C in an object oriented way. I'm a c++ developer, and by the way, I use very often UML and specially class diagram to design the soft I do. At the moment, I read documentation in order to develop a kernel for OS. I would like to design it in the object oriented way. the problem is to develop a kernel in c++ is a little bit more difficult than to develop it in C (essentially because of the RTTI support). That's why I'm looking for a UML modeler which could generate c code. More'over, c is a really popular language : I think it would be benefit for a lot of people. That why I suggested to add c language support in umbrello (I don't know another uml modeler as advenced as umbrello in the free software community). G
GB <silverhawk.os@free.fr> [050926 08:28]: > I know that it is possible to use C in an object oriented way. > I'm a c++ developer, and by the way, I use very often UML and specially class > diagram to design the soft I do. At the moment, I read documentation in order > to develop a kernel for OS. I would like to design it in the object oriented > way. > the problem is to develop a kernel in c++ is a little bit more difficult than to > develop it in C (essentially because of the RTTI support). That's why I'm > looking for a UML modeler which could generate c code. More'over, c is a really > popular language : I think it would be benefit for a lot of people. > That why I suggested to add c language support in umbrello (I don't know another > uml modeler as advenced as umbrello in the free software community). Still you have to say how a generator should look like. I mean it is not enough to say a C generator is needed. Also, if you are a programmer, take a look at the PHP or JavaScript generator. I think it should be fairly easy for you to derive a C generator from those examples. Sebastian
Selon Sebastian Stein <seb_stein@gmx.de>: [bugs.kde.org quoted mail] Well, I will think about it when I'll have some free time to spend on it. G
dia2code (http://sourceforge.net/projects/dia2code) already has a generator for the C language, perhaps this might be useful for some inspration on how the mapping could be done: http://dia2code.cvs.sourceforge.net/dia2code/dia2code/dia2code/generate_code_c.c?revision=1.1.1.1&view=markup
I would like to add support for this concept. I have done embedded middleware in C++ for Set Top Boxes and used Rational Rose and Borland Together to good effect in that environment. However currently I am doing SMP Unix Kernel work and would really like to use a tool to a) reverse engineer a portion of our C code and b) use it to document the design better. Currently pointing umbrello from kdesdk 4.0 on fedora 9 at a single header can cause it to lock up, I think this is due to a lot of struct forward declarations. This also causes an imported structure to not be "cut" and "Pasteable" (ie. error of you cannot delete a non-empty folder for some reason). Anyway I will download the source to see if I can debug this. However I would suggest that class/struct diagrams and sequence diagrams are just as useful in structured languages as OO. What needs to happen is to be able to parse structs in a slightly different way to class definitions or at least recognise they are struct and don't bother defaulting to showing operations for them. Similarly a better way of showing global methods as being inside of folders/files would be nice instead of classes. This would make sequence diagrams easier (ie. at the moment I create classes with the file names and add the methods to them so that I can create sequence diagrams. This is similar to how the reverse engineer of the headers is creating classes to represent the structures). Anyway some ideas for what it is worth. It would be nice not to ignore the C world at least until the OSs start to move to OO. Cheers John
(In reply to comment #8) > Similarly a better way of showing global methods as being > inside of folders/files would be nice instead of classes. This would make > sequence diagrams easier (ie. at the moment I create classes with the file > names and add the methods to them so that I can create sequence diagrams. This > is similar to how the reverse engineer of the headers is creating classes to > represent the structures). > > Anyway some ideas for what it is worth. It would be nice not to ignore the C > world at least until the OSs start to move to OO. I agree with you. I also use this way: methods in files are operation in classes at the uml-model. In my opinion this is a good way to include support for c-language. But we need "activity models to code" for this requirement.
Git commit 159d04c4035df099cd151c8faeebffea7da84f5d by Ralf Habacker. Committed on 10/11/2019 at 11:36. Pushed by habacker into branch 'release/19.12'. Fix crash loading a file with unsupported code generator This is the case if an xmi file with configured C-code generator is opened with older Umbrello versions. M +5 -2 umbrello/umldoc.cpp https://commits.kde.org/umbrello/159d04c4035df099cd151c8faeebffea7da84f5d