Keep on dreaming…..
On the phone with a customer I noticed that the customer was disappointed in Rhapsody and in its ability to handle C source code that was externally written.
I always find it very difficult to deal with people who are not happy with the tools we sold them. But yes, it does happen sometimes and unfortunately, this was no different.
This particular customer wanted to use Rhapsody to more or less monitor his coding in C and in the meantime draw diagrams that represent his documentation. And also when it fitted better he wanted to draw in Rhapsody and then generate the C code according to his coding standard.
I never promised that such a scenario would work, I’m very sure, but this is what the customer understood from my words in earlier visits before buying.
I think that is OK, I am not offended, nor angry, nor do I take it personally. Customers are just as human as I am. I also hear what I want to hear and interpret until it’s right for me.
So, I do hear the ice cream man say: “I will be in your street today” and I do not hear him add: “but I wont be stopping…..” No problem.
The problem is that it I hate it when my customers are unhappy and I would like to change that but it I find it very difficult to transfer the correct information to a future customer during the sales process. Let’s give it a try here…
The truth, the whole truth and nothing but the truth.
NO! It is NOT possible! You cannot use Rhapsody and just continue coding C or C++ (or even Java).
Well… not entirely…. You can do some of that.
Is it any good? No, it’s not. Well.. it is OK but not more than that. If you just want to understand your fuzzy written code and expect Rhapsody to generate perfect UML diagrams so that you can understand some spaghetti code that you found on your hard disk: Keep on Dreaming. Never gonna happen.
As I always say: Reverse Engineering is a GiGo Process: Garbage in, Garbage out. There is no way that you can automatically make the incomprehensible understandable.
That is perfectly OK, badly written code should be re-designed and re-made….
(Yes, I know there are programmers that think otherwise…
– It was hard to write, it should be hard to read….
– Better write software with “built-in understandability protection” to ensure your pension plan.
…but I do not agree there…)
Now in C++ or Java the conversion to UML works reasonably well since these languages already support OO like UML does. But even in these languages you have to comply with Rhapsody coding, it is not a simple process. Reverse Engineering for C, however, is a totally different matter.
There are some YouTube movies in the internet describing RE in Rhapsody (see links at the bottom) but for these demo’s they all used Rhapsody in C++.
And there is a reason for that…
But before I tell you what is possible and what not in Rhapsody in C, may I gently remind you that Rhapsody is a UML Tool? Yes!, that is what it was built for. From the beginning in 1996 it was designed from the bottom up to be the worlds greatest UML Tool. And it is!
(It is possible that I am a bit prejudiced here)
For Rhapsody the same applies as for all tools: the best way to become happy with a tool is by using it as closely to the way the creators have intended it. The more you bend the tool to do things your way, the unhappily you will become.
I always tell that to my customers and to my future customers. Always. But funny enough nobody hears it. That is just not what they want to hear. They all want the holy grail of software developers: the tool that does exactly what you want without errors. And there is no such thing, sorry. But, enough ranting, let’s go through what you _can_ do.
(Re-) Using your code in Rhapsody
Basically there are 3 variants: Code-centric, Model-centric and Code-aware.
This is the way to use Rhapsody. Your Model is the base of all. Code generation will generate your application. It can be compiled and linked to the framework (RXF) and you have a working application.
Code will be generated from Class and Object Diagrams, Structure Diagrams and from State-machine Diagrams and Activity Diagrams.
Rhapsody also supports flowcharts (Although these are NOT UML!) for the behavioral code of operations.
Here you use Rhapsody only to visualize your code. You can change the code and Rhapsody can process it to reflect the code in your model and in (some) diagrams.
How does that work?
- Switch your Rhapsody to Code-centric. How?
– When you are working in the Rhapsody Architect for Software your project will be code-centric by default.
– In Developer (or EUSIII) you can add the CodeCentric profile via the menu “Add Profile to Model”. In the next file selection screen go up one directory and then go to “Settings”. There you will find “CodeCentric” (Or if you have a Willert Install, “CodeCentric_Original) and load the newest file with the correct language)
- You can now use “Tools”, “Reverse Engineering” (RE) from the menu to read-in the files that you want to use. Beware!: Starting RE makes changes to Rhapsody that might not be easy to revert.
- Things you can (or should) do before using RE:
- Create a new Component
- Your reversed engineered code is now in Rhapsody. How does it look?
- You will see Packages, Files with variables and functions.
- These artefacts are NOT UML artefacts, they are introduced by Rhapsody to allow working with code.
- Rhapsody will generate OMD’s (Object Model Diagrams) with the structure of your files. If you have a lot of include files this does not really help.
- Rhapsody will NOT automatically generate Flow Diagrams (Activity Diagrams for functions). You can ask Rhapsody to do so (Right-click, “Populate FlowChart”).
remember: there is always just one “leading” source. Either your code or your Diagram. Check your settings.
- The best way to use the reversed engineered stuff is to convert it to “decent” Rhapsody elements like classes and objects. It is a bit of work but the result is very helpful.
The “hybrid” form. Not really supported.
Problems and possible solutions
- All the code-centric stuff is (current version is 8.2) only useable on 32-bit Rhapsody. 64-bit is improving but not there yet.
- Don’t expect miracles. If your code sucks, it will suck in Rhapsody as well. No way around it.
- Be prepared to experiment with re-reading in a new model. Sometimes that clears things.
- It’s 5 am…. do you know where your properties are? You better…. Check out what is set. Remember: Reverse Engineering sets properties by itself!
More information on YouTube
Gavin Arthurs speaks about Rhapsody mode/code centric:
Gavin on Rhapsody
Fraser Chadburn speaks about Code-centric development in C++:
Fraser on Code-centric
Chris Carson speaks about Code Reuse:
Chris about Code Reuse
Thomas Hall speaks about Reverse Engineering:
Thomas on Reverse Engineering
3 thoughts on “Code-centric vs Model-centric Development with Rhapsody.”
Great Article! (…, this is just a test if comments work…)
Well Walter, i commit, it’s a great article (my favorite until now) (OK, to hot to work has also been a nice one 🙂 ) and reminds me to a story with a prospective customer, when I was working for a tool vendor.
We had a guy who’s been downloading our trial-software two times a year. Over 2 or 3 years. Always said he’s happy with it, but never purchased a copy. I never knew, ist it a lack of budget or understanding or… Until i met him on a show and he said: “you must know, it’s not for me. I understand my code. But my boss thinks, he is understanding what I do, when he sees my code in your clearly structured diagrams :))
Go on with you blog, like it
LikeLiked by 1 person
Thanks!!! I will. Hope you enjoy it a long time.