Mapping Design to Code

Coding

•     Coding is not part of OO Analysis and Design

•     but, it is the ultimate goal

•     OO Analysis & Design + OO Programming

– Road map from requirements to code

– Processes + Models that transforms requirements to code

– Traceable path requirements – code – requirements

•     OO languages

– C#

– Java

– C++

– Python

Code Generation

•     Relatively mechanical process

•     All the information is in the design diagrams

•     All you need to do is to fill in the details

– which may uncover problems in the design

»   which may (should) change the design

Class Creation

•      Attributes

– References

– Simple attributes

•      Container classes

– and associated parts (e.g. iterators)

•      Methods

– From design class diagrams

– From collaboration diagrams

 

 

 

 

 

 

Visibility

•      Visibility is the ability of one object to see or have reference to another

•      Four types of visibility

– B is an attribute of class A (attribute visibility)

»   public

»   protected

»   private

– B is a parameter of a method in A (parameter visibility)

– B is used within a method in A (local visibility)

– B is globally visible (Global visibility)

•      Try to keep elements as invisible as possible

 

Tool Support

•      Code generation

–      Skeleton code – classes and method calls, but no method bodies. The code compiles but does not do anything.

–      Full – the code compiles and does what it should.

•      Reverse engineering

–   Visualise existing code

Software Architecture

•      A set of significant decisions about the organization of a software system

•      High level description of components that the system consists of

•      Overview of structure (and interaction)

•      Large systems where detailed design becomes too “big” to overview

•      Enables communication among stakeholders

Architectural Style

Style refers to a quality of a solution which brings all of the design elements in an ensemble into a coherent whole.

Style = Design Elements+Organizing Principles

Architectural Style

•       An architectural style is a description of component types and a pattern of their runtime control and/or data transfer

•       An architectural style can be thought of as a set of constraints on an architecture

•       Mary Shaw and David Garlan have catalogued a set of architectural styles observed by examining a collection of existing systems

 

Hierarchical Layers

•  Each layer provides service to the layer above it and serves as a client to the layer below

•  The connectors are defined by the protocols that determine how the layers will interact

 

Typically Layers in An OO System

•      Presentation

– User Interface

•      Application

– Handles presentation layer requests

– Session states

– Window transitions

– Data transformations

•      Domain

–Handles application layer requests

–Implementation of domain rules

–Domain services

Layers (Cont.)

•      Business Infrastructure

– Handles domain layer requests

– Low-level business services

– E.g. currency converter

•      Technical Services

–High-level technical services

–Persistency, security etc.

•      Foundation

– Low-level technical services

– Data structures

– File management

– Database management

– Threads

Three-tier Layered Architecture

§         Presentation

§         Application logic

§         Storage

 

•         Classic and easy system organisation

•         Used a lot by Larman (and by UML)