GenericMechanismsInSoftwareEngineering

From SPA Wiki

Jump to: navigation, search
Mechanisms of Achieving Generic Implementations

Implementation Inheritance

Definition/Overview: Reuse of code structure and implementation

%2b subclass inherits implementation %2b forced to implement functionality, e.g. specific set of validation %2b extend functionality, e.g. additional validation %2b small code base

- fragile base class (syntax - sub-class requires re-compile. semantic - superclass evolution) - versioning can go some way to solving - subclass ‘should not’ change it’s superclass

pattern - "Template Method Pattern"

Interface Inheritance

Definition/Overview: Reuse of contract

%2b separate implementation %2b implement multiple interfaces

- versioning/stability - doesn't promote code reuse, i.e. don't inherit implementation

pattern - "Bridge Pattern"

Code Generation

Definition/Overview: Dynamic creation of code to implement functionality for a specific type

%2b simple %2b performance (?)

- agility - code explosion - maintenance


Attributes

Definition/Overview: Attributes enable class members to be decorated with meta data that describe the developers intention.

%2b programming model %2b agility %2b describe intention at coding time

- runtime overhead (reflection)


Generics

Definition/Overview: Enable classes and members to be declared and defined for reuse with unspecified type parameters.

%2b programming model, clarity %2b type safe, compile time type checking %2b performance, no boxing/unboxing, reduce use of ‘Object’ type %2b removes requirement for additional classes, e.g. C%2b%2b templates %2b class has no dependence of type

- performance (it depends?)


The scenarios we used were:

Collection Consider implementing a generic collection, e.g. a list. The implementation should be capable of adding and deleting any ‘type’ to and from the list. Examples include; a list of strings, a list of integers, a list of addresses

Maintenance of a Business Entity Consider how to implement a generic implementation for maintaining (CRUD) a business entity. Examples include; add, delete, amend, and fetch customer details on a database.

Object Serialisation Serialisation is the process of converting an object into a form that can be transported. Consider how to serialise any object into XML. Examples include; serialising a string, serialising a class (type of address)


The Matrix weused for Measuring Fit was: - Maintenance - Development %2b Test - Runtime Efficiency - Flexibility - Complexity


The relections of the session were:

- Slow start - Smalltalk similarities - Aided generics and attributes understanding - Good to talk to devs - .NET capabilities and design problems (x2) - The sheep did good - When is code-gen a cop-out - Jave vs. .NET comparissons - List & attributes - C# nice - .NET and C# education (x2) - Auto support in .NET framework