Existing code generators assume that we are professionals – but we wanted one for educational purpose.
We welcomed two new members, Brian Cham and Candice Eckert to
Friends of Astah Program.
They are developers of “LORINI” Plug-in which is an add-on for Astah to convert UML diagrams to executable code for students to learn modeling and object-oriented programming.
Today I interviewed Brian to learn their story and motivation behind the development of this tool.
[SJ] Thanks for your time Brian. I was delighted when I received your email introducing LORINI.OK, let us start!
Q: How did this project begin?
Candice and I were students at the University of Auckland. For the final year, student pairs complete a “Part IV Project” to develop research experiences and apply all the skills we have learned in our studies.
Our project brief was to develop new software which converted modelling diagrams to executable code. It was open-ended and our supervisor Professor Jing Sun left it up to us to decide any details beyond the description.
At the beginning, we researched automatic code generation, and that’s when the idea for Lorini was born. Looking through existing tools, there was a very obvious flaw that they all assumed the user was already a programming professional. They would just take in a model, spit out some code text, and that was that.
We decided to make a tool that assumed the user was only a learner, and that converted models to code for the purposes of education.
Lorini isn’t the first tool to convert UML to Java, but it is the first to display the model and code simultaneously and graphically depict the relationship between them for the purposes of learning.
Q: Why did you choose Astah?
We chose Astah because it fulfilled all of our requirements perfectly. To realise our idea, we needed a UML modelling application that was free, popular, cross-platform, easy to use and extensible. After trying out many applications, only Astah featured all of these. It had a well-documented API in the Java language, making it easy to develop a plug-in for. Also, its intuitive GUI meant that learners could easily interact with the UML diagrams, and it gave us a lot of freedom to display what we wanted to show the user.
Q: Great to hear. Experienced difficulties during the development?
Yes, it was a challenging process!
The idea of converting to UML to Java code is definitely easier said than done. The biggest difficulty was converting activity diagrams to method code.
If the user made individual actions in a sequence, that’d be simple to convert to lines of code. However, there are if-branches and while-loops which can be nested inside each other. This really complicates the structure of the flowchart. It took us a long time to develop an algorithm that could traverse through the entire activity diagram and accurately sort out how all the branches, loops and statements were arranged, without ending up in an infinite loop.
Q: How long did it take to complete?
Started in March and concluded in October. Sounds a long time, but we had to complete it alongside our other papers, so we were actually quite constrained. In total I would say that it took a few hundred hours, including the other requirements like research, planning, user testing, reports, poster and exhibition. It was a lot of work!
Q: Wow – What was the motivation made you guys going?
The motivation behind this tool was to give programming students a better introduction to modelling and object-oriented programming. Students are trained with functional programming and then moved on to object-oriented programming and then UML, which are big leaps. It is challenging to grasp how they relate to each other and what the purpose is. Some educators have successfully tried an alternative approach where beginner students are introduced to UML and object-oriented programming simultaneously, and there is a strong emphasis on how the code and model are actually just two different manifestations of the same software design. By showing the equivalence between any part of code and the diagram, Lorini is intended to ease the transition from object-oriented programming to modelling, or from modelling to object-oriented programming.
Q: How do you wish LORINI to grow?
We hope that Lorini will lead to a better understanding of UML and therefore to a wider use thereof!
[SJ] Sure will! We give a free license of Astah Professional to students and very reasonable license “Faculty Site License” to schools, so Astah students (students who use Astah) are increasing all over the world. I am sure LORINI will help them with their studies!
One thought on “From Design to Code : An Educational Approach”
“Lorini isn’t the first tool to convert UML to Java, but it is the first to display the model and code simultaneously and graphically depict the relationship between them for the purposes of learning.”
Nice work. You may be interested in AME:
I am one of the authors. Please feel free to contact me if you want.