Presentation is loading. Please wait.

Presentation is loading. Please wait.

UML Based Automated Code Generation UML Based Automated Code Generation IEEE Computer Society Phoenix Haseeb Ahmed Motorola Inc. November 7, 2007.

Similar presentations


Presentation on theme: "UML Based Automated Code Generation UML Based Automated Code Generation IEEE Computer Society Phoenix Haseeb Ahmed Motorola Inc. November 7, 2007."— Presentation transcript:

1 UML Based Automated Code Generation UML Based Automated Code Generation IEEE Computer Society Phoenix Haseeb Ahmed Motorola Inc. November 7, 2007

2 Agenda UML and Modeling Auto-Coding Unifying Modeling & Auto-Code Generation Applicability. Demonstration with Telelogics Tau G2. Open Forum

3 November 7, 2007 UML and Modeling Why UML? –Late 80s and early 90s saw a quantum leap in software development (and revenues). –Industry needed a Standardized view of representation. –Answer: The Unified Modeling Language

4 November 7, 2007 UML – Simply put… Served as a unifying language for software. –Standardized –Agnostic to platform, OS and programming language The Language consisted of pictorial representations for various software artifacts: –Classes –State Machines –Sequence Diagrams – An excellent reference: The Unified Modeling Language - http://www-306.ibm.com/software/rational/uml/ http://www-306.ibm.com/software/rational/uml/

5 November 7, 2007 UML in Pictures: Use Cases Source: http://www.telelogic.com/campaigns/2003/global/taug22_launch/iuseuml1x.cfm

6 November 7, 2007 UML in Pictures: Class Diagrams Source: http://www.telelogic.com/campaigns/2003/global/taug22_launch/iuseuml1x.cfm

7 November 7, 2007 UML in Pictures: State Chart Diagram Source: http://www.telelogic.com/campaigns/2003/global/taug22_launch/iuseuml1x.cfm

8 November 7, 2007 UML in Pictures: Architecture Diagram Source: http://www.telelogic.com/campaigns/2003/global/taug22_launch/iuseuml1x.cfm

9 November 7, 2007 UML in Pictures: Sequence Diagrams Source: http://www.telelogic.com/campaigns/2003/global/taug22_launch/iuseuml1x.cfm

10 November 7, 2007 Modeling More precisely: Model Driven Architecture. Definition: A representation that focuses on the functionality and behavior of an application (or system) and is agnostic to the underlying platform, OS or programming language used. This is really a tall order given the spectrum of choices for platforms, OSs and languages today! For this presentation, Ill limit myself to Modeling with UML.

11 November 7, 2007 Modeling In practice, modeling relies on UML for abstracting everything from a small application to a complex system. –A typical Model may consists of: Classes, Objects Diagrams State Machine Diagrams Sequence/Activity Diagrams Architecture Diagrams Deployment Diagrams … even Use Cases

12 November 7, 2007 Modeling Typically, a software engineer will use a GUI or CASE tool to represent the application or system. The tool largely facilitates this by enforcing sanity of the application or system design. –For example: Verifying valid state transitions Verifying valid state transitions Automating message transmission and reception Automating message transmission and reception UML is a natural fit.

13 November 7, 2007 UML+Modeling = ? Once an application or system is fully modeled in UML, the next self-evident step is to generate the source code. Also known as… Most modern modeling tools provide this capability built-in.

14 November 7, 2007 Auto-Coding Strictly speaking: Automated Code Generation Definition: A way to automagically synthesize code for an application or system from a model, following UML and Modeling constructs.

15 November 7, 2007 Modeling & Auto-Code Generation: A High Level View Auto Code Generator OS Platform UML Models 6. Application Binary executing on Target OS/Platform 1. Create UML Model 2. Model Sanity Checked 3. Auto-Code Generation 4. Source Code Ready to Build 5. Compile & Build into Application Binary UML Modeling Tool

16 November 7, 2007 Auto-Coding: The Silent Sidekick Auto-coding not so new in software development. Often used for things which are tedious and repetitive, e.g.; –Generating ASN.1 code. –Lex/YACC/Bison suite of tools for generating customized code for Unix based platforms. Usage generally invisible because the auto- coding syntax used is quite cryptic and not very exciting to the broader engineering community.

17 November 7, 2007 With higher level abstractions (UML, Modeling etc.) available, auto-coding can now generate full applications. From the 50,000 ft Level: However, tool offerings may be more or less compliant than what you would expect. C/C++ : Assembly Code :: Modeling : Handwritten Code Auto-Coding: Unleashed

18 November 7, 2007 Auto-Coding: Unleashed Many UML Model artifacts are just what we expect: –UML Class C++ Class/C Structure –UML Operation C/C++ Function Some are a bit more abstract: –UML Signals C/C++ Function calls. Think Callbacks for Input Signals and Function calls for Outbound signals.

19 November 7, 2007 Auto-Coding: Unleashed And some may be surprising: –Item widget[45] May Generate a simple Array of 45 elements. May Generate a simple Array of 45 elements. May Generate a Linked List of 45 Item nodes each with 1 widget. May Generate a Linked List of 45 Item nodes each with 1 widget. –Timers Set/Expire implementation based on tool and code generator. Set/Expire implementation based on tool and code generator. Timer ticks or TimeOfDay() Timer ticks or TimeOfDay()

20 November 7, 2007 Auto-Coding: Challenges This brings new challenges and concerns: –Performance of the generated code. –Perfection of generated code to model. Accurate conversion of model to code? –Implementation quirks: Auto-code generation is not standardized. Remember the Agnostic to the platform, OS and language requirement – what is the cost of portability? –Hard to compete (read: beat) hand written code in the short term.

21 November 7, 2007 Modeling & Auto-Code Key Benefits Higher Level Modeling emphasizes Design & Architectural Discipline. Design Many Tools provide built-in simulators. Execute the Model to see how it flows right from your Desktop. Rapid Prototyping possible for feature rich models. Test Auto-coding follows a set of rules for generating code. Quality is consistent. Avoids some egregious human errors (e.g., null pointers). Quality Cycle Time Reduction Cost of Poor Quality Containment (Hopefully) Better Software Design & Architecture. Overall

22 November 7, 2007 Applicability Well suited for Applications which lend nicely to State Machine Architectures. Protocols – Network, Telephony… Request/Reply, Transactional. Simulation Rapid Prototyping Picture Source: http://www.omg.org/mdahttp://www.omg.org/mda

23 November 7, 2007 Caveats UML and Object Oriented Design: They are not the same. In Modeling, easy to make big mistakes. (mostly easy to correct too, but not always!) Auto-coding best when its impacts are invisible. Performance and Portability must be carefully weighed.

24 November 7, 2007 Demo Tool: Telelogics Tau G2. Example: Construction of a request/response system within a non-trivial model. Construction of a request/response system within a non-trivial model.Miscellaneous: Highlight the simulation capabilities. Highlight the simulation capabilities. Injection of messages, auto generation of sequence diagrams. Injection of messages, auto generation of sequence diagrams.

25 November 7, 2007 Operating System Tau G2 App. Architecture Glue MW API Middleware Services Middleware to Interface generated code with custom libraries. Middleware glue for specialized services. Auto Generated Code UML Model Application plus Tau G2 kernel The Application/System The environment

26 November 7, 2007 Open Forum Q & A

27 November 7, 2007 References 1. The Unified Modeling Language - http://www-306.ibm.com/software/rational/uml/ http://www-306.ibm.com/software/rational/uml/ 2. Tau G2 – Telelogic – http://www.telelogic.com http://www.telelogic.com 3. The Object Management Group - http://www.omg.org/mda http://www.omg.org/mda 4. Automatic Code Generation from Design Patterns - http://www.research.ibm.com/designpatterns/pubs/codegen.pdf http://www.research.ibm.com/designpatterns/pubs/codegen.pdf 5. UML Forum (Modeling Tool Comparisons) - http://www.uml-forum.com/tools.htm http://www.uml-forum.com/tools.htm


Download ppt "UML Based Automated Code Generation UML Based Automated Code Generation IEEE Computer Society Phoenix Haseeb Ahmed Motorola Inc. November 7, 2007."

Similar presentations


Ads by Google