90 likes | 104 Views
UML to Code. by Brian Lawler Brian.Lawler@JHU.edu. <<Component>> MyComponent. <<Interface>> FirstInterface. void OperationA () int OperationB () float OperationC (int input). void OperationA () int OperationB (). <<Interface>> SecondInterface. Class Structure and Interfaces to Code.
E N D
UML to Code by Brian Lawler Brian.Lawler@JHU.edu
<<Component>>MyComponent <<Interface>>FirstInterface void OperationA ()int OperationB ()float OperationC (int input) void OperationA ()int OperationB () <<Interface>>SecondInterface Class Structure and Interfaces to Code Interface FirstInterface { void OperationA(); int OperationB(); } Interface SecondInterface { float OperationC(int input); } Class MyComponent implements FirstInterface, SecondInterface { void OperationA () { // Implementation ... } int OperationB () { // Implementation ... return someInt; } float OperationC (int input) { // Implementation ... return someFloat; } } float OperationC (int input) Brian.Lawler@JHU.edu
Checkout Session ... Add (Code : int, Number of Items Purchased : int ) :Price... Classes Operations to Code Class CheckoutSession { ... Price Add (int Code, int NumberOfItemsPurchased) { // Implementation ... return aPrice; } ... } Note: Order of variable and variable type. Collapse of spaces in names. Brian.Lawler@JHU.edu
Network B: H: G: E: D: C: G: F: H: A: B: C: F: D: E: A: Time Model Scale Down to Code C: OpA () : int OpD ( int OpA () { ... return i; } OpA () :int Op () : void Op () : void Brian.Lawler@JHU.edu
Code to Multiple Languages <<Entity>>Transaction <<Component>>Transaction {type=SQL} <<Component>>Transaction {type=Java} <<Component>>Transaction {type=XML} <<Component>>Transaction {type=C++} Brian.Lawler@JHU.edu
State Diagrams to Code SystemPackage::ProjectPackage::PersonClass Hired Fired Un-Employed Employed Hired Retired Note: See UML User Guide for example. Brian.Lawler@JHU.edu
Sequence Diagrams to Code Note: See UML Distilled for example. Brian.Lawler@JHU.edu
Constraints and OCL to Code Brian.Lawler@JHU.edu
Tools with Forward/Reverse Engineering • IBM Rational Software Architect™ • IBM Rational Rose™ • Borland Together™ • Telelogic System Architect (?) • Altova UModel • Visio Enterprise/2007 • BlueJ – www.BlueJ.org • See also: • http://uml-directory.omg.org/ • http://del.icio.us/brianlawler/UML+Tools Brian.Lawler@JHU.edu