KEMBAR78
Programming in UML: Why and How | PPT
Programming in UML: Why and How Ed Seidewitz
Modeling for Software Development But… It is hard to validate the correctness of the models before development. The developers may not follow the models, without providing feedback. It is hard to keep the models and development artifacts in sync during development (and maintenance). How it usually works Developers provide feedback to the architects (maybe) Architects give models to developers Developers create artifacts based on the models (maybe) Architects create the models
Modeling for Software Development Code-based development Use models for initial design, but then focus on code Pro:  Code is single source of "truth" Con:  Code is not as good for expressing design as models Model-driven development Use models as the source artifacts for development Pro:  Models can be more easily understood and evolved by human developers and maintainers. Con:  Model must be detailed enough to be executable in its own right. Two responses But is this really a “con”??
Executable UML: Perceived Issues Making models detailed enough for machine execution defeats the purpose of models for human communication. UML is not specified precisely enough to be executed (at least not in a standard way). Graphical modeling notations are not good for detailed programming.
Executable UML: Issue Resolutions Making models detailed enough for machine execution defeats the purpose of models for human communication. Executable models can still be more understandable than executable code. Non-executable models are still useful, too. UML is not specified precisely enough to be executed (at least not in a standard way). The Foundational UML (fUML) standard specifies precise semantics for an executable subset of UML. Final adoption of fUML Version 1.0 by OMG Board of Directors is expected soon. Graphical modeling notations are not good for detailed programming. Concrete Syntax for a UML Action Language  RFP requests a standard textual action language with fUML semantics. Action Language for fUML (Alf) submission in progress.
Architecture for Executable UML Tooling A virtual machine based on concurrent UML activity flow semantics. The target for “compiled” models. Providing all the capabilities expected in a code-based IDE. In memory or via XMI transfer. Simulation, analysis, optimization, etc. fUML Execution Engine Model Development Environment Other Tools Target Platform
Modeling for Software Development The models  are  the source code. Using a standard-conforming UML modeling tool Using a standard-conforming UML execution tool How it works with executable models Architects validate the models by executing them in a simulated test environment Technologists specify the implementation platform The models are provisioned as executing artifacts on the target platform Architects create the models
Programming in UML … is just programming, only better! The models are validated in a development/test environment The models are deployed in a production environment Developers create fully executable models Developers iteratively execute, test and update the models
Example: Property Management SOA Graphical UML notation for Data model Message model Interface and class models Component models Textual Alf notation for Operation methods
Property Data Model
Service Request Message Model
Service Reply Message Model
Service Interface and Implementation
Service Provider Component Composite structure and ports are not in fUML, but they can be interpreted per SoaML.
Operation method: establish /** Establish a new property record. */ activity establish ( in request: 'Property Record Establishment', out reply: 'Property Management Success Reply' [0..1], out error: 'Error Reply' [0..1] ) { identifier = this.'property identifier factory'.'get next identifier'();  if (request.'property type' == 'Property Type'::personal) { property = new 'Personal Property'::'create property'(identifier,request.name);  } else { property = new 'Real Property'::'create property'(identifier,request.name); } reply = this.'create reply'(request.identifier, property); } Operation methods are specified as UML activities. Newly created objects persist at the current execution locus. Names can have spaces or other special characters.
Operation method: update /** Update the data of a property other than acquisition or disposition. */ activity update ( in request: 'Property Record Update', out reply: 'Property Management Success Reply' [0..1], out error: 'Error Reply' [0..1] ) { property = Property -> select p (p.identifier == request.'property identifier'); if (property -> isEmpty()) { error = new 'Error Reply' ( identifier  => request.identifier + "/error", 'request identifier' => request.identifier, 'error code'  => "PRU-001", 'error message'  => "Property not found." ); } else if (property.status == 'Property Type'::disposed) { … } else { if (request.'property location' -> notEmpty()) { location = Location -> select loc  (loc.identifier == request.'property location'); 'Property Location'.createLink(property, location); } … } } A “select” maps to a concurrent expansion region over a class extent. Creating a link automatically establishes a bidirectional relationship.
References Foundational UML (fUML) Semantics of a Foundational Subset for Executable UML Models standard,   http://www.omg.org/spec/fuml   fUML Reference Implementation Project,  http://www.modeldriven.org/fuml Action Language for fUML (Alf) Concrete Syntax for a UML Action Language  RFP,  http://www.omg.org/cgi-bin/doc?ad/2008-09-09   Submission repository,  http://lib.modeldriven.org/MDLibrary/trunk/Applications/Alf-Reference-Implementation   /doc – Latest submission document and current working draft /dist – Parser for latest working version (currently v0.08) Contact [email_address] http://twitter.com/seidewitz

Programming in UML: Why and How

  • 1.
    Programming in UML:Why and How Ed Seidewitz
  • 2.
    Modeling for SoftwareDevelopment But… It is hard to validate the correctness of the models before development. The developers may not follow the models, without providing feedback. It is hard to keep the models and development artifacts in sync during development (and maintenance). How it usually works Developers provide feedback to the architects (maybe) Architects give models to developers Developers create artifacts based on the models (maybe) Architects create the models
  • 3.
    Modeling for SoftwareDevelopment Code-based development Use models for initial design, but then focus on code Pro: Code is single source of "truth" Con: Code is not as good for expressing design as models Model-driven development Use models as the source artifacts for development Pro: Models can be more easily understood and evolved by human developers and maintainers. Con: Model must be detailed enough to be executable in its own right. Two responses But is this really a “con”??
  • 4.
    Executable UML: PerceivedIssues Making models detailed enough for machine execution defeats the purpose of models for human communication. UML is not specified precisely enough to be executed (at least not in a standard way). Graphical modeling notations are not good for detailed programming.
  • 5.
    Executable UML: IssueResolutions Making models detailed enough for machine execution defeats the purpose of models for human communication. Executable models can still be more understandable than executable code. Non-executable models are still useful, too. UML is not specified precisely enough to be executed (at least not in a standard way). The Foundational UML (fUML) standard specifies precise semantics for an executable subset of UML. Final adoption of fUML Version 1.0 by OMG Board of Directors is expected soon. Graphical modeling notations are not good for detailed programming. Concrete Syntax for a UML Action Language RFP requests a standard textual action language with fUML semantics. Action Language for fUML (Alf) submission in progress.
  • 6.
    Architecture for ExecutableUML Tooling A virtual machine based on concurrent UML activity flow semantics. The target for “compiled” models. Providing all the capabilities expected in a code-based IDE. In memory or via XMI transfer. Simulation, analysis, optimization, etc. fUML Execution Engine Model Development Environment Other Tools Target Platform
  • 7.
    Modeling for SoftwareDevelopment The models are the source code. Using a standard-conforming UML modeling tool Using a standard-conforming UML execution tool How it works with executable models Architects validate the models by executing them in a simulated test environment Technologists specify the implementation platform The models are provisioned as executing artifacts on the target platform Architects create the models
  • 8.
    Programming in UML… is just programming, only better! The models are validated in a development/test environment The models are deployed in a production environment Developers create fully executable models Developers iteratively execute, test and update the models
  • 9.
    Example: Property ManagementSOA Graphical UML notation for Data model Message model Interface and class models Component models Textual Alf notation for Operation methods
  • 10.
  • 11.
  • 12.
  • 13.
    Service Interface andImplementation
  • 14.
    Service Provider ComponentComposite structure and ports are not in fUML, but they can be interpreted per SoaML.
  • 15.
    Operation method: establish/** Establish a new property record. */ activity establish ( in request: 'Property Record Establishment', out reply: 'Property Management Success Reply' [0..1], out error: 'Error Reply' [0..1] ) { identifier = this.'property identifier factory'.'get next identifier'(); if (request.'property type' == 'Property Type'::personal) { property = new 'Personal Property'::'create property'(identifier,request.name); } else { property = new 'Real Property'::'create property'(identifier,request.name); } reply = this.'create reply'(request.identifier, property); } Operation methods are specified as UML activities. Newly created objects persist at the current execution locus. Names can have spaces or other special characters.
  • 16.
    Operation method: update/** Update the data of a property other than acquisition or disposition. */ activity update ( in request: 'Property Record Update', out reply: 'Property Management Success Reply' [0..1], out error: 'Error Reply' [0..1] ) { property = Property -> select p (p.identifier == request.'property identifier'); if (property -> isEmpty()) { error = new 'Error Reply' ( identifier => request.identifier + "/error", 'request identifier' => request.identifier, 'error code' => "PRU-001", 'error message' => "Property not found." ); } else if (property.status == 'Property Type'::disposed) { … } else { if (request.'property location' -> notEmpty()) { location = Location -> select loc (loc.identifier == request.'property location'); 'Property Location'.createLink(property, location); } … } } A “select” maps to a concurrent expansion region over a class extent. Creating a link automatically establishes a bidirectional relationship.
  • 17.
    References Foundational UML(fUML) Semantics of a Foundational Subset for Executable UML Models standard, http://www.omg.org/spec/fuml fUML Reference Implementation Project, http://www.modeldriven.org/fuml Action Language for fUML (Alf) Concrete Syntax for a UML Action Language RFP, http://www.omg.org/cgi-bin/doc?ad/2008-09-09 Submission repository, http://lib.modeldriven.org/MDLibrary/trunk/Applications/Alf-Reference-Implementation /doc – Latest submission document and current working draft /dist – Parser for latest working version (currently v0.08) Contact [email_address] http://twitter.com/seidewitz