Download - Software Engineering Implementation
![Page 1: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/1.jpg)
Software EngineeringImplementation
Lecture 3
ASPI8-4
Anders P. Ravn, Feb 2004
![Page 2: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/2.jpg)
Overview• Summary – Documents, Domains
• Module Specification - Java1. Class, object (variable)
2. Generalization
3. Association
4. Dependency
5. Interface
6. Package
7. Active Class Task (thread)
![Page 3: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/3.jpg)
Documents -51.1. Requirements SpecificationRequirements Specification
1.1 System Definition1.1 System Definition
1.2 Problem Domain Structure1.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
2. Architecture
2.1 Criteria
2.X Module Interfaces
2.T Integration Test Specification
![Page 4: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/4.jpg)
Documents -6!
1. Requirements Specification
2. Architecture
3. Modules
4. Implementation
5. Test
![Page 5: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/5.jpg)
Activities: application domain analysis
Usage
Functions
Systemdefinition
and ProblemDomainmodels
Interfaces
ApplicationDomainModel
andSoftware
Requirements
![Page 6: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/6.jpg)
Design
Problem Domain Application Domain
Model
Model*
Use case Actor
InterfaceSystem
![Page 7: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/7.jpg)
Class and Object
Class name
attributes
methods
Object: Class
1 *
![Page 8: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/8.jpg)
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); }
}
![Page 9: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/9.jpg)
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]);
![Page 10: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/10.jpg)
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; }
}
![Page 11: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/11.jpg)
Moduleclass 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();
![Page 12: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/12.jpg)
Module Specification
abstract class MSpec {
public boolean b;
abstract int method(int x, C y);
}
![Page 13: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/13.jpg)
Module Implementationclass 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();
![Page 14: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/14.jpg)
Generalization
Superclass
Subclass
![Page 15: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/15.jpg)
Java extends
class superclass {
...
};
class subclass extends superclass {
...
}
![Page 16: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/16.jpg)
Cluster (package)
related classes
<<cluster>> name
![Page 17: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/17.jpg)
Java package
package driverspec; source1
abstract class DSpec{ ... };
...
source2
package drivers
import driverspec.*;
public class D extends DSpec {...};
...
![Page 18: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/18.jpg)
Aggregation
the whole
the parts
[arity]
![Page 19: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/19.jpg)
aggregation – by inclusionabstract 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]; ...}
}
![Page 20: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/20.jpg)
aggregation – by referenceabstract 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]; ...}
}
![Page 21: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/21.jpg)
Association
[name]A B
[arity] [arity]
![Page 22: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/22.jpg)
association – by referenceclass 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);
![Page 23: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/23.jpg)
Interface Class and Dependency
IRow
Image Hydraulics
use
<<interface>>IRow
userealise
![Page 24: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/24.jpg)
Java interface
interface IRow {
// methods only !
}
class Image implements IRow {
...
}
IRow
Image
realize
![Page 25: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/25.jpg)
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;}
}
![Page 26: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/26.jpg)
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(”!!!”); ...}
}
![Page 27: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/27.jpg)
Exception Handlers
public void someMethod()
{ Data x;
Reader r = new Reader();
try { r.read(x); ...
} catch (BadData b) { ...
...
} finally { ... }
}
![Page 28: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/28.jpg)
Maintaining Documentation
• Documentation comments
• Libraries
• Module test
• Applets
• API, Swing
![Page 29: Software Engineering Implementation](https://reader036.vdocuments.us/reader036/viewer/2022070405/56814012550346895dab55df/html5/thumbnails/29.jpg)
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; }
}