1 / 29

Software Engineering Implementation

Software Engineering Implementation. Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004. Overview. Summary – Documents, Domains Module Specification - Java. Class, object (variable) Generalization Association Dependency Interface Package Active Class Task (thread). Documents -5.

hollye
Télécharger la présentation

Software Engineering Implementation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Software EngineeringImplementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004

  2. Overview • Summary – Documents, Domains • Module Specification - Java • Class, object (variable) • Generalization • Association • Dependency • Interface • Package • Active Class Task (thread)

  3. Documents -5 • Requirements Specification • 1.1 System Definition • 1.2 Problem Domain Structure • 1.3 Application Domain Structure • 1.3.1 Use Cases • 1.3.2 Functions • 1.3.3 Interfaces • 1.4 Acceptance Test Specification • Architecture • 2.1 Criteria • 2.X Module Interfaces • 2.T Integration Test Specification

  4. Documents -6! • Requirements Specification • Architecture • Modules • Implementation • Test

  5. Activities: application domain analysis System definition and Problem Domain models Interfaces Usage Application Domain Model and Software Requirements Functions

  6. Model Model* System Design Application Domain Problem Domain Use case Actor Interface

  7. Class and Object Class name Object: Class attributes methods 1 *

  8. Java class class C { public boolean b; protected char c; private byte i8; C cl; public int method(int x, C y) {if (b) return y.method(7,c1); else return i8; } public C(long count) {if (count > 0) c1=new C(count-1); } }

  9. Java variables/objects boolean b; character c; byte i8; short i16; int i32; long i64; float ieee32f; double ieee64f; C xx = new C(5); int[] ia = new int[250]; C[] ca = new C[10]; ca[0] = new C(ia[249]);

  10. Java class class C { public boolean b; protected char c; private byte i8; C cl; public C(long count) {if (count > 0) c1=new C(count-1); } public int method(int x, C y) {if (b) return y.method(7,c1); else return i8; } }

  11. Module class M { public bool b; ... public int method(int x, C y) {if(b)return ...;} public M(boolean b) { super(); this.b = b;} public M() {this(false);} }; ... M module1= new M(true), module2= new M();

  12. Module Specification abstract class MSpec { public boolean b; abstract int method(int x, C y); }

  13. Module Implementation class M extends Mspec { private byte i8; int i16; ... public int method(int x, C y) {if(b)return ...;} public M(boolean b) { super(); this.b = b;} public M() {this(false);} }; ... M module1= new M(true), module2= new M();

  14. Generalization Superclass Subclass

  15. Java extends class superclass { ... }; class subclass extends superclass { ... }

  16. Cluster (package) <<cluster>> name related classes

  17. Java package package driverspec; source1 abstract class DSpec{ ... }; ... source2 package drivers import driverspec.*; public class D extends DSpec {...}; ...

  18. Aggregation the whole [arity] the parts

  19. aggregation – by inclusion abstract class WholeSpec { protected P1 p1; P2 p2; Ps[] p; }; ... class Whole extends WholeSpec { public Whole(int p_arity) {p1= new P1(); p2= new P2(); p = new Ps[p_arity]; ...} }

  20. aggregation – by reference abstract class WholeSpec { protected P1 p1; P2 p2; Ps[] p; }; ... class Whole extends WholeSpec { public Whole(P1 p1, P2 p2, Ps[] p) {this.p1= p1; this.p2= p2; p = new Ps[p.length]; ...} }

  21. Association A B [arity] [arity] [name]

  22. association – by reference class ASpec { protected B b; }; ... class A extends ASpec { public A(B b) {this.b = b;} public void setb(B b) {this.b = b;} } ... A a; B b; a = new A(nil); b = new B(a); a.setb(b);

  23. Interface Class and Dependency Image Hydraulics IRow use <<interface>> IRow use realise

  24. Java interface IRow interface IRow { // methods only ! } class Image implements IRow { ... } realize Image

  25. Start and Parameters class System { public static final int MAX = 10; public static int ACTUAL; public static void main(String[] args) { int a = Integer.parseInt(args[0]); if (a > MAX || a < 0) a = MAX; ACTUAL = a;} }

  26. Exceptions class BadData extends Exception { BadData(String s) {super(”Bad data”+s+”\n”);} }; class Reader { public void read(Data d) throws BadData { ... throw new BadData(”!!!”); ...} }

  27. Exception Handlers public void someMethod() { Data x; Reader r = new Reader(); try { r.read(x); ... } catch (BadData b) { ... ... } finally { ... } }

  28. Maintaining Documentation • Documentation comments • Libraries • Module test • Applets • API, Swing

  29. C++ class C { public boolean b; protected char c; private byte i8; C *cl; public C(long count) {if (count > 0) c1=new C(count-1); } public int method(int x, C *y) {if (b) return y->method(7,c1); else return i8; } }

More Related