SlideShare a Scribd company logo
22 March 2011Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)Programming in UML:An Introduction to fUML and AlfTutorial for the OMG Executable UML Information DayPresented by Ed Seidewitz
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011AgendaIntroductionElements of Executable UMLStandard Model Library
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011I. IntroductionA Motivating ExampleProgramming in UMLThe Standards
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011A. A Motivating ExampleE-Commerce Ordering SystemLoosely based on the Online Bookstore Domain Case Study given in Appendix B of the book Executable UML: A Foundation for Model Driven Architecture by Stephen J. Mellor and Marc J. Balcer (Addison-Wesley, 2002)To be designed in UMLClass models for structureState machine models for behaviorTo be implemented on the WebUsing Java/JEE…or maybe C#/.Net…or maybe LAMP…or whatever…
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Ordering: Class ModelOrder is an active class whose classifier behavior is responsible for handling ordering functionality.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Order: Classifier BehaviorA state machine abstracts system behavior into a finite number of states.The system is modeled as having discrete transitions between the states.A transition may trigger further system behavior or system behavior may be dependent on the current state.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Order Behavior: EstablishCustomer ActivityFull executability requires complete specification of behavior and computation. This is often much more easy to specify using a textual notation.An activity specifies behavior as the coordinated execution of a set of subordinate actions.Other actions provide various data and computational functions.An action in one activity may call another activity.Data and control flow between the various actions.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011The Question Is…If we are going to take the time to carefully design our system using UML, e.g.,Structural models of classes and associationsBehavioral models using state machines or operations and messagesThen why can’t we use these directly to execute our system?The answer is: We can!Just add detailed behavior…
…which is best done using a textual action language…
…which should be at the same semantic level as the rest of the model.Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML: Perceived IssuesMaking 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.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML: Issue ResolutionsMaking 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.
fUML Version 1.0 formal specification now available.Graphical modeling notations are not good for detailed programming.The Action Language for fUML (Alf) standard specifies a textual action language with fUML semantics.
Alf Version 1.0 finalization in progress.Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011B. The StandardsUnified Modeling Language (UML)Executable UML Foundation (fUML)UML Action Language (Alf)
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Unified Modeling Language (UML)	The Unified Modeling Language (UML) is a graphical language for modeling the structure, behavior and interactions of software, hardware and business systems, standardized by the Object Management Group (OMG).UML Version 1.1 (first standard) – November 1997UML Version 1.5 (with action semantics) – March 2003UML Version 2.0 – August 2005UML Version 2.3 (current standard) – May 2010UML Version 2.4 – January 2011 (beta)UML Version 2.5 (spec simplification) – August 2011 (planned)
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML Foundation (fUML)	Foundational UML (fUML) is an executable subset of standard UML that can be used to define, in an operational style, the structural and behavioral semantics of systems.OMG RFP for the Semantics of a Foundational Subset for Executable UML Models – Issued April 2005fUML Version 1.0 Beta 3 (finalized) – February 2010fUML Version 1.0 (formal) – January 2011
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Key ComponentsFoundational UML Subset (fUML) – A computationally complete subset of the abstract syntax of UML (Version 2.3)Kernel – Basic object-oriented capabilitiesCommon Behavior – General behavior and asynchronous communicationActivities – Activity modeling, including structured activities (but not including variables, exceptions, swimlanes, streaming or other “higher level” activity modeling)Execution Model – A model of the execution semantics of user models within the fUML subsetFoundational Model LibraryPrimitive Types – Boolean, String, Integer, Unlimited NaturalPrimitive Behaviors – Boolean, String and Arithmetic FunctionsBasic Input/Output – Based on the concept of “Channels”
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011UML Action Language (Alf)	The Action Language for Foundational UML (Alf) is a textual surface representation for UML modeling elements with the primary purpose of acting as the surface notation for specifying executable (fUML) behaviors within an overall graphical UML model. (But which also provides an extended notation for structural modeling within the fUML subset.)	OMG RFP for Concrete Syntax for a UML Action Language – Issued September 2008Alf Version 1.0 Beta 1 – October 2010
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Key ComponentsConcrete Syntax – A BNF specification of the legal textual syntax of the Alf language. Abstract Syntax – A MOF metamodel of the abstract syntax tree that is synthesized during parsing of an Alf text, with additional derived attributes and constraints that specify the static semantic analysis of that text.Semantics – The semantics of Alf are defined by mapping the Alf abstract syntax metamodel to the fUML abstract syntax metamodel.Standard Model LibraryFrom the fUML Foundational Model LibraryPrimitive Types (plus Natural and Bit String)Primitive Behaviors (plus Bit String Functions and Sequence Functions)Basic Input/OutputCollection Functions – Similar to OCL collection operations for sequencesCollection Classes – Set, Ordered Set, Bag, List, Queue, Deque, Map
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011II. Elements of Executable UMLActivitiesActionsStructureAsynchronous Communication
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011A. ActivitiesActivities and ParametersActions and FlowsTextual NotationTokensOffersControl NodesStructured Nodes
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Activities and ParametersAn activity is a specification of behavior as the coordinated execution of subordinate actions, using a control and data flow model.An activity may have input, output and return parameters.The parameters have corresponding activity parameter node on the boundary of the diagrammatic representation of an activity.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Actions and FlowsAn activity diagram is a graph structure consisting of activity nodes connected by activity edges.An action is a fundamental unit of executable behavior within an activity.A pin is an activity node that either accepts input to or provides output from an action.A control flow specifies the sequencing of actions.An object flow provides a path for passing objects or data.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Textual Notationactivity DoSomething(in input: Integer, out output Integer): Integer {   output = A(input);   return B();}Alf behavioral notation maps to fUML activity models.The semantics of the Alf notation is defined by its mapping to fUML
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011TokensA token is a container for an object, datum or locus of control that may be present at an activity node.The activity is invoked with an argument of 1 for its input parameter.Values on the output activity parameter nodes are copied to the output arguments.a = DoSomething(1, b);The object token flows to the output activity parameter node along the object flow.The object token flows to the input pin of action A along the object flow.Action A fires and produces an object token on its output pin.When it is done, action A produces a control token, which flows to action B along the control flow.An object token with a value of 1 is placed on the input activity parameter node.Action B accepts the control token and fires, producing an object token on its output pin.The object token flows to the output activity parameter node along the object flow.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011OffersActions with no control constraints execute concurrently. This means that they may execute in parallel – or they may execute sequentially in any order.An output pin offers its tokens to the targets of all outgoing object flows.Note: fUML semantics do not guarantee “liveliness” or “fairness” in the execution of actions competing for tokens.A single token can only flow to one target. If two competing targets are both ready to accept an offer for the same token, it is indeterminate which will get the token.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Fork and Join NodesA fork node copies the tokens it is offered, and offers a copy on each outgoing flow.A join node waits for a token to be offered on all incoming flows and then offers tokens on its outgoing flow.In the Alf textual notation, forks and joins are implicit in the parallel block notation.order = 'Create Order'();//@parallel {   'Fulfill Order'(order);   'Invoice Order'(order);}'Close Out Order'(order);Note: Alf does not actually provide any notation for competition for tokens on output pins. A fork node is always inserted for multiple flows out of any output pin.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Control NodesAn initial node generates a single control token.A control node is an activity node used to coordinate the flow of (the offers for) tokens between other nodes.A merge node passes on any tokens it receives.Note: This construction is necessary so a “card” token is available for each iteration.Note: Since the decision node “gates” control flow, it must be provided with an incoming control token.A decision node routes tokens based on a decision input value.An activity final node terminates the activity when it receives a token.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Data StoresfUML 1.1 will allow the use of data store nodes.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structured NodesAn loop node iterates the execution of its body while a condition is true.Inputs to the loop node initialize loop variables available across all iterations of the loop.A structured node is an activity node used to group subordinate nodes into a control structure.By default, the condition is tested after execution of the body.Note: There is no normative UML graphical notation for loop or conditional nodes.card = 'Select Credit Card'();do {   charge = 'Create Credit Card Charge'(card);   if ('Check Charge Approval'(charge)) {      'Notify Customer of Approval'(charge);      declined = false;   } else {      'Notify Customer of Denial'(charge);      declined = true;}} while (declined);A conditional node executes one clause or another based on the result of a test (or tests).break;Alf also provides a traditional break statement.true
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Expansion RegionsAn expansion region is used to apply subordinate actions on all members of an input collectionA parallel expansion region applies nested behavior concurrently to all collection elements.'Get Outstanding Orders'(customer) ->   select order ('Is Delinquent?'(order)) ->   iterate order ('Refer for Collection'(order));Alf provides specialized notation that maps to typical uses of expansion regions.An iterative expansion region applies nested behavior sequentially to all collection elements.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ReductionThis is shorthand for“this.lineItems->collect item (item.amount)”.this.totalAmount =     this.lineItems.amount->reduce MoneyFunctions::Add;A reduction action “inserts” a binary function between the elements of a sequence of values.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011B. ActionsInvocation ActionsObject ActionsStructural Feature ActionsLink ActionsNOTE: Some of these actions will be discussed in more detail later.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Invocation ActionsCall BehaviorCalling an activityCalling a primitive behaviorCall OperationSend SignalAccept EventPlaceOrder(customer, product)Max(throttle, limit)    count + quantityorder.addProduct(product, quantity)vehicle.EngageBrake(pressure)accept (signal: EngageBrake)
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Object ActionsValue SpecificationCreate ObjectDestroy ObjectTest IdentityRead SelfRead ExtentRead Is Classified ObjectReclassify Object1    true    "Hello"new Order()order.destroy()order == myOrder    name != customerNamethisOrder.allInstances()vehicle instanceof Car       car hastype Hatchbackreclassify order from PendingOrder to ClosedOrder
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structural Feature ActionsRead Structural FeatureAdd Structural Feature ValueRemove Structural Feature ValueClear Structural Feature Valueorder.customerorder.datePlaced = todayorder.lineItems->add(item)order.lineItems->addAt(1,item)order.lineItems->remove(item)order.lineItems->removeAt(1)order.card = null
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Link ActionsRead LinkCreate LinkDestroy LinkClear AssociationOwns.person(house=>thisHouse)    thisHouse.personOwns.addLink(person=>jack, house=>newHouse)Owns.removeLink(person=>jack, house=>oldHouse)Owns.clearAssoc(jack)
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ComputationIndexing (from 1 , not 0)Increment/DecrementArithmetic/LogicComparisonConditionalIsolationorder.lineItems[i]    order.lineItems->at(i)index++    ++counttotal + value    address & masktotal > threshold    index <= count   count != 0 && total/count > limitcount < min || count > max$this.sensor.getReading().value
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011C. StructureStructural and Behavioral ModelsClassesAssociations
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structural and Behavioral ModelsA structural model (e.g., a class model) specifies the relevant (types of) instances in a domain that may exist at any one point in time.Structural semantics define how a structural model constrains allowable instances.A behavioral model (e.g., an activity model) specifies behavior over timeBehavioral semantics define how a behavioral model changes the state of instances over time.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ClassesA class is a classifier of objects that persist in the extent of the class, with an identity that is independent of the value of their attributes at any one time.AttributesData TypesPrimitive TypesOperations and MethodsStructural SemanticsBehavioral Semantics
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes and AttributesA class may have attributes whose types are primitive, data types or other classes.A referential attribute, whose type is a class, is conventionally notated as an association with a class-owned association end.A bidirectional association results in corresponding referential attributes on both associated classes.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Data TypesA data type is a classifier of transient data values whose identity is based on the values of their attributes.Data types may have attributes, but not operations.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Primitive TypesFrom UML 2.3 Auxiliary ConstructsBooleanIntegerUnlimitedNaturalStringfUML 1.1 will:Use the new UML 2.4 PrimitiveTypes packageInclude support for the new Real type
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Operations and MethodsA method defines the actual behavior that is invoked.An operation specifies a behavior that may be synchronously invoked on an instance of a class.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Structural SemanticsStructural semantics specify how a structural model constrains allowable instances.Objects are instances of classes with values for each attribute.Class-owned association ends are structural features with values, like attributes.fUML does not actually give semantics to an association with class-owned ends, only to the ends as structural features.Note: fUML does provide “reified” semantics for associations that own their own ends, as will be discussed later.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Behavioral SemanticsBehavioral semantics specify how a behavioral model changes the state of instances over time.Creating an OrderAdding a Line ItemCanceling an Order
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Creating an OrderBeforeAfterA new object is created and the constructor operation is invoked.order = new Order (customer, today)@Createpublic Order (in customer: Customer, in datePlaced: Date) {   this.datePlaced = datePlaced;   this.totalAmount = new Money(dollars=>0, cents=>0);   this.customer = customer;   this.customer.orders->add(this);}The constructor initializes the new order’s attribute values……and adds the order to the customer’s list.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Adding a Line ItemBeforeAfterorder.addProduct (product, 2)The addProduct operation is invoked on an existing Order object.The method for the operation creates a new line item object……adds the new object to the list of line items for the order…public addProduct    (in product: Product, in quantity: Integer) {   lineItem = new LineItem(product, quantity);   this.lineItems->add(lineItem);   this.totalAmount = MoneyFunctions::Add            (this.totalAmount, lineItem.amount);}…and updates the total order amount.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Canceling an OrderBeforeAfterorder.cancel()A destructor operation is invoked, after which the order object is destroyed.Because line items are aggregated by composition, they are destroyed, too.@Destroypublic cancel() {   this.customer.orders->remove(this);}References to the destroyed object must be explicitly removed.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011AssociationsAn association is a classifier whose instances are links that relate other instances.Classes and AssociationsStructural SemanticsBehavioral Semantics
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes and AssociationsAn association (that owns its ends) is a classifier of persistent links between the associated classes, which exist in the extent of the association.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Associations: Structural SemanticsStructural semantics specify how a structural model constrains allowable instance models.Links are now semantic instances of the indicated associations.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Associations: Behavioral SemanticsBehavioral semantics specify how a behavioral model changes the state of instances over time.Creating an Order (revised)Canceling an Order (revised)
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Creating an Order (revised)BeforeAfterorder = new Order (customer, today)@Createpublic Order (in customer: Customer, in datePlaced: Date) {   this.datePlaced = datePlaced;   this.totalAmount = new Money(dollars=>0, cents=>0);   Customer_Order.addLink(customer, this);}A single action creates a bidirectional link.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Canceling an Order (revised)BeforeAfterorder.cancel()A destructor operation is invoked, after which the order object is destroyed. Links in which the destroyed object participates are now also automatically destroyed.@Destroypublic cancel() { }
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011D. Asynchronous CommunicationSignals and ReceptionsClassifier BehaviorsAsynchronous Behavior
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Signals and ReceptionsA signal is a classifier whose instances may be communicated asynchronously.A signal may have attributes that represent transmittable data. A reception is a declaration of the ability to receive a signal. More than one class can receive the same signal.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011An active class is one that has a classifier behavior. Only active class may receive signals.A classifier behavior is an autonomous behavior started when an active class is instantiated.Classifier Behaviors
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Asynchronous BehaviorThe order object creates a new credit card charge object, which begins its asynchronous behavior.The order object accepts a signal to submit a charge.Note: UML semantics require a separate action to start the behavior of a new object. However, Alf notation for creating an active class maps to both create and start object behavior actions.accept (submission: SubmitCharge);card = submission.card;do {   new CreditCardCharge(card, this);   accept (response: ChargeApproved) {      this.customer.ChargeApproved(response.charge);      break;   } or accept (response: ChargeDeclined) {      this.customer.ChargeDeclined(response.charge);   }while (true);The order object accepts a signal from the charge object that the charge is approved.The order object sends a signal to the customer that the charge is approved.
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011III. Standard Model LibraryPrimitive Behaviors
Collection Functions
Collection Classes
Basic Input/OutputCopyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Primitive BehaviorsInteger Functions – Arithmetic, Comparison, ConversionUnlimited Natural Functions – Comparison, ConversionBoolean Functions – Logical Operations, ConversionBit String Functions – Bit-wise operations, ConversionString Functions – Concatenation, Size, SubstringComing in fUML 1.1: Real Functions
Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Collection FunctionsCollection functions operate on sequences of values of any type.Testing and accessing functionsExamples: seq->isEmpty(), seq1->equals(seq2), seq->at(n)Non-mutating funtionsExamples: seq2 = seq->including(x), seq3 = seq1->union(seq2)Mutating “in place” functionsExamples: seq->add(x), seq1->addAll(seq2), seq2->remove(x)

More Related Content

What's hot (20)

PPT
DOT Net overview
chandrasekhardesireddi
 
PDF
Manipulating Android tasks and back stack
Ran Nachmany
 
PPTX
Awt, Swing, Layout managers
swapnac12
 
PPT
Uml - An Overview
Raj Thilak S
 
PPT
Adapter pattern
Shakil Ahmed
 
PPTX
Gof design patterns
Srikanth R Vaka
 
PDF
UNIFIED MODELING LANGUAGE
Raval Chirag
 
PPTX
Presentation on uml
Shruti Dalela
 
PPTX
Introduction to simulation and modeling
antim19
 
PPTX
What is Ajax technology?
JavaTpoint.Com
 
PDF
Use case diagrams
mohamed tahoon
 
PPTX
IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
Marco Brambilla
 
PPT
Design rules Human computer interaction.ppt
Sohail735908
 
PDF
Table maintenance generator and its modifications
scribid.download
 
PPT
Prototype pattern
Shakil Ahmed
 
PPTX
Lifecycle Modeling Language Tutorial by Dr. Dam and Dr. Vaneman
Elizabeth Steiner
 
PPTX
The Singleton Pattern Presentation
JAINIK PATEL
 
PPT
Asp.net architecture
Iblesoft
 
PDF
Technical Overview of CDS View – SAP HANA Part I
Ashish Saxena
 
PPTX
Animation in android
Jatin_123
 
DOT Net overview
chandrasekhardesireddi
 
Manipulating Android tasks and back stack
Ran Nachmany
 
Awt, Swing, Layout managers
swapnac12
 
Uml - An Overview
Raj Thilak S
 
Adapter pattern
Shakil Ahmed
 
Gof design patterns
Srikanth R Vaka
 
UNIFIED MODELING LANGUAGE
Raval Chirag
 
Presentation on uml
Shruti Dalela
 
Introduction to simulation and modeling
antim19
 
What is Ajax technology?
JavaTpoint.Com
 
Use case diagrams
mohamed tahoon
 
IFML - Interaction Flow Modeling Language - tutorial on UI and UX modeling &...
Marco Brambilla
 
Design rules Human computer interaction.ppt
Sohail735908
 
Table maintenance generator and its modifications
scribid.download
 
Prototype pattern
Shakil Ahmed
 
Lifecycle Modeling Language Tutorial by Dr. Dam and Dr. Vaneman
Elizabeth Steiner
 
The Singleton Pattern Presentation
JAINIK PATEL
 
Asp.net architecture
Iblesoft
 
Technical Overview of CDS View – SAP HANA Part I
Ashish Saxena
 
Animation in android
Jatin_123
 

Viewers also liked (20)

PDF
Model-Driven Software Engineering in Practice - Chapter 6 - Modeling Language...
Jordi Cabot
 
PPTX
OCL tutorial
Jordi Cabot
 
PPTX
Is your company fully engaged towards innovation?
Sebastien Juras
 
PDF
Software Engineering :UML class diagrams
Ajit Nayak
 
PPTX
INNOVATION IS NOT AN OPTION
Sebastien Juras
 
PPT
Uml Omg Fundamental Certification 3
Ricardo Quintero
 
PPTX
01 conceptos de diseño
Ricardo Quintero
 
PDF
Parallel programming using MPI
Ajit Nayak
 
PDF
Computer Fundamentals & Intro to C Programming module i
Ajit Nayak
 
PDF
Database Programming using SQL
Ajit Nayak
 
PPT
Uml Omg Fundamental Certification 1
Ricardo Quintero
 
PDF
Ns2: Introduction - Part I
Ajit Nayak
 
PPTX
Misiones en Honduras Mayo 2012
Ricardo Quintero
 
PPTX
One thing you can do to increase your charisma
Sebastien Juras
 
PPTX
I BELIEVE I CAN FLY
Sebastien Juras
 
PPTX
Enterprise Architecture for Dummies
Sebastien Juras
 
PDF
Software Engineering : Process Models
Ajit Nayak
 
PPTX
The Humming-bird’s share
Sebastien Juras
 
PDF
Ns2: OTCL - PArt II
Ajit Nayak
 
PDF
Object Oriented Analysis Design using UML
Ajit Nayak
 
Model-Driven Software Engineering in Practice - Chapter 6 - Modeling Language...
Jordi Cabot
 
OCL tutorial
Jordi Cabot
 
Is your company fully engaged towards innovation?
Sebastien Juras
 
Software Engineering :UML class diagrams
Ajit Nayak
 
INNOVATION IS NOT AN OPTION
Sebastien Juras
 
Uml Omg Fundamental Certification 3
Ricardo Quintero
 
01 conceptos de diseño
Ricardo Quintero
 
Parallel programming using MPI
Ajit Nayak
 
Computer Fundamentals & Intro to C Programming module i
Ajit Nayak
 
Database Programming using SQL
Ajit Nayak
 
Uml Omg Fundamental Certification 1
Ricardo Quintero
 
Ns2: Introduction - Part I
Ajit Nayak
 
Misiones en Honduras Mayo 2012
Ricardo Quintero
 
One thing you can do to increase your charisma
Sebastien Juras
 
I BELIEVE I CAN FLY
Sebastien Juras
 
Enterprise Architecture for Dummies
Sebastien Juras
 
Software Engineering : Process Models
Ajit Nayak
 
The Humming-bird’s share
Sebastien Juras
 
Ns2: OTCL - PArt II
Ajit Nayak
 
Object Oriented Analysis Design using UML
Ajit Nayak
 
Ad

Similar to Programming in UML: An Introduction to fUML and Alf (20)

PPTX
UML: Once More with Meaning
Ed Seidewitz
 
PPT
Programming in UML: An Introduction to fUML 1.3 and Alf 1.1
Ed Seidewitz
 
PPSX
UML: This Time We Mean It!
Ed Seidewitz
 
PPTX
06-unit-iintrouml25sep2015-160901172758.pptx
Sindhu Mani
 
PDF
Unit 2 - Unified Modeling Language (UML).pdf
sixokak391
 
PPTX
Ch 2.1
mahammed rashid
 
PPT
Introduction To Uml
guest514814
 
PPTX
UML Modeling and Profiling Lab - Advanced Software Engineering Course 2014/2015
Luca Berardinelli
 
PPT
Uml introduciton
Dr. C.V. Suresh Babu
 
PPT
Uml(unified modeling language) Homework Help
Steve Nash
 
PDF
l1_introuml.pdf
KalsoomTahir2
 
PPT
Apostila UML
landergustavo
 
PPTX
Introduction to Unified Modeling Language
AMITJain879
 
PDF
18540PhDreport.pdf
TaraTrends
 
PPT
Executable UML – UML2
elliando dias
 
PPT
Object Process Methodology
guest77b0cd12
 
PPTX
Unified Modeling Language
surana college
 
PPTX
Unified Modeling Language
Khushboo Wadhwani
 
PPT
M05 Metamodel
Dang Tuan
 
UML: Once More with Meaning
Ed Seidewitz
 
Programming in UML: An Introduction to fUML 1.3 and Alf 1.1
Ed Seidewitz
 
UML: This Time We Mean It!
Ed Seidewitz
 
06-unit-iintrouml25sep2015-160901172758.pptx
Sindhu Mani
 
Unit 2 - Unified Modeling Language (UML).pdf
sixokak391
 
Introduction To Uml
guest514814
 
UML Modeling and Profiling Lab - Advanced Software Engineering Course 2014/2015
Luca Berardinelli
 
Uml introduciton
Dr. C.V. Suresh Babu
 
Uml(unified modeling language) Homework Help
Steve Nash
 
l1_introuml.pdf
KalsoomTahir2
 
Apostila UML
landergustavo
 
Introduction to Unified Modeling Language
AMITJain879
 
18540PhDreport.pdf
TaraTrends
 
Executable UML – UML2
elliando dias
 
Object Process Methodology
guest77b0cd12
 
Unified Modeling Language
surana college
 
Unified Modeling Language
Khushboo Wadhwani
 
M05 Metamodel
Dang Tuan
 
Ad

More from Ed Seidewitz (18)

PPTX
SysML v2 - What's the big deal, anyway?
Ed Seidewitz
 
PPTX
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Ed Seidewitz
 
PPTX
The Very Model of a Modern Metamodeler
Ed Seidewitz
 
PPTX
SysML v2 and the Next Generation of Modeling Languages
Ed Seidewitz
 
PPTX
SysML v2 and MBSE: The next ten years
Ed Seidewitz
 
PPTX
Precise Semantics Standards at OMG: Executing on the Vision
Ed Seidewitz
 
PPTX
Model Driven Architecture without Automation
Ed Seidewitz
 
PPTX
Hands On With the Alf Action Language: Making Executable Modeling Even Easier
Ed Seidewitz
 
PPTX
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
Ed Seidewitz
 
PPT
A Unified View of Modeling and Programming
Ed Seidewitz
 
PPTX
UML as a Programming Language
Ed Seidewitz
 
PPTX
Executable UML Roadmap (as of September 2014)
Ed Seidewitz
 
PPTX
Essence: A Common Ground for Flexible Methods
Ed Seidewitz
 
PPSX
Succeeding with Agile in the Federal Government: A Coach's Perspective
Ed Seidewitz
 
PPTX
UML 2.5: Specification Simplification
Ed Seidewitz
 
PPT
Models, Programs and Executable UML
Ed Seidewitz
 
PPT
Architecting Your Enterprise
Ed Seidewitz
 
PPT
Programming in UML: Why and How
Ed Seidewitz
 
SysML v2 - What's the big deal, anyway?
Ed Seidewitz
 
Introduction to the OMG Systems Modeling Language (SysML), Version 2
Ed Seidewitz
 
The Very Model of a Modern Metamodeler
Ed Seidewitz
 
SysML v2 and the Next Generation of Modeling Languages
Ed Seidewitz
 
SysML v2 and MBSE: The next ten years
Ed Seidewitz
 
Precise Semantics Standards at OMG: Executing on the Vision
Ed Seidewitz
 
Model Driven Architecture without Automation
Ed Seidewitz
 
Hands On With the Alf Action Language: Making Executable Modeling Even Easier
Ed Seidewitz
 
Standards-Based Executable UML: Today's Reality and Tomorrow's Promise
Ed Seidewitz
 
A Unified View of Modeling and Programming
Ed Seidewitz
 
UML as a Programming Language
Ed Seidewitz
 
Executable UML Roadmap (as of September 2014)
Ed Seidewitz
 
Essence: A Common Ground for Flexible Methods
Ed Seidewitz
 
Succeeding with Agile in the Federal Government: A Coach's Perspective
Ed Seidewitz
 
UML 2.5: Specification Simplification
Ed Seidewitz
 
Models, Programs and Executable UML
Ed Seidewitz
 
Architecting Your Enterprise
Ed Seidewitz
 
Programming in UML: Why and How
Ed Seidewitz
 

Recently uploaded (20)

PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Mobile CMMS Solutions Empowering the Frontline Workforce
CryotosCMMSSoftware
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Executive Business Intelligence Dashboards
vandeslie24
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 

Programming in UML: An Introduction to fUML and Alf

  • 1. 22 March 2011Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)Programming in UML:An Introduction to fUML and AlfTutorial for the OMG Executable UML Information DayPresented by Ed Seidewitz
  • 2. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011AgendaIntroductionElements of Executable UMLStandard Model Library
  • 3. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011I. IntroductionA Motivating ExampleProgramming in UMLThe Standards
  • 4. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011A. A Motivating ExampleE-Commerce Ordering SystemLoosely based on the Online Bookstore Domain Case Study given in Appendix B of the book Executable UML: A Foundation for Model Driven Architecture by Stephen J. Mellor and Marc J. Balcer (Addison-Wesley, 2002)To be designed in UMLClass models for structureState machine models for behaviorTo be implemented on the WebUsing Java/JEE…or maybe C#/.Net…or maybe LAMP…or whatever…
  • 5. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Ordering: Class ModelOrder is an active class whose classifier behavior is responsible for handling ordering functionality.
  • 6. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Order: Classifier BehaviorA state machine abstracts system behavior into a finite number of states.The system is modeled as having discrete transitions between the states.A transition may trigger further system behavior or system behavior may be dependent on the current state.
  • 7. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Order Behavior: EstablishCustomer ActivityFull executability requires complete specification of behavior and computation. This is often much more easy to specify using a textual notation.An activity specifies behavior as the coordinated execution of a set of subordinate actions.Other actions provide various data and computational functions.An action in one activity may call another activity.Data and control flow between the various actions.
  • 8. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011The Question Is…If we are going to take the time to carefully design our system using UML, e.g.,Structural models of classes and associationsBehavioral models using state machines or operations and messagesThen why can’t we use these directly to execute our system?The answer is: We can!Just add detailed behavior…
  • 9. …which is best done using a textual action language…
  • 10. …which should be at the same semantic level as the rest of the model.Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML: Perceived IssuesMaking 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.
  • 11. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML: Issue ResolutionsMaking models detailed enough for machine execution defeats the purpose of models for human communication.Executable models can still be more understandable than executable code.
  • 12. 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.
  • 13. fUML Version 1.0 formal specification now available.Graphical modeling notations are not good for detailed programming.The Action Language for fUML (Alf) standard specifies a textual action language with fUML semantics.
  • 14. Alf Version 1.0 finalization in progress.Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011B. The StandardsUnified Modeling Language (UML)Executable UML Foundation (fUML)UML Action Language (Alf)
  • 15. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Unified Modeling Language (UML) The Unified Modeling Language (UML) is a graphical language for modeling the structure, behavior and interactions of software, hardware and business systems, standardized by the Object Management Group (OMG).UML Version 1.1 (first standard) – November 1997UML Version 1.5 (with action semantics) – March 2003UML Version 2.0 – August 2005UML Version 2.3 (current standard) – May 2010UML Version 2.4 – January 2011 (beta)UML Version 2.5 (spec simplification) – August 2011 (planned)
  • 16. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Executable UML Foundation (fUML) Foundational UML (fUML) is an executable subset of standard UML that can be used to define, in an operational style, the structural and behavioral semantics of systems.OMG RFP for the Semantics of a Foundational Subset for Executable UML Models – Issued April 2005fUML Version 1.0 Beta 3 (finalized) – February 2010fUML Version 1.0 (formal) – January 2011
  • 17. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Key ComponentsFoundational UML Subset (fUML) – A computationally complete subset of the abstract syntax of UML (Version 2.3)Kernel – Basic object-oriented capabilitiesCommon Behavior – General behavior and asynchronous communicationActivities – Activity modeling, including structured activities (but not including variables, exceptions, swimlanes, streaming or other “higher level” activity modeling)Execution Model – A model of the execution semantics of user models within the fUML subsetFoundational Model LibraryPrimitive Types – Boolean, String, Integer, Unlimited NaturalPrimitive Behaviors – Boolean, String and Arithmetic FunctionsBasic Input/Output – Based on the concept of “Channels”
  • 18. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011UML Action Language (Alf) The Action Language for Foundational UML (Alf) is a textual surface representation for UML modeling elements with the primary purpose of acting as the surface notation for specifying executable (fUML) behaviors within an overall graphical UML model. (But which also provides an extended notation for structural modeling within the fUML subset.) OMG RFP for Concrete Syntax for a UML Action Language – Issued September 2008Alf Version 1.0 Beta 1 – October 2010
  • 19. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Key ComponentsConcrete Syntax – A BNF specification of the legal textual syntax of the Alf language. Abstract Syntax – A MOF metamodel of the abstract syntax tree that is synthesized during parsing of an Alf text, with additional derived attributes and constraints that specify the static semantic analysis of that text.Semantics – The semantics of Alf are defined by mapping the Alf abstract syntax metamodel to the fUML abstract syntax metamodel.Standard Model LibraryFrom the fUML Foundational Model LibraryPrimitive Types (plus Natural and Bit String)Primitive Behaviors (plus Bit String Functions and Sequence Functions)Basic Input/OutputCollection Functions – Similar to OCL collection operations for sequencesCollection Classes – Set, Ordered Set, Bag, List, Queue, Deque, Map
  • 20. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011II. Elements of Executable UMLActivitiesActionsStructureAsynchronous Communication
  • 21. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011A. ActivitiesActivities and ParametersActions and FlowsTextual NotationTokensOffersControl NodesStructured Nodes
  • 22. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Activities and ParametersAn activity is a specification of behavior as the coordinated execution of subordinate actions, using a control and data flow model.An activity may have input, output and return parameters.The parameters have corresponding activity parameter node on the boundary of the diagrammatic representation of an activity.
  • 23. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Actions and FlowsAn activity diagram is a graph structure consisting of activity nodes connected by activity edges.An action is a fundamental unit of executable behavior within an activity.A pin is an activity node that either accepts input to or provides output from an action.A control flow specifies the sequencing of actions.An object flow provides a path for passing objects or data.
  • 24. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Textual Notationactivity DoSomething(in input: Integer, out output Integer): Integer { output = A(input); return B();}Alf behavioral notation maps to fUML activity models.The semantics of the Alf notation is defined by its mapping to fUML
  • 25. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011TokensA token is a container for an object, datum or locus of control that may be present at an activity node.The activity is invoked with an argument of 1 for its input parameter.Values on the output activity parameter nodes are copied to the output arguments.a = DoSomething(1, b);The object token flows to the output activity parameter node along the object flow.The object token flows to the input pin of action A along the object flow.Action A fires and produces an object token on its output pin.When it is done, action A produces a control token, which flows to action B along the control flow.An object token with a value of 1 is placed on the input activity parameter node.Action B accepts the control token and fires, producing an object token on its output pin.The object token flows to the output activity parameter node along the object flow.
  • 26. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011OffersActions with no control constraints execute concurrently. This means that they may execute in parallel – or they may execute sequentially in any order.An output pin offers its tokens to the targets of all outgoing object flows.Note: fUML semantics do not guarantee “liveliness” or “fairness” in the execution of actions competing for tokens.A single token can only flow to one target. If two competing targets are both ready to accept an offer for the same token, it is indeterminate which will get the token.
  • 27. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Fork and Join NodesA fork node copies the tokens it is offered, and offers a copy on each outgoing flow.A join node waits for a token to be offered on all incoming flows and then offers tokens on its outgoing flow.In the Alf textual notation, forks and joins are implicit in the parallel block notation.order = 'Create Order'();//@parallel { 'Fulfill Order'(order); 'Invoice Order'(order);}'Close Out Order'(order);Note: Alf does not actually provide any notation for competition for tokens on output pins. A fork node is always inserted for multiple flows out of any output pin.
  • 28. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Control NodesAn initial node generates a single control token.A control node is an activity node used to coordinate the flow of (the offers for) tokens between other nodes.A merge node passes on any tokens it receives.Note: This construction is necessary so a “card” token is available for each iteration.Note: Since the decision node “gates” control flow, it must be provided with an incoming control token.A decision node routes tokens based on a decision input value.An activity final node terminates the activity when it receives a token.
  • 29. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Data StoresfUML 1.1 will allow the use of data store nodes.
  • 30. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structured NodesAn loop node iterates the execution of its body while a condition is true.Inputs to the loop node initialize loop variables available across all iterations of the loop.A structured node is an activity node used to group subordinate nodes into a control structure.By default, the condition is tested after execution of the body.Note: There is no normative UML graphical notation for loop or conditional nodes.card = 'Select Credit Card'();do { charge = 'Create Credit Card Charge'(card); if ('Check Charge Approval'(charge)) { 'Notify Customer of Approval'(charge); declined = false; } else { 'Notify Customer of Denial'(charge); declined = true;}} while (declined);A conditional node executes one clause or another based on the result of a test (or tests).break;Alf also provides a traditional break statement.true
  • 31. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Expansion RegionsAn expansion region is used to apply subordinate actions on all members of an input collectionA parallel expansion region applies nested behavior concurrently to all collection elements.'Get Outstanding Orders'(customer) -> select order ('Is Delinquent?'(order)) -> iterate order ('Refer for Collection'(order));Alf provides specialized notation that maps to typical uses of expansion regions.An iterative expansion region applies nested behavior sequentially to all collection elements.
  • 32. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ReductionThis is shorthand for“this.lineItems->collect item (item.amount)”.this.totalAmount = this.lineItems.amount->reduce MoneyFunctions::Add;A reduction action “inserts” a binary function between the elements of a sequence of values.
  • 33. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011B. ActionsInvocation ActionsObject ActionsStructural Feature ActionsLink ActionsNOTE: Some of these actions will be discussed in more detail later.
  • 34. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Invocation ActionsCall BehaviorCalling an activityCalling a primitive behaviorCall OperationSend SignalAccept EventPlaceOrder(customer, product)Max(throttle, limit) count + quantityorder.addProduct(product, quantity)vehicle.EngageBrake(pressure)accept (signal: EngageBrake)
  • 35. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Object ActionsValue SpecificationCreate ObjectDestroy ObjectTest IdentityRead SelfRead ExtentRead Is Classified ObjectReclassify Object1 true "Hello"new Order()order.destroy()order == myOrder name != customerNamethisOrder.allInstances()vehicle instanceof Car car hastype Hatchbackreclassify order from PendingOrder to ClosedOrder
  • 36. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structural Feature ActionsRead Structural FeatureAdd Structural Feature ValueRemove Structural Feature ValueClear Structural Feature Valueorder.customerorder.datePlaced = todayorder.lineItems->add(item)order.lineItems->addAt(1,item)order.lineItems->remove(item)order.lineItems->removeAt(1)order.card = null
  • 37. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Link ActionsRead LinkCreate LinkDestroy LinkClear AssociationOwns.person(house=>thisHouse) thisHouse.personOwns.addLink(person=>jack, house=>newHouse)Owns.removeLink(person=>jack, house=>oldHouse)Owns.clearAssoc(jack)
  • 38. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ComputationIndexing (from 1 , not 0)Increment/DecrementArithmetic/LogicComparisonConditionalIsolationorder.lineItems[i] order.lineItems->at(i)index++ ++counttotal + value address & masktotal > threshold index <= count count != 0 && total/count > limitcount < min || count > max$this.sensor.getReading().value
  • 39. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011C. StructureStructural and Behavioral ModelsClassesAssociations
  • 40. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Structural and Behavioral ModelsA structural model (e.g., a class model) specifies the relevant (types of) instances in a domain that may exist at any one point in time.Structural semantics define how a structural model constrains allowable instances.A behavioral model (e.g., an activity model) specifies behavior over timeBehavioral semantics define how a behavioral model changes the state of instances over time.
  • 41. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ClassesA class is a classifier of objects that persist in the extent of the class, with an identity that is independent of the value of their attributes at any one time.AttributesData TypesPrimitive TypesOperations and MethodsStructural SemanticsBehavioral Semantics
  • 42. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes and AttributesA class may have attributes whose types are primitive, data types or other classes.A referential attribute, whose type is a class, is conventionally notated as an association with a class-owned association end.A bidirectional association results in corresponding referential attributes on both associated classes.
  • 43. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Data TypesA data type is a classifier of transient data values whose identity is based on the values of their attributes.Data types may have attributes, but not operations.
  • 44. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Primitive TypesFrom UML 2.3 Auxiliary ConstructsBooleanIntegerUnlimitedNaturalStringfUML 1.1 will:Use the new UML 2.4 PrimitiveTypes packageInclude support for the new Real type
  • 45. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Operations and MethodsA method defines the actual behavior that is invoked.An operation specifies a behavior that may be synchronously invoked on an instance of a class.
  • 46. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Structural SemanticsStructural semantics specify how a structural model constrains allowable instances.Objects are instances of classes with values for each attribute.Class-owned association ends are structural features with values, like attributes.fUML does not actually give semantics to an association with class-owned ends, only to the ends as structural features.Note: fUML does provide “reified” semantics for associations that own their own ends, as will be discussed later.
  • 47. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes: Behavioral SemanticsBehavioral semantics specify how a behavioral model changes the state of instances over time.Creating an OrderAdding a Line ItemCanceling an Order
  • 48. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Creating an OrderBeforeAfterA new object is created and the constructor operation is invoked.order = new Order (customer, today)@Createpublic Order (in customer: Customer, in datePlaced: Date) { this.datePlaced = datePlaced; this.totalAmount = new Money(dollars=>0, cents=>0); this.customer = customer; this.customer.orders->add(this);}The constructor initializes the new order’s attribute values……and adds the order to the customer’s list.
  • 49. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Adding a Line ItemBeforeAfterorder.addProduct (product, 2)The addProduct operation is invoked on an existing Order object.The method for the operation creates a new line item object……adds the new object to the list of line items for the order…public addProduct (in product: Product, in quantity: Integer) { lineItem = new LineItem(product, quantity); this.lineItems->add(lineItem); this.totalAmount = MoneyFunctions::Add (this.totalAmount, lineItem.amount);}…and updates the total order amount.
  • 50. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Canceling an OrderBeforeAfterorder.cancel()A destructor operation is invoked, after which the order object is destroyed.Because line items are aggregated by composition, they are destroyed, too.@Destroypublic cancel() { this.customer.orders->remove(this);}References to the destroyed object must be explicitly removed.
  • 51. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011AssociationsAn association is a classifier whose instances are links that relate other instances.Classes and AssociationsStructural SemanticsBehavioral Semantics
  • 52. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Classes and AssociationsAn association (that owns its ends) is a classifier of persistent links between the associated classes, which exist in the extent of the association.
  • 53. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Associations: Structural SemanticsStructural semantics specify how a structural model constrains allowable instance models.Links are now semantic instances of the indicated associations.
  • 54. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Associations: Behavioral SemanticsBehavioral semantics specify how a behavioral model changes the state of instances over time.Creating an Order (revised)Canceling an Order (revised)
  • 55. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Creating an Order (revised)BeforeAfterorder = new Order (customer, today)@Createpublic Order (in customer: Customer, in datePlaced: Date) { this.datePlaced = datePlaced; this.totalAmount = new Money(dollars=>0, cents=>0); Customer_Order.addLink(customer, this);}A single action creates a bidirectional link.
  • 56. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Canceling an Order (revised)BeforeAfterorder.cancel()A destructor operation is invoked, after which the order object is destroyed. Links in which the destroyed object participates are now also automatically destroyed.@Destroypublic cancel() { }
  • 57. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011D. Asynchronous CommunicationSignals and ReceptionsClassifier BehaviorsAsynchronous Behavior
  • 58. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Signals and ReceptionsA signal is a classifier whose instances may be communicated asynchronously.A signal may have attributes that represent transmittable data. A reception is a declaration of the ability to receive a signal. More than one class can receive the same signal.
  • 59. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011An active class is one that has a classifier behavior. Only active class may receive signals.A classifier behavior is an autonomous behavior started when an active class is instantiated.Classifier Behaviors
  • 60. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Asynchronous BehaviorThe order object creates a new credit card charge object, which begins its asynchronous behavior.The order object accepts a signal to submit a charge.Note: UML semantics require a separate action to start the behavior of a new object. However, Alf notation for creating an active class maps to both create and start object behavior actions.accept (submission: SubmitCharge);card = submission.card;do { new CreditCardCharge(card, this); accept (response: ChargeApproved) { this.customer.ChargeApproved(response.charge); break; } or accept (response: ChargeDeclined) { this.customer.ChargeDeclined(response.charge); }while (true);The order object accepts a signal from the charge object that the charge is approved.The order object sends a signal to the customer that the charge is approved.
  • 61. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011III. Standard Model LibraryPrimitive Behaviors
  • 64. Basic Input/OutputCopyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Primitive BehaviorsInteger Functions – Arithmetic, Comparison, ConversionUnlimited Natural Functions – Comparison, ConversionBoolean Functions – Logical Operations, ConversionBit String Functions – Bit-wise operations, ConversionString Functions – Concatenation, Size, SubstringComing in fUML 1.1: Real Functions
  • 65. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Collection FunctionsCollection functions operate on sequences of values of any type.Testing and accessing functionsExamples: seq->isEmpty(), seq1->equals(seq2), seq->at(n)Non-mutating funtionsExamples: seq2 = seq->including(x), seq3 = seq1->union(seq2)Mutating “in place” functionsExamples: seq->add(x), seq1->addAll(seq2), seq2->remove(x)
  • 66. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Collection ClassesCollection classes define objects that represent collections of values of a given type.
  • 67. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Basic Input Output: Channels
  • 68. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Basic Input Output: Reading and Writing Linesactivity ReadLine (out errorStatus: Status[0..1]): String { return StandardIntputChannel.allInstances().readLine(status);}activity WriteLine (in value: String, out errorStatus: Status[0..1]) { StandardOutputChannel.allInstances().writeLine(result, status);}
  • 69. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011Hello Worldactivity Hello() { WriteLine("Hello World!");}
  • 70. Copyright © 2011 Data Access Technologies, Inc.(Model Driven Solutions)22 March 2011ReferencesFoundational UML (fUML)Semantics of a Foundational Subset for Executable UML Models standard,http://www.omg.org/spec/FUML/CurrentfUML Open Source (Reference) Implementation Project, http://www.modeldriven.org/fumlAction Language for fUML (Alf)Action Language for Foundational UML (Alf) standard, http://www.omg.org/spec/ALF/CurrentAlf Open Source (Reference) Implementation Repository, http://lib.modeldriven.org/MDLibrary/trunk/Applications/Alf-Reference-Implementation/dist – Full parser for the current version of the specificationFull implementation in progressContactEmail: [email protected]: @seidewitz or http://twitter.com/seidewitz