90 likes | 184 Views
Interchangability in software design notation: programs <-> models visual <-> textual. Oct 2010 Timothy C. Lethbridge Andrew Forward, Omar Badreddin University of Ottawa. A fundamental shift is coming . Modeling will merge with programming We will look at two approaches
E N D
Interchangability in software design notation:programs <-> models visual <-> textual Oct 2010 Timothy C. Lethbridge Andrew Forward, Omar Badreddin University of Ottawa
A fundamental shift is coming • Modeling will merge with programming • We will look at two approaches • Alf, the latest OMG draft standard • Umple, my research group’s work • Programming is textual • But in future model diagrams will co-exist with textual descriptions of the model • Both can be edited • Edits to diagram instantly reflected in text • Edits to text instantly reflected in diagram
Alf • A complete new language • Loosely follows C-family syntax • Implements fUML (a UML subset) • Incorporates ideas from OCL too • Class and activity diagrams • No state diagram concepts yet • http://www.omg.org/spec/ALF/
Classes in Alf abstract class Selection { // Abstract class public abstract getSelectionValue(): Money; // Abstract operation definition } class ProductSelection // Concrete subclass specializes Selection { private quantity: Count; // Attribute definition private unitPriceOfSelection: Money; public select // Operation stub declaration (in cart: Cart, in product: Product, in quantity: Count); public getQuantity(): Count { // Concrete operation definition return self.quantity; }
Associations in Alf assoc IsSupervisedBy { public supervisor: Professor[0..2]; public supervisee: Student [*]; { • Ternary associations possible
Activities in Alf activity Order_Behavior() { accept (checkout: Checkout); this.establishCustomer(checkout); do { accept (chargeSubmission: SubmitCharge); this.processCharge(chargeSubmission); accept (PaymentDeclined) { declined = true; this.declineCharge(); } or accept (PaymentApproved) { declined = false; } } while (declined); this.packAndShip(); accept (OrderDelivery); this.notifyOfDelivery(); }
Other tidbits about Alf • Lots of alternative ways to do things • let interest : CurrencyAmount = this.principal * this.rate * period; • Or • CurrencyAmount interest = this.principal * this.rate * period; • Reclassification • classify monitor from InActiveMonitor to ActiveMonitor • Directives in comments • //@parallel • Active classes run as independent threads • Can accept signals
UmpleUML Programming Language / Ample • Model-oriented programming • Adds UML abstractions to any OO language • Class and state diagrams • Removes boilerplate code • Allows simultaneous textual and diagrammatic modeling • Eliminates round-tripping • Don’t edit generated code, just embed your custom code
UmplificationConverting to Umple / Amplification • Incremental reverse engineering • Performed on many systems including Umple itself • Results in simpler and more robust systems • 90% reduction in CRUD code • Any Java, PHP, Ruby program can currently be umplified • Other languages coming … • http://cruise.site.uottawa.ca/umpleonline/