actor, use-case diagram, use-case text, classes Kristian Sandahl, IDA krisa@ida.liu.se Text Process part Start with use-cases, identify classes in the text, ... Set of heuristics Only model normal behaviour, keep diagrams simple Result is the design model has three components: Representation part (notation part) A Software Design Method: Use-case modelling Kristian Sandahl, IDA krisa@ida.liu.se (anticipatory design) Kristian Sandahl, IDA krisa@ida.liu.se anticipate further developments in the design do it (eager design) Iterative Software development methods such as Extreme Programming Kristian Sandahl, IDA krisa@ida.liu.se divide (divide): problems into sub problems conquer: solve sub problems (hopefully easier) compose (merge): compose the complete solution from the sub solutions Scheme Divide et impera (from Alexander the Great) defer it (lazy design) The Divide and Conquer Strategy Kristian Sandahl, IDA krisa@ida.liu.se In case of a difficult design decision Lazy or Eager Design Kristian Sandahl, IDA krisa@ida.liu.se set of notations in (informal) textual, (semi-formal) diagrammatic, or mathematic (formal) form Process part Design strategy Set of heuristics rules of thumb, adaptation rules Result is the design model (design specification, SD) has three components: Representation part (notation part) Produces the Software Design document SD Groups into conceptual design/architecture: tells the WHAT of the system technical design: Tells the HOW Groups into architectural design (coarse grain design) detailed design (module design, low level design) Is integrational documents Starts from the requirements specification (SRS) and "The Design (Process) is the creative process of transforming the problem into a solution" [Pfleeger] "Design produces a workable solution to a given problem" [Budgen] "Design is the description of a solution" [Pfleeger] A Software Design Method The Ideal Design Process The Ideal Design Process 1 Responsible 1 Kristian 2 Jens 3 Calle Priority Description 2 book ticket 1 pay ticket 1 print ticket 4. while not(sorted) ..... 3. quickSort(sheet, rows, 3, num) Kristian Sandahl, IDA krisa@ida.liu.se 2. Sort Rows according to Column3 numerically 1. Sort Requirements according to Priority Requirement Information hiding example krisa@ida.liu.se Source: Source:Uwe UweAßmann Aßmann Kristian Sandahl, IDA A small number of items never use more than 5 items KISS (keep it simple stupid) remove all superfluous things, make it fit on 1 page Separation of concerns different concepts should be separated out Use hierarchies! trees, trees, trees Important Concepts Kristian Sandahl, IDA krisa@ida.liu.se Kristian Sandahl, IDA krisa@ida.liu.se Understanding, at best exposes high-level constraints of the system Reuse, of components and high-level patterns, there are frameworks to buy collection of interacting components Roles of architecture: Kristian Sandahl, IDA krisa@ida.liu.se Roles of architecture (cont’d): Construction, a partial blueprint including major interfaces of the system Evolution, ”the load-bearing walls” can be depicted, cost of change estimated Analysis, consistency checing and conformance analysis of the system Management, a key milestone, leads to implementation strategies Kristian Sandahl, IDA krisa@ida.liu.se Concurrent design Better module replacability Better software understanding Hide design decisions within in a module The overall organisation of the system as a class method method method class method method method Software architecture few many Parnas’ information hiding principle Software architecture class method method method class method method method Coupling and cohesion 2 •handling exceptions •selecting algorithm •measuring variables •selecting variables Needs caution when: Example: Air Condition Good separation of concerns. The controller maintains a set point for a variable by changing input to a process. A software realisation of an independent control system. Process control •Supports incremental testing •Supports incremental approach •Modifications can be performed locally on one layer •Implements information hiding Advantages: The design prescribes rules and protocols for communication between layers. Each layer provides service to the adjacent outside layer, and acts as a client to the adjacent inside layer. Layering Kristian Sandahl, IDA krisa@ida.liu.se Kristian Sandahl, IDA krisa@ida.liu.se •Potential performance problems •Not always obvious how to define layers Disadvantages: Kristian Sandahl, IDA krisa@ida.liu.se Processing To Need Data Seem All People Kristian Sandahl, IDA krisa@ida.liu.se Generalisation of hierarchical composition Decomposes the problem in independent units Relations between objects are well depicted Encapsulation support top-down design and replacability Polymorphism reduced function complexity Correspondence with object-oriented ananlysis and classes in Java, C++, C#, ... Object-oriented design Example: ISO OSI model Source: Source:Ericsson Ericsson •Easy to change knowledge sources •Supports incremental development Advantages: Example: Military intelligence system A development of database repository architecture. Knowledge sources post data in a common repository. The respository processes shared data and can invokate processes in knowledge sources Blackboard •Facilitates use of formal specification •Allows more complex architectures concurrency, matrices •Supports simulation •Evolution is supported •Reuse of filters supported •Good system understanding Advantages: Examle: Unix shell commands a > b > c ... Processes streams of data in independent components called filters. Pipes and filters Kristian Sandahl, IDA krisa@ida.liu.se •Create a suitable and general knowledge representation. Difficulty: Kristian Sandahl, IDA krisa@ida.liu.se •functions are duplicated •glue filters are necessary •limited to batch processing Disadvantages: 3 0% 81,5 8 70 165 - 25% 45 6 37 263 ~ 400.000 ~ 45% Kristian Sandahl, IDA krisa@ida.liu.se 50% 32 5 28 370 ~ 560.000 ~ 60% From: C. Jones, The Impact of Reusable Modules and Functions, in Programming Productivity, Mc Graw Hill, 1986 Reuse rates Time [m.m.] # Developers Costs per l.o.c. [DM] Lines per m.m. Savings [DM] Savings quality improvement effectivity by concentration to optimizations reliability prolongation life time flexibilization Improvements in the software process productivity almost prototype construction simulation of architectures Documentation clear system structures Product quality Goal: cost reduction size of class libraries JDK 1.1: ca 1,650 classes JDK 1.2: ca 4,000 classes Other Goals •Performance Problem: •Supports creation of domainspecific languages •Allows users to express themselves in more natural terms. Advantages: Example: Simulation of mathematical models. Transforms pseudocode into a instructions for a simulator. Interpreters Motivation: Reuse Kristian Sandahl, IDA krisa@ida.liu.se Source:http://www.doc.ic.ac.uk/~tpg99/vs.html Example of blackboard datastructure Kristian Sandahl, IDA krisa@ida.liu.se Kristian Sandahl, IDA krisa@ida.liu.se CORBA Kristian Sandahl, IDA krisa@ida.liu.se Source: Source: http://www.cs.wustl.edu/~schmidt/ http://www.cs.wustl.edu/~schmidt/ Kristian Sandahl, IDA krisa@ida.liu.se Reuse of partial solutions: instead of new solution Easy configurability of the systems variants, versions, product families off the shelf, COTS) Divide-and-conquer (Alexander the Great) Well known in other disciplines mechanical engineering DIN 2221 electrical engineering architecture Outsourcing to component producers (components Motivation for Component Based Development 4 C5=0.12 shaf tS1=2e-3 S bearing1 S planetary2=110/50 demultiplex shaftS=2e-3 planetary1=110/50 bearing4 C8=0.12 C4=0.12 bearing2 C6=0.12 Kristian Sandahl, IDA krisa@ida.liu.se Can go really wrong! Creative and fun. Can be used for other purposes too. Increase comprehension, reduce learing period. Often used in graphical user interface (GUI) design. planetary3=120/44 C11=0.12 Kristian Sandahl, IDA krisa@ida.liu.se qRef qdRef - pSum A1 C1 R2 Op1 Op2 R3 R4 Op3 Op5 +1 +1 sum - w Sum tacho2 b(s) a(s) a(s) qd PT1 tacho1 Rd2=100 S 340.8 b(s) a(s) r ate3 iRef - g5 g4 - Rp1=200 Jmotor=J cut joint C=0.004*D/w m 1 r3Drive1 Ri=10 r3Motor Rd1=100 r3Control rate2 i k1 i b(s) S S k2 rate1 1 1 q: angle qRef qdRef r el S spring=c qd q tn g2 qd r gear=i S joint=0 axis1 axis2 axis3 axis4 axis5 axis6 y x inertial Final system Kristian Sandahl, IDA krisa@ida.liu.se Kristian Sandahl, IDA krisa@ida.liu.se Hierarchical Composition of a Modelica Model of an Industrial Robot C3 C2 Vs + + Srel = n*n' + (identity(3) - n*n')*cos(q) - skew(n)*sin(q); diff + pow er OpI wrela = n*qd; zrela = n*qdd; Rd4=100 emf Sb = Sa*Srel'; r0b = r0a; g3 vb = Srel*va; g1 wb = Srel*(wa + wrela); ab = Srel*aa; hall1 w zb = Srel*(za + zrela + cross(wa, wrela)); fa = Srel'*fb; ta = Srel'*tb; q 0.3 Kv 0.03 Kd qddRef R1 Integrational Software Engineering Rd3=100 Rp2=50 Modelica Visual Programming: Decomposition and Abstraction of an Automatic Gearbox C12=0.12 fr ic=Rv0 Metaphors Ra=250 La=(250/(2*D*w m)) hall2 Equations and mathematical functions allow acausal modeling, high level specification, increased correctness Combine electrical, mechanical, thermodynamic, hydraulic, biological, control, event, real-time, etc... Strongly typed object-oriented language with a general class concept, Java & Matlab like syntax Hierarchical system architecture capabilities Kristian Sandahl, IDA krisa@ida.liu.se 1000 clients asking for 1 Mbit transactions every 4th minute Estimate the bandwidth required to serve Describe a system architecture Kristian Sandahl, IDA krisa@ida.liu.se Efficiency comparable to C; advanced equation compilation, e.g. 300 000 equations, ~150 000 lines on standard PC Exercise Efficient, non-proprietary Visual component programming Everything is a class Multi-domain modeling Declarative language Modelica – the Next Generation Computational Modeling Language 5