test questions

profileAlkhawaa
se_lectures.zip

se_lectures/.DS_Store

__MACOSX/se_lectures/._.DS_Store

se_lectures/Day15/WeatherMonitoringSystem.docx

Weather Monitoring System

Requirements Definition

The system shall provide automatic monitoring of various weather conditions. Specifically, it must measure:

· Wind speed and direction

· Temperature

· Barometric pressure

· Humidity

The system shall also provide the following derived measurements:

· Wind chill

· Dew point temperature

· Temperature trend

· Barometric pressure trend

The system shall interface with the following hardware: keypad, wind-direction sensor, temperature sensor, clock (on-board clock), humidity sensor, wind-speed sensor, pressure sensor, and LCD display (capable of processing a simple set of graphics primitives, including messages for drawing lines and arcs, filling regions, and displaying text).

The system shall have a means of determining the current time and date, so that it can report the highest and lowest values of any of the four primary measurements during the previous 24-hour period. The sampling rates are: every 0.1 second for wind direction, every 0.5 seconds for wind speed, and every 5 minutes for temperature, barometric pressure, and humidity.

The system shall have a display that continuously indicates all eight primary and derived requirements, as well as the current time (hour, minutes, second) and date (day, month, year).

Through the use of a keypad, the user shall be able to direct the system to display the 24-hour high or low value of any one primary measurement, together with the time of the reported value.

The user shall be able to choose either a 12- or 24-hour format for the time.

The system shall allow the user to calibrate its sensors against know values, and to set the current time and date. The wind direction sensor requires neither calibration nor history.

Assume that each temperature sensor value is represented by a fixed-point number, whose low and high points can be calibrated to fit known actual values. Intermediate numbers shall be translated to their actual temperatures by simple linear interpolation between the two points.

Trends shall be expressed as a floating numbers between –1 and 1, representing the slope of a line fitting a number of values over some interval of time.

__MACOSX/se_lectures/Day15/._WeatherMonitoringSystem.docx

se_lectures/Day15/.DS_Store

__MACOSX/se_lectures/Day15/._.DS_Store

se_lectures/Day15/Collaborations and Hierarchies.pptx

Collaborations and Hierarchies

Outline

Collaborations

Identifying collaborations

Recording collaborations

Hierarchies

Hierarchy graphs

Venn diagrams

Continuing Practice

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."

-Rich Cook

Motivation for Collaborations

Two ways a class performs responsibilities

Knows something

Does something

Collaboration is

Request from one object to another in order to fulfill a responsibility.

Motivation (Cont.)

Why identify collaborations?

Collaborations represents the flow of control and information through the system.

May identify misplaced responsibilities, and

May identify missing responsibilities.

In sum, shows dynamics of the system.

Finding Collaborations

Look at each responsibility of each class:

Is the class capable of fulfilling this responsibility by itself?

If not, where can it get what it needs?

Look at each class:

What other classes need what this class does or knows?

Leverage the “Purpose” sentence of the class

Role-play scenarios, which class talks to which class to get the information?

Finding More Collaborations

Examine relationships between classes, especially:

The “is-part-of” relationship.

The “has-knowledge-of” relationship.

The “depends-on” relationship.

Where do these relationships come from?

“Is-part-of” Relationship

May imply responsibilities for maintaining information.

May fulfill responsibilities by delegating them.

Two relationships (containment):

Composite

Aggregate

Which relationship is more likely to require collaborations?

7

Relationships in General

May know other classes that are not in part-of relationships (i.e., associations in UML).

May imply responsibilities to know information, and thus collaborations.

Can you think of an example?

Person

Phone book

8

Recording Collaborations

Write the name of the server (or helper) class on the CRC card of the client.

Write the name directly to the right of the responsibility the collaboration fulfills.

Class: Person

Responsibilities Collaborations

Knows name

Knows address AddressBook

Knows phone number PhoneBook

Client

Server

(or helper)

Collaborations

Is there a way to visualize the connections that classes have?

Collaboration Model

Graphical representation of collaborations

Arrow from client to a “contract” of the server, denoted by a semicircle

Contract: group of responsibilities (more on this later)

Person

AddressBook

1

PhoneBook

2

Other Tools - UML

UML interaction diagrams

Sequence diagram (Chapter 10)

Communication diagram (Chapter 15)

Sequence Diagram Example

message

lifetime

control

object

Sequence Diagram

Collaboration

Communication Diagram

object

link

message

15

Communication Diagram

Collaboration

16

Outline

Collaborations

Hierarchies

Hierarchy graph

Venn diagram

Continuing Practice

Review of CRC Process

Exploratory phase

Identify a preliminary list of classes, responsibilities and collaborations.

Analysis phase

Obtain a more global understanding of the design, e.g., by using tools such as:

Hierarchy graphs,

Venn diagrams, and

Contracts.

Hierarchy Graph

A graphical representation of inheritance between related classes.

A hierarchy graph is a general tree.

The nodes are classes and the arcs represent inheritance.

Ancestor nodes are superclasses of descendent nodes, which are subclasses.

As a heuristic, I recommend delaying the identification of hierarchies until identification of classes is mostly complete.

Example – Hierarchy Graph

CRC notation

Leaf nodes are often concrete classes.

Non-leaf nodes are often abstract classes.

PartTime

FullTime

Employee

All classes can be designated as either abstract or concrete.

Concrete is the default. This means that the class can have (direct) instances.

In contrast, abstract means that a class cannot have its own (direct) instances.

Abstract classes exist purely to generalize common behavior that would otherwise be duplicated across (sub)classes.

Ask the question: will the class become alive (as an object) during runtime? If so, then it should be a concrete class, otherwise it will be an abstract.

20

In UML …

PartTime

FullTime

Employee

Abstract Classes

Classes that cannot be instantiated.

Designed only to be inherited from, thus allowing reuse and avoiding duplication.

Used to factor common behaviors among classes.

Finding Abstract Classes

At the exploratory stage, all identified classes are probably concrete

A few may have been identified as abstract.

But, do you have all your abstract classes? That is, have you used the power of abstraction (factoring behavior)?

Another Example of Hierarchy Graph

Ordered

Collection

Indexable

Collection

Magnitude

Array

Matrix

String

Date

Abstract class

Venn Diagram

Another tool to understand inheritance relationships.

A Venn diagram views a class as a set of responsibilities, then

What does an intersection mean?

Common responsibilities

What might an intersection lead to?

Abstract classes

Thus, an intersection among classes:

Denotes common responsibilities, and thus

May indicates an abstract superclass

25

Example

PartTime

FullTime

Employee

PartTime

set of responsibilities

Employee

set of classes

PartTime

FullTime

Employee

FullTime

26

Exercise - 5 Minutes!

Ordered

Collection

Indexable

Collection

Magnitude

Array

Matrix

String

Date

Draw a Venn diagram for the following hierarchy graph.

27

Draw a Venn diagram for the following hierarchy graph

Ordered

Collection

Indexable

Collection

Magnitude

Array

Matrix

String

Date

magnitude

Date

string

Array

Ordered collection

Indexable collection

Matrix

28

In Sum, Hierarchies …

Facilitate the review of inheritance relationships.

Use hierarchy graphs and Venn diagrams as a notation and an analysis tool

29

How to build Good Hierarchies?

Model “is-a” relationships.

Factor common responsibilities as high as possible.

“Push” them up

Make sure abstract classes do not inherit from concrete classes.

Eliminate classes that do not add functionality.

Example – Using Venn Diagram To Check a Hierarchy

If B supports only a part of responsibilities defined for A, what does the Venn diagram look like? How to fix this?

Hint: Model each Venn diagram class as a set of responsibilities

A

B

A

B

A

B

Which is it?????

31

The point here is: DON’T FORCE IT

Fixing the Problem

Create an abstract class with all responsibilities common to both A and B, and have them both inherit from it.

This is called “Factoring”

Not to be confused with “Refactoring”

A

B

C

A

B

C

32

Example – Factoring Responsibilities

You will need at least 2 subclasses to inherit this responsibility or might as well not even bother.

Ellipse

Element

Text

Element

Line

Element

Rectangle

Element

Group

Element

Drawing

Element

How many responsibilities do you need in order to create an abstract class?

Answer: 1, but there’s a catch!!!

33

Factoring (Cont.)

Rectangle

Element

Ellipse

Element

Text

Element

Line

Element

Group

Element

Drawing

Element

Linear

Element

Rectangle

Element

Ellipse

Element

Text

Element

Line

Element

Group

Element

Drawing

Element

Linear

Element

Filled

Element

34

Outline

Collaborations

Hierarchies

Continuing Practice

Add Collaborations

Identify Hierarchies

Finish Reading if you haven’t

Chapter 17 and 18

__MACOSX/se_lectures/Day15/._Collaborations and Hierarchies.pptx

se_lectures/Day14/.DS_Store

__MACOSX/se_lectures/Day14/._.DS_Store

se_lectures/Day14/Design & Architecture.pptx

Design Introduction

Outline

Software Design Overview

High-Level

Low-Level

CRC

Identifying Classes

Identifying Responsibilities

Practice

Design Overview

What is Software Design?

Deals with transforming the requirements specifications into a model that can be implemented using programming languages.

Can be broken down into two types

High-level (i.e., Architecture Design)

Low-level (i.e., Detailed Design)

Software Architecture

What is a Software Architecture?

High Level Design: Software Architecture

The primary way to implement nonfunctional requirements

Requires a deep understanding of the desired quality attributes of the system, might necessitate negotiation and prioritization with the stakeholders.

Can be difficult to guess right under an agile method.

High-level Vs Low-level

Architecture Design:

High-level deals with overarching nonfunctional goals of the system.

Requires a complete understanding and prioritization of nonfunctional requirements.

Detailed Design:

Focuses on the bridge between the functional requirements and the actual implementation of the system.

Main concern is the maintainability and easy of implementation of the system.

Software Architecture Issues

Architectures are strictly influenced by the desired nonfunctional requirements.

Requires a complete understanding of the requirements for the best architecture selection.

You can’t have your cake and eat it too..

Some quality attributes are mutually exclusive to a certain degree

e.g., high performance and security, scalability and availability..

This is why it is so important to prioritize and be able to negotiate nonfunctional requirements with stakeholders.

Changing an architecture once it is installed is very difficult

Often times it is better to redo the system.

High-level Vs Low-level

Architecture Design:

High-level deals with overarching nonfunctional goals of the system.

Requires a complete understanding and prioritization of nonfunctional requirements.

Detailed Design:

Focuses on the bridge between the functional requirements and the actual implementation of the system.

Main concern is the maintainability and easy of implementation of the system.

Detailed Design

We need a method to convert requirement specifications into an actual implementation of a software system

There are multiple ways, the book focuses on one approach.

In addition to this, I’ll teach you a different approach.

Class, Responsibility, and Collaborator (CRC) Cards

Invented in 1989 by Kent Beck and Ward Cunningham

A simple yet powerful object-oriented (analysis/design) technique

Uses a collection of (standard index) cards that are divided into three sections:

Class

Responsibility

Collaborator

Class, Responsibility, and Collaborator

A class represents a collection of the same objects.

A responsibility is anything that a class knows or does, a service that it provides for the system.

A collaborator is another class that is used to get information for, or performs actions for the class at hand to support a responsibility.

Example

More on CRC Cards

3x5 (or 4x6) index cards, post-its, etc.

One class per card

In addition, you can also write superclasses and subclasses.

More on this later..

On the back, write a description of purpose of the class.

It should be one sentence.

Example: The purpose of this class is to represent a person in the system.

Question

Why use index cards?

Advantages

Portable: cards can be used anywhere, even away from the computer or office

Anthropomorphic: no computer program can capture the essence of the interactions forced by passing the cards

Level of involvement felt by each team member increases

Useful throughout the life cycle

More Advantages

Provides a basis for a formal analysis and a design method

Serves as input to a formal method (i.e., a starting point)

Ease the transition from process orientation to object orientation

Most of us (still?) think in a process oriented manner

Provides a general bound on the size of a class

A card

CRC Approach – The Process

Exploratory phase (Today)

Find classes

Determine operations and knowledge for each class (responsibilities)

Determine how objects collaborate to discharge responsibilities

Analysis phase (Later)

Collect into subsystems

Improve design

How to Find Objects and Their Responsibilities?

Use nouns and verbs in requirement documents as clues

Noun phrases leads to objects

Verb phrases lead to responsibilities

Determine how objects collaborate to fulfill their responsibilities

To collaborate, objects will play certain roles

Why is this important?

Objects lead to classes

Responsibilities lead to operations or methods

Collaborations and roles lead to associations

Identifying Objects (Classes)

Start with a set of requirement specifications

Look for noun phrases.

Separate into obvious classes, uncertain candidates, and nonsense

Refine to a list of candidate classes.

Guidelines for Refining Candidate Classes

Model physical objects – e.g., disks, printers, station.

Model conceptual objects – e.g., windows, files, transaction, log.

Choose one word for one concept – what does it mean within the domain?

Be wary of adjectives – does it really signal a separate class?

Guidelines for Refining (Cont.)

Be wary of missing or misleading subjects – rephrase in active voice.

Model categories of classes – delay modeling of inheritance.

Model interfaces to the system – e.g., user interface, program interface.

Model attribute values, not attributes – e.g., customer vs. customer address.

Example: Mail-Order Software

Imagine that you are developing order-processing software for a mail order company, a reseller of products purchased from various suppliers.

Twice a year the company publishes a catalog of products, which is mailed to customers and other interested people.

Customers purchase products by submitting a list of products with payment to the company. The company fills the order and ships the products to the customer’s address.

The order processing software will track the order from the time it is received until the product is shipped.

The company will provide quick service. They should be able to ship a customer’s order by the fastest, most efficient means possible.

Example: Mail-Order Software

Imagine that you are developing order-processing software for a mail order company, a reseller of products purchased from various suppliers.

Twice a year the company publishes a catalog of products, which is mailed to customers and other interested people.

Customers purchase products by submitting a list of products with payment to the company. The company fills the order and ships the products to the customer’s address.

The order processing software will track the order from the time it is received until the product is shipped.

The company will provide quick service. They should be able to ship a customer’s order by the fastest, most efficient means possible.

Candidate Classes

Candidate Classes (Cont.)

Expect the list to evolve as design proceeds

Record why you decided to include or reject candidates

Candidate class list follows configuration management and version control

A Good Class …

Has a clear and unambiguous name

Has a name that is recognizable by domain experts/stakeholders

Is a singular noun

Has responsibilities

May actively participate in the system

What Are Responsibilities?

The public services that an object may provide to other objects:

The knowledge an object maintains and provides

The actions that it can perform

That is they

Convey a sense of purpose of an object and its place in the system

Record services that a class provides to fulfill roles within the system

Record knowledge and manipulation of information in the system

Knowledge and Action

Knowing responsibilities

Knowing about private encapsulated data

Knowing about related objects

Knowing about things it can derive or calculate

Doing responsibilities

Doing something itself, such as creating an object or performing a manipulation

Initiating action in other objects

Controlling and coordinating activities of other objects

Identifying Responsibilities

Use mixtures of:

Verb phrase identification. Similar to noun phrase identification, except verb phrases are candidate responsibilities.

Scenarios and role play. Perform scenario walk-through of the system where different persons “play” the classes, thinking aloud about how they will delegate to other objects.

Class enumeration. Enumerate all candidate classes and come up with an initial set of responsibilities.

Class relationship examination. Examine all classes and their relationships to compare how they fulfill responsibilities.

Example of Verb Phrase Identification

Imagine that you are developing order-processing software for a mail order company, a reseller of products purchased from various suppliers.

Twice a year the company publishes a catalog of products, which is mailed to customers and other interested people.

Customers purchase products by submitting a list of products with payment to the company. The company fills the order and ships the products to the customer’s address.

The order processing software will track the order from the time it is received until the product is shipped.

The company will provide quick service. They should be able to ship a customer’s order by the fastest, most efficient means possible.

Example of Verb Phrase Identification

Imagine that you are developing order-processing software for a mail order company, a reseller of products purchased from various suppliers.

Twice a year the company publishes a catalog of products, which is mailed to customers and other interested people.

Customers purchase products by submitting a list of products with payment to the company. The company fills the order and ships the products to the customer’s address.

The order processing software will track the order from the time it is received until the product is shipped.

The company will provide quick service. They should be able to ship a customer’s order by the fastest, most efficient means possible.

Candidate Responsibility

Responsibility Types

Identify the types of responsibilities for each class

Behavior – Describes what a class does (i.e. things that meets the requirements of the system)

Knowledge – Describes what the class knows about itself (i.e. attributes of the class)

Example

Knowledge or Behavior?

Know balance?

Verify customer?

Know account number?

Authorize transaction?

Track activity?

Last page visited?

Late fee amount?

Print layout?

Assigning Responsibility Types

For knowledge types

Match the responsibility with the class who owns the information

For behavior types

Match the responsibility with the class who can do this

Look at the name and purpose of the class as a guideline

Practice!

ATM Example specifications

Cards

Read

Chapter 12, 13 & 14

Further readings

B. Beck and W. Cunningham, A Laboratory for Teaching Object-Oriented Thinking, OOPSLA ’89, October 1-6, 1989.

R. Wirfs-Brock, B. Wilkerson and L. Wiener, L., Designing Object-Oriented Software, Prentice Hall, 1990. (Chapters 3 and 4)

Hans Van Vliet, Software Engineering, Principles and Practice,3rd edition, John Wiley & Sons, 2008. Sections 10.1.4 & 12.3

__MACOSX/se_lectures/Day14/._Design & Architecture.pptx

se_lectures/Day22/.DS_Store

__MACOSX/se_lectures/Day22/._.DS_Store

se_lectures/Day22/Weather.pptx

Weather Monitoring System

Classes

Classes

Sensors

Wind Speed

Wind Direction

Barometric Pressure

Humidity

Derived Measurements

Wind Chill

Dew Point Temp

Trends

Temp Trend

Barometric Trend

Continous Data

Specific Data

Time

Clock

Keypad

LCD

Graphics

Line

Arc

Region

Text

History Logs

Wind Speed

Wind Direction

Barometric Pressure

Humidity

Weather Monitoring System

Collaboration Graph

Weather Monitoring System

Contracts

Simple Contracts

Monitor Weather

Get current weather data

Query specific sensor 24 hour hi-lo data

Display graphic data

Capture user input

Get current time and date

Set time and date

Get sensor data

Get derived measurement

Calibrate sensor

Get 24 hour hi-lo for sensor

Generate graphic

Weather Monitoring System

Subsystem Graph

Graphics

Query

WeatherMonitor

CurrentData

1

2

10

3

12

WeatherMonitor

1

CurrentData

2

10

Query

3

Graphics

12

__MACOSX/se_lectures/Day22/._Weather.pptx

se_lectures/Day18/Detailed Design.pptx

Detailed Design

1

Detailed Design

Following the CRC process we have modeled a detailed design for a system.

What is the purpose of creating this?

To create a well-designed system.

A well designed system

High Cohesion

Low Coupling

Abstractions

A plan for building a system

?

Building a bridge to code

How do we map the work we have done with our detailed designs into actual code?

We can build classes (we have the cards with the names)

And we have our contracts.

How do we implement these?

Contracts describe interfaces

Classes provide interfaces for other classes to interact through

There are multiple ways to build classes and their routines

Traditional Building of Classes and Routines

Approaches

Ways to plan for implementation of contracts:

Pseudocode Programming Process (PPP)

Design by contract

Test-first

Pseudocode Programming Process (PPP)

Approach based on using English-like statements to describe code logic

Language independent

Less training required:

We all know English somewhat..

Can be verified without implementing anything

i.e. can be reviewed.

PPP-Design the routine

This can be guided by what we have designed, for example:

Your CRC contract from your detailed design can be the starting point.

Write Pseudo-code that fulfills that contract.

Review!

PPP-Implement

Write code following your pseudocode.

You don’t have to think much, just read along.

Thoughts?

PPP-Review

Check the code

Can be a review, or be done by unit testing.

PPP-Repeat as necessary

You might encounter optimizations or you might need to clean up the code.

Might identify factoring out, i.e. identifying new routines to be extracted out.

PPP

Seems silly

Who needs pseudocode??

Only dumb programmers!

Thoughts?

PPP

Seems silly

Who need pseudocode??

However it isn’t just about you

Others can review before you implement potentially finding issues

Others can understand what you’re going to do and therefore accommodate their work to match yours

You can build test cases much easier this way

Design by Contract

A different approach:

“Applying Design by Contract,” B. Meyer, IEEE Computer, pp. 40-51, October 1992

Design by Contract

The next logical step after you have created your CRC contracts.

Enhance them by adding:

Pre-conditions

Post-conditions

What are pre and post conditions?

Pre: What must be true to guarantee the execution of this contract

Post: What is guaranteed to be true after the execution of this contract

Pre-Condition

Capture the conditions that must be true in order for the method to execute correctly

Describe the required state of the ADT or object before entering the function

Written as an expression that is true or false

May consist of statements connected by logical operators (AND, OR)

Use true when no pre-condition exists – should be rare.

15

Post-Condition

Must clearly state what is true when the method completes execution

Describe the expected state upon exiting the function

Should be strong enough so that only correct implementations will satisfy the condition

Think of an evil programmer.

16

Example

17

Example Continued

18

Design by Contract

Pre an post conditions can be written

Use formal methods like

using a specification language such as:

Z

JML

OCL

And others..

Informally, using English as a language

Pre: The internal private list will not empty and only contain positive integers.

Post: The Sum() method will iterate through the private list, and return the addition of all elements within that list.

Semi-formally, using a combination of the above.

Drawbacks of each?

Design by Contract

By writing pre and post conditions we gain the following benefits:

We don’t have to be so defensive on production code (defensive programming)

We have precise contract agreements that must be fulfilled

We can generate unit and integration testing much easier

Good Pre and Post Conditions

States

What (properties), e.g.,

The property of being square roots

The property of being sorted

The property of appearing in an array

Not how (algorithms), e.g.,

Not how to calculate square roots (linear, binary, Newton)

Not how to sort (bubble, insertion, quick)

Not how to decide whether an item appear in an array

21

21

Test-first

Produce automated tests before you code.

Test-first

Wait.. What?

Create tests and execute them without code??

Test-first

Produce automated tests before you code

Start with a small focused unit test

At first it will fail (it should fail, if it doesn’t then something is already wrong)

Minimally develop code to pass this test

Refactor

Reorganize code without changing it’s behavior.

Repeat with the next test

Where do tests come from?

What is automated testing?

Test-first

Tests come from

Use Cases and Scenarios

CRC contracts

Automated testing is a way to create unit tests that can be automatically tested

Such tools as NUnit, JUnit

Are a great tool for regression testing (regre-what?)

Benefits of this approach?

Test-first

Benefits:

You are testing as you go

You can fix issues faster because you’re closer to the code

Your testing becomes your abstract pseudocode.

But your code is only going to be as good as your testing

And a lot of effort will be invested in refactoring.

Approaches

All 3 approaches are valid

They all serve a purpose

Add structured detail

Manage complexity

Create a process to replicate

Act as the bridge between CRC and the Implementation.

Practice writing protocols

Try the pseudocode approach.

Do pre/post conditions for some contracts.

Define some test cases that could be automated.

3/28/2019

28

__MACOSX/se_lectures/Day18/._Detailed Design.pptx

se_lectures/Day18/.DS_Store

__MACOSX/se_lectures/Day18/._.DS_Store

se_lectures/Day20/Design Patterns.pptx

Design Patterns

Medical Doctors

You go to the doctor

You tell list your symptoms

Doctor looks back at what s/he knows and matches the symptoms with the treatment

Who figured out this stuff?

Other doctors who researched/stumbled on the same diseases

Other doctors who figured out the effects of certain medicines on these diseases

The Dream

Optimally we’d like to:

You see a software requirement

You look at it’s needs

You look back at what you know and match the needs with the problem solution

Goal

So wouldn’t it be nice if someone came to us with a problem..

..and we could just open a book or a repository, and tweak an existing solution for this need?

Design Pattern

Describes

problem that occurs repeatedly

the core of the solution to that problem

Solution can be reused

not necessary to implement it the same way

Patterns

Proven solutions to recurring software problems.

Architecture

Design

Architectural patterns are beyond the scope of this class

But let’s view a very common and important one

MVC

Model-View Separation

Model: The domain layer of objects. (objects that contain data and operations).

View: The presentation layer of objects (windows, applets, reports).

Separation of Concerns

Domain vs View

Design Heuristics – 1

So far we have talked about:

High Cohesion

Low Coupling

This is Separation of Concerns

Separate focused cohesive elements into modules

This lowers coupling

It all boils down to high cohesion/low coupling.

The Nature of Software

Software Changes

If a piece of software is being used it is being changed:

Bugs are found that need to be corrected or

Improvements found with use are being requested

Change in software is not trivial

Can introduce bugs, or affect non-functional requirements (security, performance, portability)

All good software will change; if it’s not being changed it’s not being used

Design Heuristics – 2

Design for Change

Notion to structure and organize your software system to facilitate and minimize the impact of change

How is it done?

Separate and Encapsulate elements that are likely to change.

View of a System

Is the view of a system likely to change?

What is the difference between the following software systems?

Windows 8 vs Windows 10

NFL Madden 2016 vs NFL Madden 2019

IOS 7 vs IOS 10

Your credit card’s website in 2014 vs 2019

Answer: Looks different!

Model-View

Window

Configuration

display( )

addEntry( )

query( )

Model

View

Goal: Classes in Model should not have direct visibility to classes in View.

Model-View Separation Motivation

Motivation

Focus more on the domain processes rather than on computer interfaces.

Allow separate development of the model and user interface layers.

Minimize the impact of changes in the interface upon the domain layer.

Allow new views to be easily connected to an existing domain layer.

Problem

Window

Configuration

display( )

addEntry( )

query( )

Model

View

Model classes know about View classes.

Worse

displayMessage ( )

Model-View Separation Pattern

Window

Configuration

display( )

addEntry( )

query( )

Model

View

query( )

View classes know about Model classes.

Better

Model-View Separation Pattern

Configuration

Old Window

display( )

addEntry( )

query( )

Model

View

query( )

New Window

display( )

The View Layer can be modified without affecting the Model layer.

Model-View Separation Pattern

Configuration

addEntry( )

query( )

Model

View

query( )

New Window

display( )

When the Window needs to display data it queries the Model objects “Polling Model”

Model-View Separation Pattern with Indirect Visibility

Configuration

Window

display( )

addEntry( )

query( )

Model

View

Model View

Controller

post Update Message

tells Window to Update

query( )

MVC

MVC is an architecture pattern

An architecture is the higher level design of a system

Meaning it’s the way a software system is structurally organized, and the communication paths between components is defined

Other examples include: Layered, Client-Server, Pipe and Filter, N-Tier, Event-driven...

Patterns

Proven solutions to recurring software problems.

Architecture

Design

So patterns we will see are at the detailed design level..

Design Patterns

First recognized by the Gang of Four

Erich Gamma

Richard Helm

Ralph Johnson

John Vlissides

Published a book with 23 patterns

These have become the foundations of all other patterns

GoF 23

Are categorized into three groups

Creational

Structural

Behavioral

The whole list:

Abstract Factory, Builder, Factory Method, Prototype, Singleton, Adapter, Bridge, Composite, Decorator, Façade, Flyweight, Proxy, Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor

Where do you see Design Patterns?

Seminars and conferences

Technical journals

Text books and trade journals.

Existing well designed systems

A good software engineer knows design patterns.

Because he/she doesn’t want to reinvent the wheel

And make the wheel a square.

Where did they come from?

Patterns start with a premise and answer two questions:

Premise: the goodness of a design is objective: not entirely in the eyes of the beholder.

Q1: What is present in good designs that is not present in poor ones?

Q2: What is present in poor designs that is not present in good ones?

Description of patterns:

Name What it’s commonly called.

Intent What it does.

Problem What problem addresses.

Solution How does the pattern solve the problem

Participants Objects interacting

Consequences Investigate forces at play

Implementation Note: this is not the pattern itself.

References Where it comes from.

Elements

Pattern name

Becomes part of our vocabulary

Allows abstract discussion of problem and approaches

Allows discussion of issues instead of implementation

Problem

Solution

Consequences

Vocabulary Example : find number in sorted list

Find middle value and compare value we are looking for to that one. If found, we’re done. Otherwise, if we are looking for something bigger, set the new bottom to the current middle. Otherwise, set the new top to the current middle.

Repeat the above step until the list can’t be divided further. If it’s not in the last two positions, it’s not in the list.

Vocabulary Example 2: find number in sorted list

Use binary search.

Discussion

This assumes that you know what binary search is.

But if you know what binary search is, the discussion is greatly simplified.

Algorithms are not patterns. Patterns are not algorithms.

Elements

Pattern name

Problem

Explains the problem and its context

may include a list of conditions needed before application of the solution makes sense

Solution

Consequences

Elements

Pattern name

Problem

Solution

Describes elements of design, relationships, responsibilities, and collaborations

Does not describe a particular implementation

Abstract description and how a general arrangements of objects solves problem

UML

Consequences

Elements

Pattern name

Problem

Solution

Consequences

Results and trade-offs of applying pattern

Needed to evaluate tradeoffs between solutions.

Frequently time/space trade-offs

Why use patterns?

Reuse existing, high-quality solutions to common problems

Incorporates a great deal of experience

May describe things often overlooked or subtle that prevent good solutions

Focus on issues not implementation

Shift thinking to higher level

Decide if design is right, not just working

Assists you in learning how to design well

Improves code: smaller hierarchies, more modifiable code.

General Strategies suggested by patterns

Design to interfaces

Favor composition over inheritance

Find what varies and encapsulate it.

Consider what should vary in your design.

Consider what you want to be able to change without redesign (as opposed to what might force you to redesign)

Then encapsulate it

34

(Encapsulation is hiding: not just data, but data, implementation, interface, anything.)

Solving Problems

Patterns help you identify non-obvious abstractions

e. g., Strategy describes pattern for interchangeable families of algorithms

Patterns can guide decisions about what should be an object

How to Select a Design Pattern

Consider how design patterns solve design problems

Scan Intent sections

Study how patterns interrelate and patterns of like purpose

Consider what should be variable in your design

How to use a pattern

Read the pattern paying attention to Applicability and Consequences

Study the Structure, Participants, and Collaborations

Look at Sample Code

Choose good names for participants

Define the classes, interfaces, and operations

Implement the operations to carry out the responsibilities and collaborations

Design Pattern Examples

Let’s look at a couple of design patterns in detail.

Façade

Intent: want to simplify the use of an existing system. Need to define an interface that is a subset of the existing one.

Problem:

You only need a subset of a complex system or need to interact in a particular way.

The API for the subset is simpler than the API for the entire subsystem.

You may want to hide the original system, or you may want to use a subset of the system and add functionality.

Façade

Solution: The façade presents a new interface

Participants: presents a specialized interface to the client to make it easier to use

Consequences:

Simplifies the use of the subsystem.

Some functionality may not be available to the client.

Implementation:

Define a new class (or classes) that has the required interface.

Have this class use the existing system.

Façade Example

Huge interface with a lot of functions, but we only need a few of the functions.

Rather than exposing the whole interface, create the interface you need, and build a façade.

Without Façade

ClientA

Database

ClientB

Element

Model

42

With Façade

ClientA

Database

ClientB

Element

Model

DataFacade

43

Façade

Can be used to introduce classes to handle complexity at the subsystem level.

We just saw this on our Subsystems

It’s all related.

Leads to lower coupling in your design.

Collaboration Graph With Façade-Subsystems

ClientA

ClientB

Data Subsystem

C1

45

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Adapter

Intent: match an existing object beyond your control to a particular interface.

Problem:

A system has the right data and behavior, but the wrong interface.

Use this when you have to make an existing class a subclass of a new class structure.

Adapter

Solution: Adapter provides a wrapper with the desired interface.

Participants: The adapter adapts the interface of an adaptee to match that of the adapter’s target. This allows the client to use the adaptee as if it were a type of target.

Consequences: the adapter pattern allows for pre-existing objects to fit into a new class structure with out being limited by their interfaces.

Adapter

Implementation: encapsulate an existing class in another class. The containing class matches the required interface.

Client

Target

Adaptee

Adapter

Adapter Example

Drawing program

Superclass called Shape

Subclasses

Rectangle

Ellipse

Star

Need to add circle

Have circle class implemented in a class called xcircle

But the circle I need must be of type Shape

Xcircle isn’t. The methods are named wrong.

Adapter

Create a class circle

It encapsulates xcircle

Circle class has the correctly named methods

Only need to call some of the xcircle methods.

Adapter

Looks like Façade. But it is not.

The differences are subtle.

Façade Adapter

Existing classes? Yes Yes

Super class? No Yes

Need polymorphism? No Maybe

Simpler interface? Yes No

Façade vs Adapter

Which one is better?

Façade vs Adapter

Which one is better?

They are solutions to different problems

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Singleton Design Pattern

Intent

To ensure that a class has only one instance and provides a global access point to it

Applicability

Use the Singleton pattern when there must be exactly one instance of a class and it must be accessible to clients from a well-known access point

Benefits

Controlled access to the sole instance

Permits a variable number of instances

UML

Implementation

Problem:

There exists a class that handles Central Communications

But due to license costs constraints, only one license is purchased

You want to ensure that at most there is only one license being used

Implementation

public class SingletonCentralComm

{

private static SingletonCentralComm instance = null;

private SingletonCentralComm()

{

}

public static synchronized SingletonCentralComm getInstance()

{

if (instance == null)

{

instance = new SingletonCentralComm();

}

return instance;

}

//Actual class behavior would be implemented below..

}

Implementation

Client:

SingletonCentralComm CentralComm=SingletonCentralComm.getInstance();

Don’t have to worry about instantiating the class..

Singleton

One of the most commonly misused patterns

Should be used when one and only one resource is needed.

Not to pass around information as global memory.

To be continued..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

__MACOSX/se_lectures/Day20/._Design Patterns.pptx

se_lectures/Day16/.DS_Store

__MACOSX/se_lectures/Day16/._.DS_Store

se_lectures/Day16/Contracts.pptx

Contracts

Outline

Contracts: what and why?

Contract documentation

Extension to CRC cards

More on collaboration graphs

Guidelines for defining contracts

Practice

Review: Responsibility

Responsibility: (what is this?)

Contract: What and Why?

Responsibility: something an object (server) does for other objects (clients)

Contract: set of cohesive responsibilities that a client can depend on

Contract is not the same as responsibility

It is another abstraction and analysis technique

for refining hierarchies and identifying subsystems.

Cohesion - 1

Cohesion is the degree to which elements in a class work together for one specific goal.

Affects the ease of implementing and maintaining a class:

Functional: elements grouped together because everything works towards one goal

Sequential: elements grouped together because output of one operation is input to the next

Communicational: elements grouped together because they operate over the same data

Procedural: elements grouped together because they follow the same sequence

Temporal: elements grouped together because data processing needs to be done at the same time in the program execution

Logical: elements are grouped together because they are a set of similar like operations

Coincidental: no apparent reason of why elements were grouped together

5

Good

Bad

Cohesion - 2

Cohesion – In other words

The degree of how related elements in a class are to each other.

That is to say that the functional entity is doing only one thing, and doing it well.

High Cohesion is desirable for any and all designs.

Why?

3

Server

Client and Server View

A contract defines a set of requests that a client can make of a server.

The server is guaranteed to respond to the request.

Responsibilities are the basis for determining contracts.

Client

Contract

Example

The class Chart has responsibilities for creating bar charts, pie charts, and line charts.

The contract states that:

1) Given a list of numbers and a chart type, the class will return a chart of the given type with the given numbers.

This is often added to a document (software design document; SDD)and used as a reference:

Class Chart

Contract 1: This contract will, if given a list of numbers and a char type, return a chart of the given type with the given numbers..

Client Display invokes contract 1 from Chart

1

Chart

Display

Classes and Contracts

A class can support any number of contracts.

Not all responsibilities will be part of a contract (i.e., there are private responsibilities that support public responsibilities).

Contracts are used in a collaboration.

A responsibility may be part of at most one contract.

At most?

Why?

Hierarchies and Contract

If a responsibility is being used by two contracts within the same class:

That responsibility should be abstracted to a parent class

Which can improve cohesion for the class.

For example, Contract A, and B share responsibility 1.

Let responsibility 1 be a contract, C.

Can factor class that contains contract C, which can lead to the creation of two classes, one for contract A and another for contract B

A

B

1

A

B

C

A

B

C

Outline

Contracts: what and why?

Contract documentation

Extension to CRC cards

Collaboration graphs

Guidelines for defining contracts

Practice

Collaboration Graphs

Models client server collaborations.

Can be used to assess coupling and cohesion.

Arrow from client to a contract supported by the server.

One numbered semicircle for each contract.

If two objects collaborate with a class by means of a contract, they point to the same semicircle.

Drawing

Editor

Drawing

1

Figure

Set

Contract Documentation

Extension to CRC cards:

Contracts

Private Responsibilities

Class <Class name>

Superclass <Parent class name>

Description:

Contracts:

<Contract #> <Contract Name>

<Contract Description>

<Responsibilities> <Collaborators>

Private Responsibilities

<Responsibilities> <Collaborators>

Contract Documentation

Class <Class name>

Superclass <Parent class name>

Description:

Contracts:

<Contract #> <Contract Name>

<Contract Description>

<Responsibilities> <Collaborators>

Private Responsibilities

<Responsibilities> <Collaborators>

14

Number these sequentially for each class.

Be careful of inheritance: subclasses inherit contracts from super classes.

Example

Class: Form

Superclass: UserInteraction

Description: Provide human interface for data input

Contracts:

4. Get Numeric Value from User

Ask user for information DisplayScreen (7)

Know if user responded

Know user’s response Keypad

Provide feedback to user DisplayScreen (8)

Private Responsibilities:

Know form contents

Note the contract number for collaboration

Outline

Contracts: what and why?

Contract documentation

Extension to CRC cards

Collaboration graphs

Guidelines for defining contracts

Practice

Guidelines for Defining Contracts

Group responsibilities used by the same clients

Maximize cohesiveness of classes

Minimize coupling of classed by reducing the number of contracts

Guideline 1

Group responsibilities used by the same clients.

One way to find a contract is to look for a set of cohesive responsibilities

When a set of responsibilities is used by the same client,

They may be detailed views of a single service

They may be part of one contract.

Example 1

An Array class has two responsibilities likely to be used by the same client:

Return subset of elements that meet specified criterion

Return first element that meets specified criterion

Contract: Return selected elements based on specified criterion

Contract abstracts both responsibilities into one cohesive set.

Example 2

An Employee class has two clients:

Record needing general employee information

Payroll needing salary-related information

Create two different contracts

Contract 1: Provide general employee information

Contract 2: Provide salary information

Why is this different?

Cohesive contracts.

Guideline 2

Maximize cohesiveness of classes.

To make class hierarchy easier to refine by maximizing cohesiveness of contracts

Look for a server offering some abstract service to a variety of clients

Example - 1

Example: A Reader class can read from keyboard, file, network, database…

You would abstract this read service and just inherit per specific class

Keyboard

File

Reader

Network

Database

Reader

Example - 2

Suppose that arrays support a contract for element-wise arithmetic operations.

Is this an appropriate behavior for arrays?

What about an array containing elements for which multiplication is necessary?

Solution?

Maximize cohesion of class

Arrays should not be providing data type specific (i.e., arithmetic) operations

Guideline 3

Minimize coupling of classed by reducing the number of contracts

What is coupling?

Coupling - 1

Coupling is the degree of interdependence between classes

Affects the impact on the system of change

Message: class communicates with another class via simplest messages

Data: class passes data elements to another class

Stamp: class passes a structure (such as an object) to another class and only uses a part of the structure

Control: the calling class passes data to the called class to perform certain action depending on the value of the data

Common: class communicates through global data

Content: a class relies on the internal control another class

Good

Bad

Coupling - 2

Coupling – In other words

The manner and degree of how classes are connected.

Low Coupling is desirable for any and all designs.

Why?

Guideline 3

Minimize coupling of classed by reducing the number of contracts

How does minimizing the number of contracts minimize coupling?

Guideline 3

Provide a general interface so that clients do not have to know about implementations

Look for similar responsibilities that can be generalized

Use polymorphism

Define contracts for classes at the top of hierarchy

Add new contracts only for subclasses that add new functionality

Balance

Creating a good design is an iterative process.

You have to manage conflicting goals:

Designing small, easily understood and reusable classes (high cohesion)

Designing a small number of classes with easily understood relationships (low coupling)

Strive for the lowest coupling, and the highest cohesion.

Use collaboration graphs to model and analyze a design.

Summary

A contract is a set of cohesive responsibilities.

A class should support a cohesive set of contracts.

Minimize coupling by reducing the number of contracts supported by each class.

Low coupling, high cohesion.

Further reading

Wirfs-Brock et al., Designing Object-Oriented Software, Prentice Hall, 1990. (Chapter 6)

Practice!

Continue working on your Weather Monitoring System

Identify contracts, create collaboration graphs.

Read chapters 19 and 20.

__MACOSX/se_lectures/Day16/._Contracts.pptx

se_lectures/Day17/.DS_Store

__MACOSX/se_lectures/Day17/._.DS_Store

se_lectures/Day17/Subsystems.pptx

Subsystems

1

Outline

Modeling hierarchies in collaboration graphs

Subsystems

Subsystem documentation

Subsystems cards

Collaboration graphs

Guidelines for defining subsystems

Hierarchies in collaboration graphs

To model a hierarchy like this:

In a collaboration graph, draw it like this

A

B

C

A

B

C

Superclass contracts in collaboration graphs

Adding contracts:

Contract 1 is owned by C, contract 2 by A and 3 by B.

A

B

C

1

2

3

Client 1

Client 2

Outline

Modeling hierarchies in collaboration graphs

Subsystems

Subsystem documentation

Subsystems cards

Collaboration graphs

Guidelines for defining subsystems

Recall: Steps for Producing Initial Designs

Identify

Classes

Responsibilities

Collaborations

Analyze

Class hierarchies

Contracts

Collaboration graphs

Motivation: Collaboration Graph

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

Display Device

Input Device

BCR

Output Device

3

5

7

ATM

Form

Menu

User

Message

Window

4

6

9

Observations

Collaboration graphs get very complicated.

Too many lines (i.e., interactions or communications)

Designs become incomprehensible.

How to simplify the design, specifically the patterns of communications?

More specifically, how can we use this to assess coupling and cohesion?

Solution

Need an abstraction tool to provide macro views

Collect classes together to form subsystems that

Behave like a class.

Support services to outside via contracts.

Thus lowering coupling

Are cohesive.

What Are Subsystems?

Groups of cohesive classes that collaborate among themselves to support a set of contracts

Goal: To simplify patterns of communications

i.e., to lower cohesion.

What Are Subsystems? (Cont.)

Subsystems are not super classes.

Subsystems are not “just a bunch of classes.”

Cohesive grouping of classes

Subsystems should provide a good abstraction.

Subsystems should provide a clearly defined interface, called subsystem contracts.

Subsystem Contracts

All contracts supported

by things inside a subsystem

for things outside the subsystem.

Delegation of contracts

Printing

Subsystem

Print Server

Printer

Laser

Printer

InkJet

Printer

1

1

2

Rounded corners to signify a subsystem and not a superclass

Subsystems Benefits

Help us simplify the collaborations graph

Can break down the system into chunks across page in documentation

Easier to understand and analyze

And easier to implement, test and integrate.

Why?

Outline

Modeling hierarchies in collaboration graphs

Subsystems

Subsystem documentation

Subsystems cards

Collaboration graphs

Guidelines for defining subsystems

Subsystem Cards for Documenting Subsystems

Create a card for the subsystem

Write the subsystem name at the top

List all classes in the subsystem

Include ref. to the subsystem’s position in the collaborations graphs

Describe the purpose of the subsystem

List contracts for which it is a server

For each contract, identify the class or subsystem to which the contract is delegated

Subsystem Cards (Cont.)

Subsystem: Drawing Subsystem

Classes: Control Point, Drawing, Drawing Element, …

Collaborations Graphs: see Figure 4-6

Description: Responsible for displaying and maintaining

the contents of the drawing…

Contracts

1. Display itself

Server: Drawing

2. Access and modify the contents of a drawing

Server: Drawing

3. Modify the attributes of a Drawing Element

Server: Control Point

How to Identify Subsystems?

Two approaches

Bottom-up

Top-down

Bottom up

Start with classes and responsibilities

Identify collaborations

Partition the classes based on patterns of collaborations

This approach is useful when managing the complexity as a system grows.

Bottom Up Subsystem Identification

Draw collaboration graph

Can use a white board

Look for strongly coupled classes.

Look for ways to simplify your description of the system.

Look for clean separations.

Look for good abstractions.

How to Identify Subsystems?

Top down

Look at high level functions of system

Look at data sources and uses

Look at supporting technologies

Partition to manage complexity and reduce coupling

This approach may be useful when managing the complexity imposed by the initial specification.

Outline

Modeling hierarchies in collaboration graphs

Subsystems

Subsystem documentation

Subsystems cards

Collaboration graphs

Guidelines for defining subsystems

Guidelines for Simplifying Interactions

Minimize number of collaborations a class has with other classes or subsystems.

Minimize number of classes and subsystems to which a subsystem delegates.

Minimize number of contracts supported by a class or subsystem.

G-1: Minimize Number of Collaborations

Class should collaborate with as few other classes and subsystems as possible.

Why?

Heuristic: Centralize communications

Example

Printing

Subsystem

Print

Server

Printer

Laser

Printer

Color

Printer

1

1

2

3

File

3

Printing

Subsystem

Print

Server

Printer

Laser

Printer

Color

Printer

1

1

2

File

3

G-2: Minimize Delegations of Subsystem Contracts

Keep the number of classes inside the subsystem that support subsystem contracts to a minimum

Why?

Again, centralize communications into and out of the subsystem

G-3: Minimize Number of Contracts

Too many contracts in one place indicate too much intelligence concentrated in one place: split the functionality between two or more classes.

Re-examine the collaboration patterns

Example

Cash

Register

Warehouse

Inventory

Item

Transaction

Log

Accounting

Subsystem

2

1

3

26

Example

Cash

Register

Warehouse

Inventory

Item

Transaction

Log

Accounting

Subsystem

2

1

3

27

p 147 Wirfs-Brock

Example Refined

Cash

Register

Warehouse

Inventory

Item

Transaction

Log

Accounting

Subsystem

2

1

3

1

2

3

Inventory

Subsystem

28

p 147 Wirfs-Brock

Example Refined Further

Inventory

Manager

Cash

Register

Warehouse

Inventory

Item

Transaction

Log

Accounting

Subsystem

2

1

3

4

4

Inventory

Subsystem

29

p 147 Wirfs-Brock

Example Refined Further

Inventory

Manager

Cash

Register

Warehouse

Inventory

Item

Transaction

Log

Accounting

Subsystem

2

1

3

4

4

Inventory

Subsystem

This is a design pattern

(more on this later)

30

p 147 Wirfs-Brock

Iterate to improve the design

Redraw the graphs

Re-examine the collaborations

Walk-through all scenarios

Simplify things

Improve cohesion

Reduce coupling

ATM Example: Contracts

Account: Access and modify balance

Account: commit result to database

Display: Display information

Form: Get numeric value from user

Input Device: accept user input

Menu: Get user selection

Output Device: output to the user

Transaction: execute financial transaction

User Message: display message and wait

Collaboration Graph

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

Display Device

Input Device

BCR

Output Device

3

5

7

ATM

Form

Menu

User

Message

Window

4

6

9

Refining

Account

1

2

Balance

Deposit

Withdrawal

Transfer

Transaction

8

Display Device

Input Device

BCR

Output Device

3

5

7

ATM

Form

Menu

User

Message

4

6

9

Window

Simplified Graph 1

9

6

Financial

Subsystem

8

Display Device

Input Device

BCR

Output Device

3

5

7

ATM

Form

Menu

User

Message

4

Window

Window

Refining

9

6

Financial

Subsystem

8

Display Device

Input Device

BCR

Output Device

3

5

7

ATM

Form

Menu

User

Message

4

Simplified Graph 2

9

6

Financial

Subsystem

8

3

5

7

ATM

4

I/O

Subsystem

User

Interaction

Subsystem

Rework

Rework your design.

If it isn’t changing, you’re not improving.

But do not change just to change, change based on recognition of a better design.

In the real world a good design will translate into a good system.

High Level Design

As we continue to move up we start moving into architecture.

Which as I mentioned earlier is outside of the class..

But what do we look for?

Separation of concerns, Cohesion, Coupling, Design for Change, etc

Attributes: ie., security, scalability, reliability, performance, availability, etc…

Work on your collaboration graphs

Add subsystems

__MACOSX/se_lectures/Day17/._Subsystems.pptx

se_lectures/Day21/Design Patterns Continued.pptx

Design Patterns Continued

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Template Method

Define the skeleton of an algorithm in an operation, deferring some steps to client subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.

Base class declares algorithm 'placeholders', and derived classes implement the placeholders.

Template Method

Superclass captures algorithm, while subclasses implement different behavior

2 Examples

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Strategy

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from the clients that use it.

Capture the abstraction in an interface, hide implementation details in derived classes.

Strategy

Subclass implement different versions of the same algorithm

Client invokes algorithm but it’s the actual implementation is encapsulated

Client only knows interface

Facilitates change towards more algorithms

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

State

Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.

Captures an object-oriented state machine.

Vending Machine Problem

We are writing a controller for a vending machine

The machine has items for sale for 25 cents

The machine takes only quarters

Product delivery

Coin Return Button

Product

Coin Slot

State Transitions

Machine behavior depends on state

At any state you have behavior for all buttons

i.e. what happens if machine is sold out but someone puts a coin in?

Sold-out

Has Coin

No Coin

Dispensing Item

Selected Item

Coin Inserted

Coin Return Pressed

Dispensed Item [empty]

Dispensed Item [not empty]

State Pattern

State and behavior is encapsulated by each subclass

State vs Strategy

Wait a minute..

What is the difference?

Subclasses in the state pattern can switch to other states

Only the context in strategy can switch strategies

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Iterator

Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.

Iterator

Consider a TV remote

When you press “next” or “previous”, what is it doing?

It seeks the next or previous available channel frequency.

It is not sequential, the implementation is not trivial.

This encapsulates the actual implementation of traversing this collection.

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Mediator

Define an object that encapsulates how a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.

Mediator

A picture is worth a thousand words:

Airplane

Airplane

Airplane

Airplane

Airplane

Control Tower

Mediator

A picture is worth a thousand words:

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Proxy

Provide a surrogate or placeholder for another object to control access to it.

Useful for avoiding instantiating expensive/complicated objects unless they’re really needed.

Proxy fakes it until it can make it.

Proxy

Best example:

Once real subject is needed, it can be swapped in. i.e., wedding day.

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Factory Method

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses

Factory Method

So..

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Abstract Factory

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.

Abstract Factory

Example:Pizza

NY Style, Chicago Style, California Style

Product

Family

Product

Family

Concrete Factory

Builds ingredient family

Factory Method vs Abstract Factory

Factory Method

One product family

Uses inheritance to rely on subclass to handle desired object creation

Single method

Abstract Factory

Creates family of products

Class delegates responsibility of object instantiation to another object by composition

Object handles creation

So…. Time to speed it up…

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Builder

Separate the construction of a complex object from its representation so that the same construction process can create different representations.

Builder Example

This pattern is used by fast food restaurants to construct children's meals.

Children's meals typically consist of a main item, a side item, a drink, and a toy (e.g., a hamburger, fries, drink beverage, and toy dinosaur).

Whether a customer orders a hamburger, cheeseburger, or chicken, the process is the same.

The employee at the counter directs the crew to assemble a main item, side item, and toy. These items are then placed in a bag. The drink is placed in a cup and remains outside of the bag.

Prototype

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.

Prototype Example

Build an artifact based on an existing artifact.

For example, if someone asks you to build a presentation on design patterns what would you do?

Copy this presentation and modify to your liking.

This artifact is the prototype. You will save time and effort this way.

Command

Encapsulate a request as an object, thereby letting you parametrize clients with different requests, queue or log requests, and support undoable operations.

Command Example

Restaurant with a waiter service.

You order food and bar drink.

Waiter takes order to bartender, bartender processes it’s applicable section (the drink), waiter passes the rest to kitchen staff to make your food.

Memento

Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later

Memento Example

Say you want to make changes to your homework.

But you want to save the original copy in case you don’t like your changes.

You store a copy in a USB memory stick.

Make changes, don’t like changes.

Restore backup from USB.

Observer

Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.

Observer Example

Posting a message in Facebook.

When others comment you will be alerted.

Then you can go and read the comment (and update your state).

Interpreter

Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.

….So…. Fast……

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Visitor

Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.

Visitor Example

Consider a taxi.

Customer calls for a taxi, which arrives to the customer.

Once the customer sits in, the visiting taxi is in control of the transport for that person. 

Bridge

Decouple an abstraction from its implementation so that the two can vary independently.

Bridge

Decouple an abstraction from its implementation so that the two can vary independently

Chain of Responsibility

Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.

Chain the receiving objects and pass the request along the chain until an object handles it.

Composite

Compose objects into tree structures to represent whole-part hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.

Decorator

Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.

Flyweight

Use sharing to support large numbers of fine-grained objects efficiently.

Done!

Abstract Factory

Builder

Factory Method

Prototype

Singleton

Adapter

Bridge

Composite

Decorator

Façade

Flyweight

Proxy

Chain of Responsibility

Command

Interpreter

Iterator

Mediator

Memento

Observer

State

Strategy

Template Method

Visitor

Words of wisdom

Design Patterns are beautiful in paper

It can be a struggle to translate to practicality

Not everyone is at the same level of understanding

Installed at design time, easily broken at maintenance time

My advice, master the fundamentals and they will come easily.

Low coupling, high cohesion!

__MACOSX/se_lectures/Day21/._Design Patterns Continued.pptx

se_lectures/Day19/.DS_Store

__MACOSX/se_lectures/Day19/._.DS_Store

se_lectures/Day19/SDD v2.0-4.doc

EngineSoft

image1.jpg<Ontology Management Service>

Software Design Document

Version <2.0>

5/7/2006

Document Control

Approval

The Guidance Team and the customer shall approve this document.

Document Change Control

Initial Release:

March 4, 2006

Current Release:

May 6, 2006

Indicator of Last Page in Document:

Date of Last Review:

May 6, 2006

Date of Next Review:

May 9, 2006

Target Date for Next Update:

May 9, 2006

Distribution List

This following list of people shall receive a copy of this document every time a new version of this document becomes available:

Guidance Team Members:

Dr. Ann Gates

Salamah, Salamah

Omar Ochoa

Customer: Leonardo Salayandia

Dr. Randy Keller

Software Team Members:

Alejandro Castaneda

Kendra Kramer

Elizabeth Lujan

Tomas Meza

Julio Olaya

Change Summary

The following table details changes made between versions of this document

Version

Date

Modifier

Description

1.0

3/03/2006

Alejandro Castaneda, Julio Olaya, and Tomas Meza

Kendra Kramer

Decomposition Description and Dependency Description.

Introduction, Decomposition Description, and Dependency Description.

1.1

03/12/06

Alejandro Castaneda, Julio Olaya, and Tomas Meza, Elizabeth Lujan

Addition of file subsystem, completion of visualization subsystem, authorization class, and managers for reducing coupling of OMS services subsystem (before Ontology Metadata Subsystem).

1.1-01

03/24/06

Alejandro Castaneda, Julio Olaya, and Tomas Meza, Elizabeth Lujan

Work in the detail design for database, OMS services , visualization.

1.1-02

03/28/06

Alejandro Castaneda

Converting pictures into jpeg. Update to OMS Services subsystem.

1.2-03

03/29/06

Kendra Kramer

Alejandro C and Elizabeth L, Julio Olaya

Tomas M and Kendra K

Tomas M. and Alejandro Castaneda

Changes to File Subsystem

Changes to Visualization Subsystem, Security

Changes to Database Subsystem

Changes to OMS Services subsystem

2.0-1

4/20/2006

Alejandro C

Modified Database subsystem in the decomposition, dependency, detailed descriptions. Corrected some errors in collaboration graphs for Database Subsystem, Metadata Handler Subsystem (previously OMS Services Subsystem), and the email subsystem.

2.0-2

5/2/06

Alejandro C

Modified File and Visualization subsystems to reduce number of contracts.

2.0-3

5/4/06

Alejandro C

Modified informal and formal specifications for the database subsystem protocols from last section.

2.0-4

5/7/06

Alejandro C.

Included new Web Services subsystem. Last review to entire document before presentation.

Table of Contents

ii Document Control

ii Approval

ii Document Change Control

ii Distribution List

ii Change Summary

6 1. Introduction

6 1.1. Purpose and Intended Audience

6 1.2. Scope of Product

6 1.3. References

7 1.4. Definitions, Acronyms, and Abbreviations

8 1.4.1. Acronyms

8 1.4.2. Abbreviations

9 2. Decomposition Description

10 2.1. Database Management Subsystem

11 2.2. User Security Subsystem

12 2.3. Visualization Subsystem

12 2.3.1. Owl to Graphical Representation Subsystem

13 2.3.2. Graphical to OWL Translation Subsystem

14 2.4. Metadata Handler Subsystem

15 2.5. E-Mail Subsystem

16 2.6. File Subsystem

17 2.7. OMS Web Services Subsystem

18 2.8. Hierarchy Graphs

19 3. Dependency Description

20 3.1. Database Management Subsystem

22 3.2. User Security Subsystem

23 3.3. Visualization Subsystem

23 3.3.1. Owl to graphical translation subsystem

24 3.3.2. Graphical to Owl Translation Subsystem

25 3.4. Metadata Handler Subsystem

26 3.5. E-Mail Subsystem

27 3.6. File Subsystem

28 3.7. OMS Web Services Subsystem

29 4. Detailed Design

29 4.1. Database Management Subsystem

33 4.2. User Security Subsystem

35 4.3. Visualization Subsystem.

35 4.3.1. OWL to Graphical Representation System

42 4.3.2. Graphical to OWL Translation Subsystem

43 4.4. Metadata Handler Subsystem

46 4.5. E-Mail Subsystem

47 4.6. File Subsystem

52 4.7. OMS Web Services Subsystem

55 5. Formal Description

55 5.1. Visualization Subsystem: Class XMLTreeParser

55 5.1.1. Formal Specification

55 5.1.2. Informal Specification

55 5.2. File Subsystem: Class FileHandler

55 5.2.1. Formal Specification

56 5.2.2. Informal Specification

56 5.3. Database Management Subsystem: Class QueryCreator

56 5.3.1. Formal Specification

57 5.3.2. Informal Specification

57 5.3.3. Formal Specification

57 5.3.4. Informal Specification

57 5.4. User Security Subsystem: Class Authentication

57 Formal Specification

58 5.4.1. Informal Specification

1. Introduction

1.1. Purpose and Intended Audience

The purpose of this document is to provide an overview of how the Ontology Management Service (OMS) is designed to which it provides a thorough view that will be used for understanding implementation details. The Software Design Document (SDD) describes how the subsystems for the OMS have been structured, along with contracts and collaborations within the subsystems. The intended audience of the SDD are customers and developers. The SDD serves as a way to inform the customer of how software developers are designing what the customer states in the Software Requirements Specification document (SRS). For the software developers, the SDD serves as a detailed analysis of the system that will be of reference for implementation.

1.2. Scope of Product

GEOsciences Network (GEON) is an NSF-funded IT research program to conduct fundamental research towards developing a cyber-infrastructure for the earth science community. The goal of GEON is to provide advanced information technologies that support intelligent searching, integration, visualization, analysis, and modeling of datasets. In addition, GEON provides high performance computing platforms required to analyze and model such datasets; thus, facilitating the interdisciplinary collaboration of earth science community efforts.

The University of Texas at El Paso Departments of Computer Science and Geology Department are collaborating to develop a service-oriented Ontology Management Service (OMS) that will maintain ontologies about the resources available on the GEON Network. The OMS will be integrated into the GEON cyber-infrastructure as a service such that other applications or services can use the OMS functionality. GEON resources are broadly classified as data, methods, and products, and are distributed geographically and organizationally across the GEON Network partner sites. The purpose of the ontologies is to maintain knowledge about the GEON resources in order to facilitate their discovery and integration. The OMS will manage the ontologies and provide client applications with the following services:

· Retrieve that will allow users to navigate through the available ontologies in search of concepts and corresponding resources as well as search for concepts and corresponding resources based on keyword queries.

· Contribute that will allow contributors to create new ontologies and/or propose modifications to existing ontologies.

· Validate that will allow domain-experts to control the contribution process of ontologies by providing functionality to accept and reject new contributions [1].

There will be a separation between services provided by the OMS. It is not the responsibility of the OMS to provide visualization; visualization will be provided by a separate client application outside the OMS.

1.3. References

[1] Guidance Team, “Software Requirement Specification,” University of Texas at El Paso, Spring 2006.

1.4. Definitions, Acronyms, and Abbreviations

TERM

DEFINITION

Client Application

A software application external to our system that a user will utilize to interact with the OMS.

Concept

It is represented as a class, a concept facilitates the description of a domain of knowledge.

Contribution

It refers to either a newly created ontology, or a modified existing ontology.

Dictionary

Dictionary that maintains relationship name, synonym, description of the relationship, and inverse relationship name.

Domain Concept

For a relation R(x,y), the domain concept is signified by x.

Implied relationship

A relationship that is inherited from a parent concept; also referred to as a child relationship.

Metadata

Information that describes another set of data. For ontology, the metadata is the information stored in the Metadata Table.

MySQL

Open source relational database management system [13].

Ontology

It refers to the explicit description of concepts in a domain closure and relations among them.

Range

Allowed classes for slots of type instance are the range of a slot.

Range Concept

For a relation R(x,y), the range concept is signified by y.

Repository

A storage place where an ontology and dictionary are stored.

Resources

Classification of concepts into data, methods, and products.

Taxonomical hierarchy

Hierarchy of classes (concepts) represented as superclasses and subclasses.

User

The superset of the following types of user: general, validator, and contributor.

Web Service

Also called application services, they are services (usually including some combination of programming and data, but possibly including human resources as well) that are made available from a business’s Web server for Web users or other Web-connected programs.

Root

The starting node of a tree that has no parent

Parent Node

A node that has children.

Child Node

A node that has a parent. Nodes below the parent node that are located to the left and right side and share that same parent node

Table 1: Definition Table

1.4.1. Acronyms

Acronym

Description

DAML

DARPA Agent Markup Language

DBMS

Database Management System

DB

Database

RPC

In SOAP protocol means Remote Procedure Call which is the name of the method and arguments with parameters that a user wants to invoke.

FS

File Subsystem

GEON

Geosciences Network

OIL

Ontology Interchange Language

OMS

Ontology Management System

OWL

Ontology Web Language

RDF

Resource Description Framework

SQL

Structured Query Language

URI

Universal Resource Identifier

XML

Extensible Markup Language

Pwd

Password

Table 2: Acronyms Table

1.4.2. Abbreviations

ABBREVIATION

MEANING

cf.

Confer (or Compare)

e.g.

For example

i.e.

Such as

info.

Information

Table 3: Abbreviations Table

2. Decomposition Description

The purpose of this section is to present the subsystems that comprise the OMS. Figure 1 presents a high-level view of the collaborations among the subsystems that comprise the OMS. The next subsections will present descriptions of such subsystems and their respective classes.

image2.jpg

Figure 1. High-level Collaboration Graph of OMS

2.1. Database Management Subsystem

The Database Management Subsystem contains classes that perform queries, obtain results, and transform the results obtained from the database. The lists of classes are the following:

Concrete Class: DBManager - manages access to the database by requesting a creation of an SQL query, submitting the queries, and formatting query results.

Superclass: none

Subclass: none

DS 1) Query database

Retrieve data from database QueryBuilder(QB 1) , QueryExecutor(QE 1)

Modify data in Database QueryBuilder(QB 1) , QueryExecutor(QE 1)

Private responsibilities:

Know last query executed.

Superclass: QueryBuilder - builds queries of type select or modify such as select, insert, delete, and update.

Superclass: none

Subclasses: SelectorQueryBuilder, ModifierQueryBuilder.

QB 1) Create SQL query

Create SQL query

Private responsibilities

Know if the query was successfully created.

Concrete Class: SelectorQueryBuilder - provides the functionality for building a query of type select

Superclass: QueryBuilder

Subclass: none

Create SQL query of type SELECT

Concrete Class: ModifierQueryBuilder - provides the functionality for building queries of type Insert, Delete, and Update.

Superclass: QueryBuilder

Subclass: none

Create SQL query of type INSERT, DELETE, UPDATE SQL

Abstract Class: DBConnector - represents an object with capabilities for connecting to, retrieve, and modify

information from a database. It is the abstract representation of a database connector.

Superclass: None

Subclass: MySqlDBConnector

DBC 1) Execute query.

Open database connection

Execute query

Close database connection

Private Responsibilities:

Know connection string.

Know how to connect to database instance.

Concrete Class: MySqlDBConnector – Connects, retrieves, and modifies information from a MySQL database.

Superclass: DBConnector

Subclass: none

Open MySQL database connection

Execute query

Close MySQL database connection

Concrete Class: QueryExecutor – Coordinates the execution of an SQL query by requesting the execution and

transformation of results from an SQL query for data retrieval or modification from database.

Superclass: none

Subclass: none

QE 1) Coordinate query execution and result transformation.

Request query execution DBConnector (DBC 1)

Request transformation of result QueryResultFormatter (QRF 1)

Private Responsibilities:

Know database connector to be used according to DBMS type.

Concrete Class: QueryResultFormatter - transforms query results from database in order to provide a readable format to clients.

QRF 1) Transform results obtained from database

Format results

2.2. User Security Subsystem

The User Secuirity Subsystem contains classes that facilitate the authorization to users requesting access to OMS resources.

Concrete Class: Authorization - allows users to access OMS services based on access level.

Superclass: none

Subclass: none

USS 1) Authorize user request based on user’s access level

Request retrieval of user authentication

information from SOAP message SecurityTokenManager (STM 1)

Request encrypted password and

access level from database MetadataHandlerSubsystem (MHS 1)

Authorize user request

Private Responsibilities:

Know encryption algorithm

Concrete Class: SecurityTokenManager – Retrieve user security information from security token from SOAP message.

Superclass: none

Subclass: none

STM 1) Retrieve security token from SOAP message

Retrieve security token from SOAP message.

2.3. Visualization Subsystem

The visualization Subsystem provides functionality for translation between formats of ontology representation. In other words, this subsystem contains classes that translate an ontology in OWL representation into a graphical representation. In addition, this group of classes also have functionality for translating a graphical representation of an ontology into an OWL representation. Therefore, this subsystem is composed of two more subsystems. Each subsystem will contain classes that will translate an ontology across different representational formats. The following are inner subsystems to the visualization subsystem followed by their corresponding classes.

2.3.1. Owl to Graphical Representation Subsystem

This subsystem contains classes that specialize in translating an OWL representation of an ontology into a graphical representation.

Concrete Class: VisualizationManager – Redirects user requests to a specific ontology transformation such as from owl to graphical, and graphical to owl representations

VS 1) Transform ontology representation

Owl to graphical translation OWLtoGraphTranslationManager (OGTM 1)

Graphical to Owl translation GraphtoOWLTranslationManager (GOTM 1)

Concrete Class: OWLtoGraphTranslationManager - coordinates the steps that need to be followed in order to create a graphical representation of an ontology out of an OWL representation.

OGTM 1) Create ontology graphical representation from Owl file

Create XML tree structure XMLTree (XT 1)

Obtain data out of XML tree nodes XMLTreeParser (XTP 1)

Display ontology overall structure OntologyShapeDrawer (OSD 1)

Concrete Class: XMLTree- provides functionality to access an XMLTree structure by creating a tree structure

representation out of an XML file based on a specific schema.

Superclass: none

Subclass: none

XT 1) Provide access to XML tree structure

Provide access to XML tree

Private Responsibilities

Create XMLTree out of XML file

Concrete Class: ConceptDataExtractor- provides functionality to extract data contained by an XMLNode.

Superclass: none

Subclass: none

CDE 1) Obtain data out of XML tree nodes

Extract nodes data

Concrete Class: XMLTreeParser - traverses the tree structure in order to extract the contents of a node from an XML tree structure. This information is used to instantiate respective classes for ontology graphical representation.

Superclass: none

Subclass: none

XTP 1) Traverse XML tree structure

Traverse the XML tree structure

Instantiate ontology shape components

Private Responsibilities

Contain XMLTree

Concrete Class: OntologyShapeDrawer - Coordinates the drawing of the overall structure of the ontology.

Superclass: none

Subclass: none

OSD 1) Display ontology overall structure

Request the drawing of ontology component instances

AbstractClass: OntologyShape - provides a generic method for drawing a shape and will require subclasses to implement this method for drawing a specific kind of ontology component. It contains basic attributes that an ontology shape share such as color, dimensions, and position.

Superclass: none

Subclass: RelationshipShape, ConceptShape, NoteShape

OS 1) Draw ontology component shape

Create ontology component graphical representation

Private Responsibilities

Know color (background, foreground, linecolor)

Know position on screen

Know dimensions

Concrete Class: Concept Shape - draws the shape that corresponds to a concept with its appropriate color and size.

Superclass: OntologyShape

Subclass: none

Know concept category (data, method, product)

Know parents

Know siblings

Concrete Class: NoteShape - draws the small rectangle shape (note) that will be used for container of the list of relationships between concepts with its appropriate color and size.

Superclass: OntologyShape

Subclass: none

Know concept to be attached to.

Concrete Class: Relationship Shape - draws the arrow between domain concept and range concept.

Superclass: OntologyShape

Subclass: none

Know relationship type

Know direction or relationship

Know domain concept

Know range concept

2.3.2. Graphical to OWL Translation Subsystem

This subsystem contains classes that specialize in translating a graphical representation of an ontology into OWL representation.

Concrete Class: GraphtoOWLTranslationManager – Coordinates the translation of a graphical representation to OWL format file.

Superclass: none

Subclass:none

GOTM 1) Create Owl file from ontology graphical representation

Request writing of XML tree to Owl file XMLTreeToOWL (XTO 1)

Request validation of XML file XMLValidator (XV 1)

Concrete Class: XMLTreetoOWL – Creates an XML file containing the information stored by an XML tree.

Superclass: none

Subclass:none

XTO 1) Write XML tree to OWL file

Write XML tree to OWL file

Private responsibilities

Know how to traverse/parse XML tree structure

Knows how to create OWL files

Concrete Class: XMLValidator – Validates an XML file according to a schema.

Superclass: none

Subclass:none

XV 1) Validate XML file according to schema

Validate XML file according to schema

2.4. Metadata Handler Subsystem

The Metadata Handler Subsystem servers as a mediator between the OMS Services subsystem and the database for retrieval or modification of data from the database.

Concrete Class: MetadataManager – coordinates the operations for contribution, validation and browsing of ontologies’ information from database. In addition, this class coordinates the manipulation of ontologies’ files, and is responsible for sending notifications about the status of an ontology whenever it is necessary.

Superclass: none

Subclass:none

MHS 1) Coordinate ontology information operations

Request the retrieval and/or manipulation of

ontology information from database. MetadataHandler (MH 1)

Request the retrieval and/or manipulation of

ontology information from file subsystem. File Subsystem (FS 1)

Request sending of ontology status notification E-Mail Subsystem (EMS 1)

AbstractClass: MetadataHandler - allows other subsystems to retrieve and modify information from the database.

Superclass: none

Subclass: UserMetadataHandler, OntologyMetadataHandler, ChangeRequestMetadataHandler, RelationshipMetadataHandler, SynonymsMetadataHandler.

MH 1) Query database

Query database DatabaseManagementSubsystem (DS 1)

Concrete Class: UserMetadataHandler - retrieves user authentication information such as user password and user access level, as well as contact information. In addition, this class has the private responsibility for knowing table for accessing user metadata.

Superclass: MetadataHandler

Subclass: none

Retrieve user authentication information

Retrieve user contact information

Private Responsibility

Know table that contains user metadata.

Concrete Class: OntologyMetadataHandler - provides the functionality of retrieving or modifying an ontology (ies), and it has the private responsibility for knowing the table for accessing an

ontology (ies) metadata.

Superclass: MetadataHandler

Subclass: none

Retrieve ontology metadata

Modify ontology metadata

Private Responsibility

Know table that contains ontology metadata

Concrete Class: ChangeRequestMetadataHandler - provides the functionality of retrieving or modifying change request information for ontology changes that belong to a contribution, and it has the private responsibility for knowing the table for accessing change requests metadata.

Superclass: MetadataHandler

Subclass: none

Retrieve Change request information from database

Modify Change request information from database

Private responsibility

Know table that contains ‘Change Requests’ metadata

Concrete Class: RelationshipMetadataHandler - provides the functionality of retrieving or modifying information for an ontology dictionary, and it has the private responsibility for knowing the

table for accessing dictionary metadata.

Superclass: MetadataHandler

Subclass: none

Retrieve Relationship information from database

Modify Relationship information from database

Private responsibility

Know table that contains Relationship metadata

Concrete Class: SynonymsMetadataHandler - provides the functionality of retrieving or modifying change request information for ontology synonyms, and it has the private responsibility for knowing the table for accessing synonyms metadata.

Superclass: MetadataHandler

Subclass: none

Retrieve Relationship synonyms information from database

Modify Relationship synonyms information from database

Private responsibility

Know table that contains relationship synonyms metadata

2.5. E-Mail Subsystem

The E-Mail subsystem facilitates the sending of e-mails to authorized users. The following are the classes for this subsystem:

Concrete: EmailCreator – provides required functionality for creation of an e-mail notification.

Superclass: none

Subclass: none

EC 1) Create e-mail notification

Create e-mail notification

Private Responsibilities:

Know e-mail’s body content

Concrete: EmailSender - provides required functionality for sending e-mail notifications.

Superclass: none

Subclass: none

EMS 1) Send e-mail notification

Connect to e-mail server

Request creation of Email EmailCreator (EC 1)

Send e-mail notification

Private Responsibility

Know e-mail server information

2.6. File Subsystem

The File Subsystem manages the files contained by file server of the data store:

Concrete Class: FileTransactionManager – Manages requests of file transactions operations such as downloads,

uploads of files to file server, and manipulation of files within file server.

Superclass: none

Subclass: none

FS 1) Manage requests of file transactions and file operations within file server

Process external file transactions requests FileHandler (FH 1)

Process internal file transactions FileTransfer (FT 1)

Abstract Class: FileSystemAccessor - allows its subclasses to connect to the file server. It has the private responsibility of knowing the file server information.

Superclass: none

Subclass: FileHandler, FileTransfer

Connect to file server

Disconnect from file server

Private Responsibilities:

Know file server name.

Concrete Class: FileHandler – provides required functionality for manipulating files in the file server.

Superclass: FileSystemAccesor

Subclass: none

FH 1) Manipulate files in File Server

Delete files from file server

Copy files from local file server

Move files within local file server

Concrete Class: FileTransfer – provides required functionality for processing file attachments between OMS and

client application.

Superclass: FileSystemAccessor

Subclass: none

FT 1) Process file transactions between OMS and client application

Upload files to file server through MTOM attachment in SOAP message

Download files from server through MTOM attachment in SOAP message

Private Responsibilities:

Know how to create MTOM attachments.

2.7. OMS Web Services Subsystem

Abstract Class: SecureService – provides required functionality for authorizing user requests for accessing a

specific service

Superclass: None

Subclass: Contribute, Validate

Authorize user request.

Concrete Class: Browse – Web service that provides required functionality for retrieval of ontologies’ information.

Superclass: SecureService

Subclass: none

OWSS 1) Retrieve information about existing ontologies

Retrieve information about existing ontologies. Metadata Handler Subsystem (MHS 1)

Concrete Class: Contribute – Web service that provides required functionality for retrieval and modification of

ontologies’ information.

Superclass: SecureService

Subclass: none

OWSS 2) Contribute to OMS by modifying ontologies’ information.

Retrieve information about existing ontologies. Metadata Handler Subsystem (MHS 1)

Modify information about existing ontologies Metadata Handler Subsystem (MHS 1)

Concrete Class: Validate – Web service that provides required functionality for validation of contributions to the

OMS.

Superclass: SecureService

Subclass: none

OWSS 3) Validate contributions to OMS Retrieve information about existing ontologies. Metadata Handler Subsystem (MHS 1)

Modify information about existing ontologies Metadata Handler Subsystem (MHS 1)

2.8. Hierarchy Graphs

This section shows the hierarchy graph for the classes that comprise the subsystems of the OMS. Fig 2 presents such hierarchy graph.

image3.jpg

Fig 2: Hierarchy graph for the classes comprising the OMS

3. Dependency Description

This section describes the interaction among subsystems and the different interaction and dependencies that each class has with its linked subsystem. In addition, this section shows the names of the sever and client(s) that collaborates with each contract according to the associated subsystem or class. Figure 3 presents a more detailed collaboration graph of the OMS subsystem and the interactions among them. Figures 4-10 show such subsystems in more detail.

image4.jpg

Figure 3: Collaboration graph for the Ontology Management Service

3.1. Database Management Subsystem

The database Management Subsystem has the following contracts that can be observed in Figure 3.

Contract < DS 1 > : Query database

Server: Database Management Subsystem

Clients: Metadata Handler Subsystem

Description: This contract allows clients of contract to query the database in order to obtain specific information and receive a transformation of the results in a format compatible for the requestor of the contract.

Contract < QB 1 > : Create SQL query

Server: QueryBuilder

Clients: DBManager

Description: This contract creates an SQL query that will be used by the DBManager to request the query’s execution.

Contract < QE 1 > : Coordinate query execution

Server: QueryExecutor

Clients: DBManager

Description: This contract will allow the DBManager to execute a query through a pre-established database connection. After the result is obtained from the DBMS, the QueryExecutor will request the formatting of such result prior returning such information to the DBMS.

Contract < DBC 1 > : Execute query

Server: DBConnector

Clients: QueryExecutor

Description: This contract will allow the execution of a query to a database regarding of the DBMS type.

Contract < QRF 1 > : Transform results obtained from database

Server: QueryResultFormatter

Clients: QueryExecutor

Description: This contract will allow the QueryExecutor to request and receive a new formatted representation of the result obtained from executing a query.

image5.jpg

Figure 4: Collaboration graph for the Database Management Subsystem

3.2. User Security Subsystem

The User Security Subsystem has the following contracts that can be observed in Figure 5.

Contract < USS 1 > : Authorize user request based on user’s access level

Server: User Security Subsystem

Clients: Web Services Subsystem

Description: This contract authorizes users to access OMS resources based on access level.

Contract < STM 1 > : Retrieve security token information from SOAP message

Server: SecurityTokenManager

Clients: Authentication

Description: This contract will allow the retrieval of user credentials from SOAP messages.

image6.jpg

Fig 5: Collaboration graph for the Authentication Subsystem

3.3. Visualization Subsystem

The database Visualization Subsystem is composed of two inner subsystems and has the following contracts that can be observed in Figure 6.

Contract < VS 1 > : Redirects user requests to a specific ontology transformation such as from owl to graphical, and graphical to owl representations

Server: Visualization Subsystem

Clients: Client Application

Description: This contract will allow a client application to be redirected to a desired ontology

transformation.

3.3.1. Owl to graphical translation subsystem

Contract < OGTM 1 > : Create ontology graphical representation from Owl file

Server: Visualization Subsystem

Clients: Client Application

Description: This contract will allow a client application to request and receive a graphical representation of an ontology out of an Owl representation of the ontology.

Contract < XT 1 > : Provide access to XML tree structure

Server: XMLTree

Clients: OWLtoGraphTranslator

Description: This contract will provide access to functionality related to an XMLTree such as the creation and traversal of the structure of the XMLTree

Contract < XTP 1 > : Traverse XML tree structure

Server: XMLTreeParser

Clients: OWLtoGraphTranslator

Description: This contract will traverse the structure of an XML tree in order to obtain the data necessary for instantiation of ontology components’ shapes.

Contract < CDE 1 > : Obtain data out of XML tree nodes

Server: ConceptDataExtractor

Clients: XMLTreeParser

Description: This contract will extract the data from the XML node.

Contract < OSD 1 > : Display ontology overall structure

Server: OntologyShapeDrawer

Clients: OWLtoGraphTranslator

Description: This contract will generate a graphical representation of an ontology by making use of the information obtained from parsing an XML tree and instantiating the corresponding ontology components’ shapes.

Contract < OS 1 > : Draw ontology component shape

Server: OntologyShape

Clients: OntologyShapeDrawer

Description: This contract will allow an ontology component shape to draw itself using the correct information in order to create the appropriate graphical representation of the ontology component. Each component will have its own specific way of drawing itself.

3.3.2. Graphical to Owl Translation Subsystem

Contract < GOTM 1 > : Create Owl file from ontology graphical representation

Server: Visualization Subsystem

Clients: Client Application

Description: This contract will allow a client application to request and receive an Owl representation out of a graphical representation of an ontology.

Contract < XTO 1 > : Write XML tree to OWL file

Server: Visualization Subsystem

Clients: GraphtoOWLTranslationManager

Description: This contract will allow to obtain an XML file throuhg translation of an XML tree into OWL format.

Contract < XV 1 > : Validate XML file according to schema

Server: GraphtoOWLTranslationManager

Clients: Client Application

Description: This contract will allow the validation of an XML file (ontology) according to a specified schema.

image7.jpg

Figure 6: Collaboration graph for the Visualization subsystem

3.4. Metadata Handler Subsystem

The Metadata Handler Subsystem has the following contracts that can be observed in Figure 7.

Contract < MHS 1 > : Coordinate ontology information operations

Server: Metadata Handler Subsytem

Clients: Web Services Subsystem

Description: This contract will coordinate the operations for contribution, validation and browsing of

ontologies’ information from database. In addition to the manipulation of ontologies’ files, and the sending notifications about the status of an ontology whenever it is necessary.

Contract < MH 1 > : Query database

Server: Metadata Handler Subsystem

Clients: User Security Subsystem, E-mail Subsystem., OMS Services Subsystem

Description: This contract will allow the querying of the database for retrieval or modification of data contained in the database.

image8.jpg

Fig 7: Collaboration graph for the Database Metadata Subsystem

3.5. E-Mail Subsystem

The database E-Mail Subsystem has the following contracts that can be observed in Figure 8.

Contract < EMS 1 > : Send e-mail notification to user

Server: E-Mail Subsystem

Clients: Metadata Handler Subsystem

Description: This contract will allow the OMS Services Subsystem to immediately notify an authorized user about the status of a new contribution. This contract request the creation of the e-mail

notification before sending it.

Contract < EC 1 > : Create e-mail notification

Server: EmailCreator

Clients: EmailSender

Description: This contract will create the contents of an e-mail notification such as the notification of the

status of a contribution, and/or the reception of a new contribution.

image9.jpg

Fig 8: Collaboration graph for the E-Mail Subsystem

3.6. File Subsystem

The File Subsystem has the following contracts that can be observed in Figure 9.

Contract < FS 1 > : Manage requests of file transactions and file operations within file server

Server: File Subsystem

Clients: Metadata Handler Subsystem

Description: This contract will allow its clients to perform file transactions (i.e. download, upload) from file server.

Contract < FT 1 > : Process file attachments between OMS and client application

Server: File Subsystem

Clients: FileTransactionManager

Description: This contract will allow its clients to perform file transactions (i.e. download, upload) from file server.

Contract < FH 1 > : Manipulate files in File Server

Server: FileHandler

Clients: FileTransactionManager

Description: This contract will allow the manipulation files in the file server (i.e move, delete, copy).

image10.jpg

Fig 9: Collaboration graph for the File Subsystem

3.7. OMS Web Services Subsystem

Contract < OWSS 1 > : Retrieve ontologies’ information to user.

Server: OMS Web Services Subsystem

Clients: Client Application

Description: This contract will allow the retrieval of existing ontologies’ information.

Contract < OWSS 2 > : Contribute to OMS by modifying ontologies’ information.

Server: OMS Web Services Subsystem

Clients: Client Application

Description: This contract will allow to contribute to the OMS by the requesting of modification to

existing ontologies’ information.

Contract < OWSS 3 > : Validate contributions to OMS

Server: OMS Web Services Subsystem

Clients: Client Application

Description: This contract will allow the validation of contributions to OMS

image11.jpg

4. Detailed Design

This section provides an internal description of classes according to its subsystems, and presents the pre-condition, post-condition, signature of the methods contained in each class.

4.1. Database Management Subsystem

Class: DBManager

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <4>.

Description: manages access to the database by requesting a creation of an SQL query, submitting the queries, and formatting query results

Contracts: DS 1 - Query database

Private Variables:

lastStoredProcedureExecuted

public QueryBuilder RequestQueryCreation(String[] query)

Data: query – an array of strings containing:

index 0: query type

index 1: table name

index 2: the fields of the table to be used for the creation of the query

index 3: the constraints for the query

Purpose: Request the creation of a Query to a table in database

Pre-condition: The length of the argument ‘query’ must be 4. The argument ‘query’ and its contents are not null; Cells from query[0] to query[2] cannot contain an empty string.

Post-condition: Db remains unchanged, stored procedure in QueryBuilder object has been correctly

created with the data passed by the query array.

Returns: a QueryBuilder object that contains a stored procedure as specified by the contents of ‘query’

public DataSet RetrieveDataFromDatabase(String[] query)

Data: query - Array of Strings that contains:

index 0: query type

index 1: table name

index 2: the fields of the table used for the creation of the query

index 3: the constraints for the query.

Purpose: Retrieves data from the database

Pre-condition: query.length()== 4; query is not null; no element in query is null. Strings passed

for query construction cannot be an empty strings. Query[0] must be “select”.

Post-condition: Query is passed to a SelectorQueryBuilder for construction of a SELECT SQL query, and then sent to the QueryExecutionManager for execution of the query.

Returns: DataSet object containing the results from executing the query

Uses:

DBManager.RequestQueryCreation(String[])

DBManager.RequestQuerySelectorExecution(String)

public int ModifyDataInDatabase(String[] query)

Data: query - Array of Strings that contain:

index 0: query type

index 1: table name

index 2: the fields of the table used for the creation of the query

index 3: the constraints for the query.

Purpose: Modifies data in the database

Pre-condition: query.length()== 4; query is not null; no element in query is null. Strings passed

for query construction cannot be an empty strings. Query[0] must be “delete, update, or insert”.

Post-condition: is passed to a SelectorQueryBuilder for construction of a DELETE, UPDATE, or INSERT SQL query, and then sent to the QueryExecutionManager for execution of the query.

Returns: An integer representation of the number of rows affected by the query executed.

Uses:

DBManager.RequestQueryCreation(String[])

DBManager.RequestQueryModifierExecution(String)

private int RequestQueryModifierExecution(String query)

Data: query - String representation of an SQL query

Purpose: Requests the execution of a INSERT, DELETE, or UPDATE SQL query.

Returns: integer representation of the number of rows affected by executing

Uses:

QueryExecutor.ExecuteModifierQuery(String)

private int RequestQuerySelectorExecution(String query)

Data: query - String representation of an SQL query

Purpose: Requests the execution of a SELECT SQL query.

Returns: A DataSet object containing the results from retrieving data from database

Uses:

QueryExecutor.ExecuteModifierQuery(String)

private DataSet RequestResultTransformation(DataSet dataset)

Data: dataset – A DataSet object whose contents will be transformed.

Purpose: Requests the transformation of results from dataset

Returns: A DataSet object containing the results from retrieving data from database

Uses:

QueryResultFormatter.ResultTransformation(DataSet)

Class: QueryBuilder

Superclasses: none

Subclasses: SelectorQueryBuilder, ModifierQueryBuilder

Collaboration Graphs: See Figure <4>.

Description: builds queries of type select or modify such as select, insert, delete, and update.

Contracts: QB 1 - Create SQL query

Private Variables:

String storedProcedure – String representation of stored procedure

String procedureType – Stop procedure’s type

String tableName – Name of the table to be queried

String constraints - Constraints applied to the query

String fields - Columns from the table where this query will be performed.

Bool procedureCreated – Boolean representing the status of the query creation

public void createQuery(String[] query)

Data: query – an array of strings containing:

index 0: query type

index 1: table name

index 2: the fields of the table to be used for the creation of the query

index 3: the constraints for the query

Purpose: This method will create a stored procedure with the passing of appropriate data of the query

contruction. This method is inherited and thus will re-implemented by subclasses to add functionality to create a query of type selection or modification.

Pre-condition: The length of the argument ‘query’ must be 4. The argument ‘query’ and its contents are not null; Cells from query[0] to query[2] cannot contain an empty string.

Post-condition: The following instance variables from this QueryBuilder have been initialized:

storedProcedure - String representation of stored procedure.

procedureType - Stored procedure's type which could be “INSERT, DELETE, UPDATE, SELECT”

tableName - Name of the tables this query affects.

constraints - Constraints applied to the query

fields - Columns from the table where this query will be performed

procedureCreated is set to true when the query creation was successful; it is set to false otherwise.

public String getProcedureType()

Data: none

Purpose: This method returns the type of stored procedure this QueryBuilder is holding at the

variable procedureType.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The procedureType attribute has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the type of stored procedure this QueryBuilder object is

holding.

public String getFields()

Data: none

Purpose: This method retuns the fields that will be queried in the table as contained by the

fields attribute from this QueryBuilder object.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The procedureType attribute has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the fields queried in the table by the stored procedure this

QueryBuilder object is holding.

public String getTableName()

Data: none

Purpose: This method retuns the tableName that will be queried in the DB as contained in the

tableName attribute from this QueryBuilder object.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The tableName attribute has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the name of the table being queried in the DB by the stored

procedure this QueryBuilder object is holding.

public String getConstraints()

Data: none

Purpose: This method retunes the constraints that will be used to query a table as contained by the

Constraints attribute from this QueryBuilder object.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The constraints attribute has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the constraints used to query a table in the DB by the stored procedure

this QueryBuilder object is holding.

public String getStoredProcedure()

Data: none

Purpose: This method retunes the stored procedure contained by this object.

Constraints attribute from this QueryBuilder object.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The storedProcedure string has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the constraints used to query a table in the DB by the stored procedure

Class: QueryExecutor

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <4>.

Description: queries the DB by coordinating the execution a stored procedure.

Contracts: QE 1 – Coordinate query execution

Private Variables:

DBConnector dBconnector – DBConnector object that interacts with database.

public DataSet ExecuteSelectorQuery(String query);

Data: query - String representation of the SQL query to be executed

Purpose: Retrieves contents from a table according to query

Pre-condition: A connection to a database is open.

Post-condition: The database connection has been closed, data in table affected by query remains

unchanged.

Returns: A DataSet object containing the results from query

Uses:

DBConnector.ExecuteSelectorQuery(String)

public int ExecuteModifierQuery(String query);

Data: query - String representation of the SQL query to be executed

Purpose: Modifies contents from a table according to query

Pre-condition: A connection to a database is open.

Post-condition: The database connection has been closed, data in table reflects changes stated in query.

Returns: An integer representation of the number of rows affected by the query.

Uses:

DBConnector.ExecuteModifierQuery(String)

Class: DBConnector

Superclasses: none

Subclasses: MySqlDBConnector

Collaboration Graphs: See Figure <4>.

Description: Handles the interaction with a database.

Private Variables:

Object dBConnection – An object representation of the database connector used to that interact

with database instance.

String connectionString – A String representation of the string used to establish the connection to

a database instance.

public void openDBConnection()

Data: None

Purpose: This method will open connection to the DB hosted by the DB server

Pre-condition: serverName exists, the database exists; there is not an existing connection to DB server established.

Post-condition: A new connection to the DB hosted by the DB server has been established. The

connectionObject from this QueryExecutor contains a reference to an object with capabilities for holding a connection opened.

Returns: true - If connection process was successful

False - If connection process was unsuccessful

public void closeDBConnection()

Data: none

Purpose: This method will close the connection to the DB hosted by the DB server by closing the

connection of the connectionObject attribute.

Pre-condition: A connection was previously established, connectionObject != null.

Post-condition: The connection to the DB hosted by the DB server has been closed.

connectionObject has been set to null.

Returns: true - If the closing of the connection process was successful

False - If the closing of the connection process was unsuccessful.

public abstract DataSet ExecuteSelectorQuery(String query);

Data: query - String representation of the SQL query to be executed

Purpose: Retrieves contents from a table according to query

Pre-condition: A connection to a database is open.

Post-condition: The database connection has been closed, data in table affected by query remains

unchanged.

Returns: A DataSet object containing the results from query

public abstract int ExecuteModifierQuery(String query);

Data: query - String representation of the SQL query to be executed

Purpose: Modifies contents from a table according to query

Pre-condition: A connection to a database is open.

Post-condition: The database connection has been closed, data in table reflects changes stated in query.

Returns: An integer representation of the number of rows affected by the query.

Class: QueryResultFormatter

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <4>.

Description: - transforms query results from database in order to provide a readable format to clients.

Contracts: QRF 1- Transform results obtained from database

public DataSet ResultTransformation(DataSet dataset)

Data: dataset – An object containing the results of executing a query from the database.

Purpose: This method will transform the results of a DB transaction into a data structure that will

contain the results of the query to the DB.

Pre-condition: dataset is not null, and not empty

Post-condition: The table affected by the query remains unchanged.

Returns: A DataSet object containing the results from the execution of a SELECT statement.

4.2. User Security Subsystem

Class: Authentication

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <5>.

Description: - requests encrypted password that will be used to be compared with the password of the user that is connecting to the OMS, and compare encrypted passwords.

Contracts: USS 1 - Authenticate User

Public UsernameToken AuthenticateUser(String loginName, String password)

Data: loginName - String representation of username from user

Password - String representation of user’s password

Purpose: This method will authenticate a user according to its password, and will assign a role to

the user.

Pre-condition: loginName and password are not null, and are not empty; loginName must exist in

the table of users. Password is encrypted.

Post-condition: user personal data is not changed, the user now has access to OMS services,

Returns: null if authentication failed; otherwise, a valid UsernameToken is returned.

Class: Authorization

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <5>.

Description: - allows users to access OMS resources based on access level.

Contracts: USS 1) Authorize user request based on user’s access level

bool ComparePwd(String pwd1, String pwd2)

Data: pwd1 - String representation of user’s password from client interface

pwd2String representation of user’s password from database

Purpose: This method will compare two strings in order to determine user authenticity.

Pre-condition: pwd1 and pwd2 are not null, and are not empty; pwd1 and pwd2 must be of the

same length; both strings must be encrypted.

Post-condition: user personal data in table of user is not changed.

Returns: true if pwd1 matches pwd2; else, false otherwise.

String requestPwdFromDB(String userID)

Data: userID – Hash into accessTable where the passwords are stored,

Purpose: to obtain user’s password from database

Pre-condition: DB server and DBMS are working.

Post-condition: user contact information remains unchanged

Returns: the user’s encrypted password from DB.

Public bool authorizeUserRequest(UsernameToken userToken)

Data: userToken – A UsernameToken representation of the user credentials.

Purpose: To authorize user requests based on role and contained by a UsernameToken object from the

SOAP message.

Pre-condition: username token is not null.

Post-condition: User security information in database remains unchanged. The user has received an

authorization response.

Returns: true – if user request was authorized, false otherwise.

Class: SecurityTokenManager

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <5>.

Description: allows the processing of UsernameTokens that will be used for authorizing user requests

according to role.

Contracts: STM 1 - Retrieve security token information from SOAP message.

public String[] extractUserCredentialsFromToken (UsernameToken userToken)

Data: userToken – UsernameToken representation of user credentials.

Purpose: To retrieve the user credentials from SOAP message

Pre-condition: username token is not null.

Post-condition: User security information remains unchanged in database. Array of string returned is of

length 2, and contains the user’s credentials contained in userToken .

Returns: An array of strings containing:

Cell 0: userId

Cell 1: password

4.3. Visualization Subsystem.

This section divides into two subsections. Each subsection presents the protocols for the classes that belong to the subsystem.

Class: VisualizationManager

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Redirects user requests to a specific ontology transformation such as from owl to graphical,

and graphical to owl representations

Contracts: OGTM 1 - Owl to graphical translation

GOTM 1 - Graphical to Owl translation.

4.3.1. OWL to Graphical Representation System

Class: OWLtoGraphTranslationManager

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Coordinates the steps that need to be followed in order to create the graphical representation

of an ontology out of an OWL representation.

Contracts: XT1 - Provide access to XML tree structure

XTP1 - XMLTreeParser.

OSD1 – Display ontology overall structure

public void createGraphicalRepresentation(String docPath)

Data: docPath – Full path to XML file.

Purpose: To create graphical representation from xml document.

Pre-condition: Xml file exists in the filesystem, and is in a valid OWL format; file is not empty; docPath is not null, and is not an empty.

Post-condition: Graphical representation of an XML document is displayed.

private XMLTree requestCreateXmlTreeStructure(String docPath)

Data: docPath – Full path to XML file.

Purpose: To request the creation of an XMLTree from file specified by docPath.

Pre-condition: Xml file exists in the filesystem, and is in a valid OWL format; file is not empty; docPath is not null, and is not an empty.

Post-condition: Source file remains unchanged, XMLTree has been created.

Uses: XMLTree.createXMLTreeStructure(String)

private OntologyShape[] requestExtractTreeData (XMLTree xTree)

Data: xTree – An XMLTree structure containing the data from an OWL file.

Purpose: To request the extraction of data from an XMLTree through an XMLTreeParser.

Pre-condition: XMLTree is not null, and it is not empty.

Post-condition: XMLTree remains unchanged. For each concept, a ConceptShape and a NoteShape is instantiated. At least one RelationshipShape is instantiated for every two concepts. Every

OntologyShape’s fields have been initialized.

Return: Returns an array of OntologyShapes

Uses:

XMLTree.extractTreeData(XMLTree)

Class: XMLTree

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Creates a tree structure representation of an XML file based on a specific schema.

Contracts:

XT 1 - Provide access to XML tree structure

Private Variables:

XmlDocument xTree – Tree rerpresentation of an XMLfile

String schema – Schema used to construct xTree

public void createXMLTreeStructure(String filePath)

Data: filePath – full path to XML file

Purpose: Creates an xml tree representation out of an XML file specified by filePath.

Pre-condition: filePath is not null, and it is not an empty string; the file specified by filePath exists; the file is not empty.

Post-condition: File remains unchanged, a tree representation has been created and it is contained by xTree. The tree contains at least two concepts.

private XmlTextReader readXMLFile(String addressFile)

Data: addressFile – full path to file

Purpose: Create an object with capabilities to read a file

Pre-condition: addressFile is not null, and it is not an empty string; the file specified by addressFile exists. The file is not empty.

Post-condition: The file remains unchanged.

Return: An XMLTextReader.

public XmlDocument getTree()

Data: none

Purpose: Retrieves the XmlTree contained in this object.

Pre-condition: XmlDocument attribute of this tree has been previously initialized.

Post-condition: This XMLTree attributes remain unchanged.

Return: Returns the XmlDocument object that represents the structure of this tree.

Public String getSchema()

Data: none

Purpose: Returns the schema that was used to construct this tree representation of XMLfile

Pre-condition: The schema attribute of this XMLTree is not null and has been previously

initialized.

Post-condition: XMLTree remains unchanged

Return: A string representation of the schema of this XMLTree.

public XMLNode getParentNode(XMLNode childNode)

Data: childNode – An XMLNode used to determine its parent.

Purpose: Retrieves the node that is defined as the parent of childNode.

Pre-condition: childNode is not null. childNode belongs to this XMLTree. childNode is not

empty.

Post-condition: The tree structure remains unchanged. childNode remains unchanged. Parent of

childNode remains unchaged.

Return: Returns the node that is defined as the parent of childNode. In the case that childNode is

the root of the tree, this method returns null.

public bool hasChildNodes(XMLNode parentNode)

Data: parentNode – An XMLNode used to determine if it has children.

Purpose: To find out whether parentNode has nodes defined as the children of parentNode.

Pre-condition: parentNode is not null. parentNode belongs to this XMLTree. parentNode is not

empty.

Post-condition: The tree structure remains unchanged. parentNode remains unchanged. Children

nodes remain unchanged.

      Return: True if there exist nodes defined as the children of parentNode, false otherwise. 

public XMLNode getLeftSiblingNode(XMLNode currentNode)

Data: currentNode – An XMLNode used to retrieve its sibling.

Purpose: Retrieve the node defined as the left sibling of currentNode.

Pre-condition: currentNode is not null, empty, and belongs to this XMLTree. The node defined as

the left sibling of currentNode is not null and empty.

Post-condition: The tree structure remains unchanged. currentNode remains unchanged. Left

sibling of currentNode remains unchanged.

Return: The previous sibling of the node.

public XMLNode getRightSiblingNode(XMLNode currentNode)

Data: currentNode – An XMLNode used to determine its sibling.

Purpose: Retrieve the node defined as the right sibling of currentNode.

Pre-condition: currentNode is not null, empty, and belongs to this XMLTree. The node defined as

the right sibling of currentNode is not null and empty.

Post-condition: The tree structure remains unchanged. currentNode remains unchanged. Right

sibling of currentNode remains unchanged.

Return: The next sibling of the node.

Class: ConceptDataExtractor

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Provides functionality to provide access to concept’s attributes from XMLTree

Nodes.

Contract: CDE 1 - Obtain data out of XML tree nodes

public String getConceptName (XMLNode concept)

Data: concept – An XMLNode used to extract a concept’s name.

Purpose: To retrieve a string representation of the name of the concept.

Pre-condition: concept is not null. concept is not empty. Concept’s name attribute is not null and

contains a non-empty string.

Post-condition: The tree structure remains unchanged. concept remains unchanged. Concept’s

name attribute remains unchanged.

Return: A string representation of the concept’s name is returned.

public String getResourceType (XMLNode concept)

Data: concept – An XMLNode used to extract a concept’s resource type.

Purpose: To retrieve a string representation of the resource type of concept.

Pre-condition: concept is not null and it is not empty. Concept’s resource type attribute is not null

and contains a non-empty string.

Post-condition: The tree structure remains unchanged. concept remains unchanged. Concept’s

resource type attribute remains unchanged.

Return: A string representation of the concept’s resource type is returned.

public String getMetadata (XMLNode concept)

Data: concept – An XMLNode used to extract a concept’s metadata.

Purpose: To retrieve a string representation of the metadata of concept.

Pre-condition: concept is not null. concept is not empty. Concept’s metadata attribute is not null

and contains non-empty string.

Post-condition: The tree structure remains unchanged. concept remains unchanged. Concept’s

metadata attribute remains unchanged.

Return: A string representation of the concept’s metadata is returned.

public String[] getRelationships(XMLNode concept)

Data: concept – An XMLNode used to extract the relationships related to the concept.

Purpose: To retrieve the relationships related to concept.

Pre-condition: concept is not null, and it is not empty. Relationship contents are not empty.

Post-condition: The tree structure remains unchanged. concept remains unchanged. Concept’s

relationships remain unchanged.

Return: Returns the list of relationships that belong to concept.

Class: XMLTreeParser

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Traverses the tree structure in order to extract the contents of node from an XML

tree structure.

Contracts:

XTP 1 - Traverse and extract information from XML tree structure

public OntologyShape[ ] extractTreeData(XMLTree tree)

Data: tree – An XMLTree to extract data from.

Purpose: Traverse tree in order to extract data from each node, and instantiate corresponding

OntologyShape.

Pre-condition: tree is not null, and it is not empty. Tree contains at least two nodes (concepts).

Nodes are not null, nor empty.

Post-condition The tree structure remains unchanged. Node remains unchanged. Array returned contains no null cells. Each OntologyShape has been instantiated, and they are not empty.

Return: A string representation of the node’s internal information.

Uses:

ConceptDataExtractor.getConceptName(XMLNode)

ConceptDataExtractor.getResourceType(XMLNode)

ConceptDataExtractor.getMetadata(XMLNode)

ConceptDataExtractor.getRelationships(XMLNode)

XMLTree.getParentNode(XMLNode)

XMLTree.hasChildNodes(XMLNode)

XMLTree.getLeftSiblingNode(XMLNode)

XMLTree.getRightSiblingNode(XMLNode)

Class: OntologyShapeDrawer

Superclasses: None

Subclasses: OntologyShape

ConceptShape

NoteShape

RelationShape

Collaboration Graphs: See Figure <6>

Description: This class will coordinate the drawing of the overall structure of the ontology by

using OntologyShape components.

Contracts: OSD 1 - Display ontology overall structure.

public void createGraphicalRepresentation(OntologyShape[ ] ontologyShapes)

Data: ontologyShapes – An array of OntologyShapes

Purpose: Creates and displays to screen a graphical representation of an ontology.

Pre-condition: ontologyShapes array is not null, it’s not empty, the number of items in ontologyShapes is at least 3. Each OntologyShape in ontologyShapes array is not null, and it is not empty.

Post-condition: A graphical representation of an ontology is displayed to screen containing.

Class: OntologyShape

Superclasses: None

Subclasses: ConceptShape, NoteShape, and RelationShape

Collaboration Graphs: See Figure <6>

Description: Provide a generic method for drawing a shape.

Contracts: OS 1 - Draw ontology component shape

Private Variables:

Color foregroundColor: color that will be used to paint the shape’s foreground area.

Color lineColor: color that will be used to paint the color of the line delimiting

foreground and background of the OntologyShape.

Color backgroundColor: color that will be used to denote the concept’s resource type.

int x: x-coordinate of the shape component.

int y: y-coordinate of the shape component.

int height: height of the shape component.

int width: width of the shape component.

public void drawShape(Graphics g)

Data: g – Graphics object used to paint this OntologyShape onto the screen.

Purpose: Draws the OntologyShape onto the screen.

Pre-condition: g is not null.

Post-condition: An OntologyShape has been drawn onto the screen at a different location relative

to other OntologyShapes. OntologyShape attributes remain unchanged.

public Color getColor()

Data: None.

Purpose: To retrieve the color representing the resource type.

Pre-condition: color attribute of this OntologyShape has been previously initialized.

Post-condition: color attribute of this OntologhShape remains unchanged.

Return: the color of this OntologyShape is retrieved.

public int getPositionX()

Data: None.

Purpose: To retrieve x-coordinate of this OntologyShape

Pre-condition: x-coordinate of this OntologyShape has been previously initialized.

Post-condition: x-coordinate of this OntologyShape remains unchanged.

Return: An integer representation of the X-coordinate of this OntologyShape.

public int getPositionY()

Data: None.

Purpose: To retrieve y-coordinate of this OntologyShape

Pre-condition: y-coordinate of this OntologyShape has been previously initialized.

Post-condition: y-coordinate of this OntologyShape remains unchanged.

Return: An integer representation of the y-coordinate of this OntologyShape.

public int getHeight()

Data: None.

Purpose: To retrieve height of this OntologyShape

Pre-condition: height of this OntologyShape has been previously initialized.

Post-condition: height of this OntologyShape remains unchanged.

Return: An integer representation of the height of this OntologyShape.

public int getWidth()

Data: None.

Purpose: To retrieve width of this OntologyShape

Pre-condition: width of this OntologyShape has been previously initialized.

Post-condition: width of this OntologyShape remains unchanged.

Return: An integer representation of the Width of this OntologyShape.

public void setColor(Color color)

Data: color – color that will be set.

Purpose: Sets the color.

Pre-condition: Color is available.

Post-condition: Sets the color.

public void setPositionX(int newX)

Data: newX – an integer representation of the new x-coordinate that will be set to this

OntologyShape.

Purpose: Sets the x-coordinate of this OntologyShape.

Pre-condition: The newX is within the window’s form maximum and minimum x-coordinates.

Post-condition: The x-coordinate of this OntologyShape has been set to newX. Rest of attributes

of this OntologyShape remain unchanged.

public void setPositionY(int newY)

Data: newY – an integer representation of the new x-coordinate that will be set to this

OntologyShape.

Purpose: Sets the y-coordinate of this OntologyShape.

Pre-condition: The newY is within the window’s form maximum and minimum y-coordinates.

Post-condition: The y-coordinate of this OntologyShape has been set to newY. Rest of attributes

of this OntologyShape remain unchanged.

public void setHeight(int newHeight)

Data: newHeight – an integer representation of the new height that will be set to this

OntologyShape.

Purpose: Sets the height of this OntologyShape.

Pre-condition: The newHeight is within the window’s form maximum and minimum y-

coordinates.

Post-condition: The height of this OntologyShape has been set to newWidth. Rest of attributes

of this OntologyShape remain unchanged.

public void setWidth(int newWidth)

Data: newWidth – an integer representation of the new width that will be set to this

OntologyShape.

Purpose: Sets the height of this OntologyShape.

Pre-condition: The newWidth is within the window’s form maximum and minimum

x-coordinates.

Post-condition: The width of this OntologyShape has been set to newWidth. Rest of attributes

of this OntologyShape remain unchanged.

Class: ConceptShape

Superclasses: OntologyShape

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Draw the shape that corresponds to the concept with its appropriate color and size.

public void drawShape(Graphics g)

Data: g – Graphics object used to paint this ConceptShape onto the screen.

Purpose: Draws a rectangle representing a concept onto the screen.

Pre-condition: g is not null.

Post-condition: An ConceptShape (rectangle) has been drawn onto the screen at a different

location relative to other ConceptShapes. ConceptShape attributes remain unchanged.

Class: NoteShape

Superclasses: OntologyShape

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Draw the small rectangle shape(note) that will be used for container of the list of relationships between concepts with its appropriate color and size.

Private Variables:

ConceptShape associatedConcept – This is the concept that will serve as a reference as

where this NoteShape will be drawn. In other words, the concept next to this NoteShape.

public void drawShape(Graphics g)

Data: g – Graphics object used to paint this NoteShape onto the screen.

Purpose: Draws the a small rectangle next to a concept onto the screen.

Pre-condition: g is not null.

Post-condition: An NoteShape has been drawn onto the screen at a different location relative

to other NoteShapes. NoteShape attributes remain unchanged.

Class: RelationshipShape

Superclasses: OntologyShape

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Draws the arrow between domain concepts and range concepts.

Private Variable:

ConceptShape domainConcept – Represents the concept where this relationship will start

from.

ConceptShape rangeConcept – Represents the concept that this relationship will point to.

public void drawShape(Graphics g)

Data: g – Graphics object used to paint this RelationshipShape onto the screen.

Purpose: Draws, an arrow joining a domain and range concepts, onto the screen.

Pre-condition: g is not null.

Post-condition: An RelationshipShape has been drawn onto the screen at a different location

relative to other RelationshipShapes. RelationshipShape attributes remain unchanged.

4.3.2. Graphical to OWL Translation Subsystem

Class: GraphToOWLTranslationManager - Coordinates the translation of a graphical representation to OWL format file.

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Coordinate the steps that need to be followed in order to create the OWL file from a graphical representation.

Contracts: VS 2 - Create Owl file from ontology graphical representation.

public bool requestWriteXMLTreeToOwl(XMLTree tree)

Data: tree – An XMLTree whose contents are to be written to an XMLFile

Purpose: Request the writing of an XMLTree into an XML file

Pre-condition: tree is not null, and it is not empty.

Post-condition: An XML file has been created in the file system and contains the same

information as the tree passed to this method.

Return: true – If the creation of the file was successful, false otherwise.

Uses:

XMLTreeToOwl.writeXMLTreeToOwl(XMLTree)

public bool requestValidateXMLFile(String file, String schema)

Data: file – fullpath to XML file whose contents are to be validated against a schema.

Schema – A reference to a schema that will be used to validate file.

Purpose: request validation of an XML file against a specified schema.

Pre-condition: Graph is initialized.

Post-condition: Sets the new changes in the text.

Return: true – if the XML file’s syntax is according to schema, false otherwise.

Uses:

XMLValidator. validateXMLFile(String,String)

Class: XMLTreeToOwl - Creates an XML file containing the information stored by an XML tree.

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Changes in the XML tree.

Contracts:

XTO1 – Write XML tree to OWL file

Private Variables:

XmlTree xmlTree: Stores the xml tree structure.

public bool writeXMLTreeToOwl(XMLTree tree)

Data: tree – An XMLTree whose contents are to be written to an XMLFile

Purpose: Writes an XMLTree into an XML file

Pre-condition: tree is not null, and it is not empty.

Post-condition: An XML file has been created in the file system and contains the same

information as the tree passed to this method.

Return: true – If the creation of the file was successful, false otherwise.

Uses:

XMLTree.getTree()

Concrete Class: XMLValidator

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <6>

Description: Validates an XML file according to a schema.

Contracts:

XTO1 – Write XML tree to OWL file

public bool validateXMLFile(String file, String schema)

Data: file – fullpath to XML file whose contents are to be validated against a schema.

Schema – A reference to a schema that will be used to validate file.

Purpose: Validates an XML file against a specified schema.

Pre-condition: Graph is initialized.

Post-condition: Sets the new changes in the text.

Return: true – if the XML file’s syntax is according to schema, false otherwise.

Uses:

XMLTree.getSchema()

4.4. Metadata Handler Subsystem

Class: MetadataHandler

Superclasses: None

Subclasses: UserMetadataHandler, OntologyMetadataHandler, ChangeRequestMetadataHandler,

RelationshipMetadataHandler, SynonymsMetadataHandler.

Collaboration Graphs: See Figure <7>.

Description: Allows metadataHandler classes to retrieve information from the database

Contracts: OMSS1 – Request Query to database

Private Variables:

String tableName – String representation of the table this MetadataHandler accesses.

public object requestDBQuery( string[] query)

Data: query – an array of strings containing:

index 0: query type

index 1: table name

index 2: the fields of the table to be used for the creation of the query

index 3: the constraints for the query

Purpose: Request a query operation to the corresponding metadataHandler.

Pre-condition: array is not null; array.length() ==4 ; array[0]..array[3] are not null, array[3] can be

null or contain a constraint for the query. the given array of strings contains the required query specifications from the metadatahandler for whom the query corresponds. DB server is running.

Post-condition: DB remains unchanged, stored procedure in RequestDBQuery object is used by a

metadataHandler to generate a query to the database that includes the given parameters.

Returns: an object representation of a query provided by the metadataHandler classes

Class: UserMetadataHandler

Superclasses: : MetadataHandler

Subclasses: None

Collaboration Graphs: See Figure <7>.

Description:

Contracts: UMH1, UMH2

Private Variables:

public String getUserContactInformation (String username )

Data: username – username of the user whose contact information will be extracted.

Purpose: This method will retrieve a user’s contact information from the User metadata table.

Pre-condition: DB Server is running. Username is not null, nor empty. Username it’s a valid username.

Post-condition: Contents of the user metadata table remain unchanged.

Returns: A string representation of the user’s contact information.

Uses:

MetadataHandler. requestDBQuery( string[])

public String[] getUserAuthenticationInformation (String username)

Data: username – username of the user whose authentication information will be extracted

Purpose: This method will retrieve a user’s authentication information from the User metadata table.

Pre-condition: DB Server is running. Username is not null, nor empty. Username it’s a valid username.

Post-condition: Contents of the user metadata table remain unchanged.

Returns: An array of strings with containing user credentials for user referred by username (password,

accesslevel).

Uses:

MetadataHandler. requestDBQuery( string[])

Class: OntologyMetadataHandler

Superclasses: : MetadataHandler

Subclasses: None

Collaboration Graphs: See Figure <7>.

Description:

Contracts: OMH, OMH2

Private Variables:

Public object getListofAvailableOntologies()

Purpose: This method will return an object containing the list of available ontologies related to the

ontology metadata information; this method will invoke a database query to retrieve the information from database.

Pre-condition: a web service is available to support the requested operation, a connection to the Data

Store is available.

Post-condition: Ontology metadata table’s contents remain unchanged.

Returns: An object that contains the list of available ontologies whose status is not pending for validation.

Uses:

MetadataHandler. requestDBQuery( string[])

Public object getListofOntologiesPendingforValidation()

Purpose: This method will return an object containing the list of available ontologies from the

ontology metadata table; this method will invoke a database query to retrieve the information from database.

Pre-condition: a web service is available to support the request operation. A connection to the Data Store

is available.

Post-condition: a object containing the list of ontologies pending for validation is generated and returned

to caller. This list follows the constraint that ontology.status == pending. The ontology metadata table remains unchanged.

Returns: an object that contains the list of ontologies that are pending for validation

Uses:

MetadataHandler. requestDBQuery( string[])

Public object getOntologyMetadata(string ontologyName)

Purpose: This method will return an object containing metadata for the given ontology; this method will invoke a database query to retrieve the information from database.

Pre-condition: a web service is available to support the request operation. A connection to the Data Store is available. ontologyName is not null, and it is not empty.

a request to obtain the ontology metadata for n ontology has been requested by a client interface.

Post-condition: a object containing the ontology metadata is generated and returned

to caller. The ontology metadata table remains unchanged.

Returns: an object that contains the ontology metadata for the corresponding tableName.

Uses:

MetadataHandler. requestDBQuery( string[])

Class: RelationshipMetadataHandler

Superclasses: : MetadataHandler

Subclasses: None

Collaboration Graphs: See Figure <7>.

Description: provides the functionality of retrieving or modifying information for an ontology dictionary, and it has the private responsibility for knowing the table for accessing Relationship metadata.

public String getRelationshipInfo( String relationshipName, String ontology)

Data: relationshipName – A string representation of the relationship’s name

Ontology – A string representation of the relationship’s name that contains the relationship

Purpose: This method will return all the information for the specified relationship from the

specified ontology.

Pre-condition: DB server is running. relationshipName and ontoID are not null, and are not empty.

Post-condition: relationship table remains unchanged. Connection to DB is closed.

Returns: A string representation of the relationship’s information.

Uses:

MetadataHandler. requestDBQuery( string[])

public String getRelationshipInverse(String relationshipName, String ontology)

Data: relationshipName – A string representation of the relationship’s name

Ontology – A string representation of the relationship’s name that contains the relationship

Purpose: This method will return the inverse of the specified relationship that belongs to ontology.

Pre-condition: DB server is running. relationshipName and ontoID are not null, and are not empty.

Post-condition: relationship table remains unchanged. Connection to DB is closed.

Returns: A string representation of the relationship’s inverse.

Uses:

MetadataHandler. requestDBQuery( string[])

Class: SynonymsMetadataHandler

Superclasses: : MetadataHandler

Subclasses: None

Collaboration Graphs: See Figure <7>.

Description: provides the functionality of retrieving or modifying change request information for ontology synonyms, and it has the private responsibility for knowing the table for accessing synonyms metadata.

public String getSynonymOfRelationship(String relationship)

Data: relationship – A string representation of a relationship.

Purpose: This method will return the synonym for the specified relationship

Pre-condition: DB server is running. A connection to DB is opened. Relationship is not null, and it is not an empty string.

Post-condition: Connection to DB is closed. Relationship’s synonym table remains unchanged.

Returns: A string representation of the synonym for relationship. In the case that no synonym was found,

this method returns null.

Uses:

MetadataHandler. requestDBQuery( string[])

public String addSynonymToRelationship(String relationship)

Data: relationship – A string representation of a relationship.

Purpose: This method will return the synonym for the specified relationship

Pre-condition: DB server is running. A connection to DB is opened. Relationship is not null, and it is not an empty string.

Post-condition: Connection to DB is closed. Relationship’s synonym table remains unchanged.

Returns: A string representation of the synonym for relationship. In the case that no synonym was found,

this method returns null.

Uses:

MetadataHandler. requestDBQuery( string[])

4.5. E-Mail Subsystem

Class: EmailCreator

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <8>.

Description: - provides required functionality for creation of an e-mail notification

Contracts: EMS 1 - Request sending of notification to user

Private Variables:

String contributionFROM - Stores the email's 'from' field for contribution notifications

String validationFROM - Stores the email's 'from' field for validation notifications

public EmailMessage CreateValidationNotificationEmail

(String contributorContactInfo, String ontoID, String ontoName, String result, String validatorMessage)

Data: body – Text that will be added to the default body in the body of the message

contributorContactInfo - A string representation of the user's e-mail address.

ontoID - A string representation of the ontology ID

ontoName - A string representation of the ontology name

result - A string representation of the result: accepted or rejected

validatorMessage - A string representation of the validators message

Purpose: This method will generate the notification e-mail that will sent to the contributor

from the validator stating the status of a contribution.

Pre-condition: contributorContactInfo, ontoID, ontoName, result, and validatorMessage are not null nor an

empty string. contributorContactInfo is a valid e-mail address.

Post-condition: The body message was created

Returns: An EmailMessage object containing a customized body for validation notification purposes.

public EmailMessage CreateContributionNotificationEmail

(String contributorContactInfo, String ontoID, String ontoName)

Data: body – Text that will be added to the default body in the body of the message

contributorContactInfo - A string representation of the user's e-mail address.

ontoID - A string representation of the ontology ID

ontoName - A string representation of the ontology name

Purpose: This method will generate the notification e-mail that will sent to the contributor

from the OMS stating that a contribution was accepted.

Pre-condition: contributorContactInfo, ontoID, ontoName, result, and validatorMessage are not null nor an

empty string. contributorContactInfo is a valid e-mail address.

Post-condition: The body message was created

Returns: An EmailMessage object containing a customized body for validation notification purposes.

Class: EmailSender

Superclasses: none

Subclasses: none

Collaboration Graphs: See Figure <8>.

Description: - provides required functionality for sending e-mail notification, and it has the private

responsibility for knowing e-mail server information.

Contracts: ES 1 - Send e-mail notification

Private Variables:

String emailServer – String representation of the email server name.

public void SendValidationNotificationEmail

(String contributorContactInfo, String ontoID, String ontoName, String result, String validatorMessage)

Data: body – Text that will be added to the default body in the body of the message

contributorContactInfo - A string representation of the user's e-mail address.

ontoID - A string representation of the ontology ID

ontoName - A string representation of the ontology name

result - A string representation of the result: accepted or rejected

validatorMessage - A string representation of the validators message

Purpose: This method will send a notification e-mail to the contributor

from the validator stating the status of a contribution.

Pre-condition: contributorContactInfo, ontoID, ontoName, result, and validatorMessage are not null nor an

empty string. contributorContactInfo is a valid e-mail address.

Post-condition: The body message was sent.

Returns: none.

public void SendContributionNotificationEmail

(String contributorContactInfo, String ontoID, String ontoName)

Data: body – Text that will be added to the default body in the body of the message

contributorContactInfo - A string representation of the user's e-mail address.

ontoID - A string representation of the ontology ID

ontoName - A string representation of the ontology name

Purpose: This method will send the notification e-mail to the contributor

from the OMS stating that a contribution was accepted.

Pre-condition: contributorContactInfo, ontoID, ontoName, result, and validatorMessage are not null nor an

empty string. contributorContactInfo is a valid e-mail address.

Post-condition: The body message was sent

Returns: none.

4.6. File Subsystem

Class: FileTransactionManaager

Superclasses: None

Subclasses: None

Collaboration Graphs: See Figure <9>.

Description: provides Manages requests of file transactions operations such as downloads,

uploads of files to file server, and manipulation of files within file server

Private Variables:

String serverName - A string containing the name of the file server

Enum TransactionType – An enumeration used for identification of the type of file transaction.

public void download(String fileName)

Data: fileName - A string representation of a full path to a file.

Purpose: Allows client applications to download a file from the OMS by attaching the file back into a

SOAP message.

Pre-condition:

· path is not null

· path is not empty;

· path is syntactically correct

· file exists;

· connection to the file server is established

Post-condition: The SOAP response message contains the document embedded as a MTOM

attachment; the connection to the file server is closed.

Returns: none.

public void upload()

Data: none

Purpose: Allows client applications to upload a file by processing the file out of a MTOM attachment contained by a SOAP message.

Pre-condition: SOAP message contains a non empty MTOM attachment.

Post-condition: The SOAP response message has been processed and a new file has been created in the

file system with the same contents as that of the MTOM attachment. The file type is as specified by the MTOM attachment message.

Returns: none

public bool deleteFile (String path)

Data: path - A string representation of a path

Purpose: To remove a specified file from the file server

Pre-condition:

· path is not null

· path is not empty

· full path of the specified file name exists

· path is syntactically correct

· the file is closed

· connection to the file server is established

Post-condition: The file has been removed and the connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

Class: FileSystemAccessor

Superclasses: None

Subclasses: FileTransaction, FileHandler

Collaboration Graphs: See Figure <9>.

Description: provides required functionality for manipulating files in the file server.

Private Variables:

String serverName - A string containing the name of the file server

String portNumber – A string containing the port number to connect to the file server for file transactions.

public bool connectToFileServer()

Data: none

Purpose: opens a connection with the file server for file transactions.

Pre-condition: File server exists and connection is closed.

Post-condition: A connection with the file server has been opened at the specified port.

Returns: true - if the transaction was successful

false - if the transaction was not successful.

public bool closeConnection()

Data: none

Purpose: closes a connection with the file server

Pre-condition: File server exists and a connection had been previously established.

Post-condition: A connection with the file server has closed.

Returns: true - if the transaction was successful

false - if the transaction was not successful.

Class: FileHandler

Superclasses: FileSystemAccessor

Subclasses: None

Collaboration Graphs: See Figure <9>.

Description: provides required functionality for manipulating files in the file server.

Contracts: FH 1 - Manipulate files in File Server

private bool exists (String path)

Data: path - A string representation of a path

Purpose: Determines the existence of a file/directory in the file server.

Pre-condition:

· path is not null

· path is not empty

· path is syntactically correct

· the file is closed

· connection to the file server is established

Post-condition: The contents of the file/directory remain unchanged. The connection to the file

server is closed.

Returns: true - if the specified file/directory exists.

False - if the specified file/directory does not exist.

public bool deleteFile (String path)

Data: path - A string representation of a path

Purpose: To remove a specified file from the file server

Pre-condition:

· path is not null

· path is not empty

· full path of the specified file name exists

· path is syntactically correct

· the file is closed

· connection to the file server is established

Post-condition: The file has been removed and the connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

pubic bool copyFile (String sourceFileName, String destFileName)

Data: sourceFileName - A string representation of the source’s full path

destFileName - A string representation of the destination’s full path

Purpose: To copy a file specified by sourceFileName to a new location specified by destFileName within

the file server.

Pre-condition:

· sourceFileName and destFileName are not null

· sourceFileName and destFileName are not empty

· source and destination full paths of the specified file name exist

· source and destination paths are syntactically correct

· connection to the file server is established

· file is closed

Post-condition: The file has been copied to the specified path where the contents of the file remain unchanged and the original file remains at its original location. The connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

public bool moveFile (String sourceFileName, String destFileName)

Data: sourceFileName - A string representation of the source’s full path

destFileName - A string representation of the destination’s full path

Purpose: To move a file specified by sourceFileName to a new location specified by destFileName within

the file server.

Pre-condition:

· sourceFileName and destFileName are not null

· sourceFileName and destFileName are not empty

· source and destination full paths of the specified file name exist

· source and destination paths are syntactically correct

· connection to the file server is established

· file is closed

Post-condition: The file has been moved to the specified path where the contents of the file remain

unchanged and the original file no longer exists in its original location. The connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

public bool deleteDir (String path, bool recursive)

Data: path - A string representation of the full path to the file to be deleted

recursive - A Boolean that will determine if this method will delete subdirectories inside the affected directory.

Purpose : To remove a directory and its contents from the file server

Pre-condition:

· path is not null

· path is not an empty string

· full path to the specified directory exists

· full path is syntactically correct

· all files inside the specified directory must be closed

· there should be a connection to the file server established

Post-condition: The directory has been removed. The connection to the file server is closed. If

recursive is set to:

true - then this method will entirely delete all the contents of the

directory including subdirectories in a recursive manner

false - then this method will only delete the files inside the folder, but will leave its subdirectories and their respective contents intact

Returns:

true - if the deletion process was successful

false – if the deletion process was unsuccessful

public bool moveDir (String sourceDirName, String destDirName)

Data: sourceDirName - A string representation of the source’s full path

destDirName - A string representation of the destination’s full path

Purpose: To move a directory specified by sourceDirName to a new location specified by destDirName

within the file server.

Pre-condition:

· sourceDirName and destDirName are not null

· sourceDirName and destDirName are not empty

· source and destination full paths of the specified file name exist

· source and destination paths are syntactically correct

· all files inside the specified directory must be closed

· there should be a connection to the file server established

Post-condition: The directory and its contents have been moved to the specified path where the contents of the

files inside the directory remain unchanged and the connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

public bool copyDir (String sourceDirName, String destDirName)

Data: sourceDirName - A string representation of the source’s full path

destDirName - A string representation of the destination’s full path

Purpose: To copy a file specified by sourceDirName to a new location specified by destDirName within

the file server.

Pre-condition:

· sourceDirName and destDirName are not null

· sourceDirName and destDirName are not empty

· source and destination full paths of the specified directory exist

· source and destination paths are syntactically correct

· connection to the file server is established.

Post-condition: The directory has been copied to the specified path where the contents of the directory remain unchanged and the original directory remains at its original location and intact. The connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

public bool createDirectory (String path)

Data: path – full path of the directory to be created.

Purpose: To create a new directory within the file server.

Pre-condition:

· path is not null

· path is not empty

· path of the specified directory exists

· path is syntactically correct

· connection to the file server is established.

Post-condition: An empty directory has been created at the specified path, and the

connection to the file server is closed.

Returns: true - if the process was successful.

false - if the process was unsuccessful.

Class: FileTransfer

Superclasses: FileSystemAccessor

Subclasses: None

Collaboration Graphs: See Figure <9>.

Description: provides required functionality for processing file attachments between OMS and

client application.

Contracts: FT 1 - Process file attachments between OMS and client application

public void download(String fileName)

Data: fileName - A string representation of a full path to a file.

Purpose: Allows client applications to download a file from the OMS by attaching the file back into a

SOAP message.

Pre-condition:

· path is not null

· path is not empty;

· path is syntactically correct

· file exists;

· connection to the file server is established

Post-condition: The SOAP response message contains the document embedded as a MTOM

attachment; the connection to the file server is closed.

Returns: none.

public void upload()

Data: none

Purpose: Allows client applications to upload a file by processing the file out of a MTOM attachment contained by a SOAP message.

Pre-condition: SOAP message contains a non empty MTOM attachment.

Post-condition: The SOAP response message has been processed and a new file has been created in the

file system with the same contents as that of the MTOM attachment. The file type is as specified by the MTOM attachment message.

Returns: none

4.7. OMS Web Services Subsystem

Class: SecureService

Superclasses: None

Subclasses: Contribute, Validate

Collaboration Graphs: See Figure <10>.

Description: Abstraction of web service that requires authorization

Public bool authorizeUserRequest()

Data: none

Purpose: To authorize user requests based on role and contained by a UsernameToken object from the

SOAP message.

Pre-condition: SOAP context is not null. SOAP message contains at least one security token. SOAP

message for this request contains user credentials. User requested the invocation of a

webservice that requires authorization.

Post-condition: Section of SOAP message containing RPC remains unchanged. User security credentials

from UsernameToken contained in SOAP message remains unchanged. The user request has been authorized.

Returns: true – if user request was authorized for RPC call based on UsernameTokenCredentials, false otherwise.

Class: Browse

Superclasses: SecureService

Subclasses: None

Collaboration Graphs: See Figure <10>.

Description: provides required functionality for browsing existing ontologies as well as to download existing OWL representation of ontologies.

Contracts: OWSS 3 – Retrieve ontologies’ information to user.

Public String[] listOfAvailableOntologies ()

Data: none

Purpose: To retrieve the list of available ontologies including ontology name and ID.

Pre-condition: Database is functioning properly.

Post-condition: A nx2 array containing:

Column 1 contains the name of the ontology

Column 2 contains the ontology’s ID

Returns: null – if no available ontologies where found, otherwise a non empty array of strings containing a

list of n entries.

Public String[] searchConcept(String conceptName)

Data: conceptName – A string representation of a concept’s name

Purpose: To retrieve the list of available ontologies where conceptName appears.

Pre-condition: Database is functioning properly.

Post-condition: A nx2 array containing:

Column 1 contains the name of the ontology

Column 2 contains the ontology’s ID

Returns: null – if no available ontologies where found, otherwise a non empty array of strings containing a

list of n entries where each entry contains at least one occurrence of conceptName.

public void download(String fileName)

Data: fileName - A string representation of a full path to a file.

Purpose: Allows client applications to download a file from the OMS by attaching the file back into a

SOAP message.

Pre-condition:

· path is not null

· path is not empty;

· path is syntactically correct

· file exists;

· connection to the file server is established

Post-condition: The SOAP response message contains the document embedded as a MTOM

attachment; the connection to the file server is closed.

Returns: none.

Class: Contribute

Superclasses: SecureService

Subclasses: None

Collaboration Graphs: See Figure <10>.

Description: provides required functionality for submitting contributions to OMS.

client application.

Contracts: OWSS 2 – Contribute to OMS by modifying ontologies’ information.

Class: Validate

Superclasses: SecureService

Subclasses: None

Collaboration Graphs: See Figure <10>.

Description: provides required functionality for validating contributions to OMS.

Contracts: OWSS 3 – Validate contributions to OMS

5. Formal Description

This section presents the formal specifications of the protocols for 5 methods. Each section contains the formal followed by the informal specifications

5.1. Visualization Subsystem: Class XMLTreeParser

This section presents one formal and one informal specification of one protocols from the visualization subsystem.

5.1.1. Formal Specification

public OntologyShape[ ] extractTreeData(XMLTree tree)

/*@requires (tree != null) && (tree.size() >= 0) &&

(\forall XMLNode node,;

((node != null) && (node.isEmpty() == false ) &&

(Tree.getTree()).getName(node.getConceptName()).equals(node.getConceptName());

Tree.getNextNode());

@ensures (\result != null) && (\result.Length >= 3n + 1) &&

(\forall int i; ( (0 <= i ) && (i <= \result.Length) ) ;

( (\result[i] != null) && (\result[i] instanceof OntologyShape)&&(\result[i].isEmpty() == false)))

@*/

5.1.2. Informal Specification

public OntologyShape[ ] extractTreeData(XMLTree tree)

Data: tree – An XMLTree to extract data from.

Purpose: Traverse tree in order to extract data from each node, and instantiate corresponding

OntologyShape.

Pre-condition: tree is not null, and it is not empty. Tree contains at least two nodes (concepts).

Nodes are not null, nor empty.

Post-condition The tree structure remains unchanged. Node remains unchanged. Array returned contains no null cells. Each OntologyShape has been instantiated, and they are not empty.

Return: A string representation of the node’s internal information.

5.2. File Subsystem: Class FileHandler

This section presents one formal and one informal specification of one protocols from the File Subsystem.

5.2.1. Formal Specification

public TextStream openTextFile(String path, int iomode, boolean create)

/*@ requires !path.equals (“”) && (path!=null);

@ requires FileHandler.exists(path) == true;

@ requires (iomode = = 1) || (iomode = = 2) || (iomode = = 8);

@ requires (create = = true) || (create = = false);

@ ensures (result != null) && result instanceof TextStream;

@ ensures (exists(path + (\result.getFileName() )

@*/

5.2.2. Informal Specification

public TextStream openTextFile(String path, int iomode, boolean create)

Data: path – A string representation of a path

iomode – An integer representation of the desired access to a file

create – A Boolean that represents a decision for creation of a new file.

Purpose: To open a TextStream for reading, writing, and appending to a file.

Pre-condition:

· path is not null

· path is not empty

· full path of the specified file name exists

· the path is syntactically correct

· iomode value is in{1,2,8}

- 1 for reading to an existing file

- 2 for writing to a new created file

- 8 for appending to the end of a file

· create value is in {true, false}

· connection to the file server has been previously established

Post-condition:

· when the full path provided already exists, iomode value is either 1 or 8, and create value is False, then a Texstream for reading to and appending to will become available.

· when the full path provided does not exist, iomode value is 2, and create value is True, then a Texstream for writing to will become available.

Returns: A TextStream object capable of performing an IO operation as specified by iomode.

5.3. Database Management Subsystem: Class QueryCreator

This section presents one formal and one informal specification of two protocols from the visualization subsystem.

5.3.1. Formal Specification

public void createQuery (String[] query)

/*@requires (query != null && query.length() == 4);

@requires (\forall int i;

0 < i && i < query.length;

(a[i -1] != null ) && ( !“”.equals(a[i-1].trim() ) ) )

@requires ( "select".Equals( data[0].ToLower().trim() ) ||

"insert".Equals( data[0].ToLower().trim() ) ||

"delete".Equals( data[0].ToLower().trim() ) ||

"update".Equals( data[0].ToLower().trim() ) )

@ensures

this.procedureType != null && data[0].equals(this.storedProcedure)

this.tableName != null && data[0].equals(this.tableName)

this.fields != null && data[0].equals(this.fields)

this.constraints != null && data[0].equals(this.constraints)

              this.procedureCreated == true

@*/

5.3.2. Informal Specification

public void createQuery(String[] query)

Data: query – an array of strings containing:

index 0: query type

index 1: table name

index 2: the fields of the table to be used for the creation of the query

index 3: the constraints for the query

Purpose: This method will create a stored procedure with the passing of appropriate data of the query

contruction. This method is inherited and thus will re-implemented by subclasses to add functionality to create a query of type selection or modification.

Pre-condition: The length of the argument ‘query’ must be 4. The argument ‘query’ and its contents are not null; Cells from query[0] to query[2] cannot contain an empty string.

Post-condition: The following instance variables from this QueryBuilder have been initialized:

storedProcedure - String representation of stored procedure.

procedureType - Stored procedure's type which could be “INSERT, DELETE, UPDATE, SELECT”

tableName - Name of the tables this query affects.

constraints - Constraints applied to the query

fields - Columns from the table where this query will be performed

procedureCreated is set to true when the query creation was successful; it is set to false otherwise.

5.3.3. Formal Specification

public String getQueryType()

/*@requires (this.queryType != null) && (this.queryType.compareTo(“”) == false)

@ensures (\result.equals( “SELECT”) ) || (\result.equals(“INSERT”) )|| (\result.equals(“DELETE”) )||

( \result.equals(“UPDATE”) )

@*/

5.3.4. Informal Specification

public String getQueryType()

Data: none

Purpose: This method returns the type of stored procedure this QueryBuilder is holding at the

variable queryType.

Pre-condition: A QueryBuilder object has been initialized, and its createQuery method has been

called and returned with a successful process. The queryType attribute has been set.

Post-condition: All attributes from this QueryBuilder remain unchanged.

Returns: A String representation of the type of stored procedure this QueryBuilder object is

holding.

5.4. User Security Subsystem: Class Authentication

This section presents one formal and one informal specification of one protocols from the security subsystem.

Formal Specification

Public bool authorizeUserRequest()

/*@requires ( RequestSoapContext.Current.Context != null) &&

(RequestSoapContext.Current.Context.Security.Tokens.Count != 0)

@ensures (\result == (\forall UsernameToken tok;

tok.Principal.IsInRole(“SOLIN_HOME\\Validator”) ||

tok.Principal.IsInRole(“SOLIN_HOME\\Contributor”) ;

RequestSoapContext.Current.Context.Security.Tokens != null)

@*/

5.4.1. Informal Specification

Public bool authorizeUserRequest()

Data: none

Purpose: To authorize user requests based on role and contained by a UsernameToken object from the

SOAP message.

Pre-condition: SOAP context is not null. SOAP message contains at least one security token. SOAP

message for this request contains user credentials. User requested the invocation of a

webservice that requires authorization. UsernameToken contains a valid role.

Post-condition: Section of SOAP message containing RPC remains unchanged. User security credentials

from UsernameToken contained in SOAP message remains unchanged. The user request has been authorized.

Returns: true – if user request was authorized for execution of RPC call based on UsernameToken

credentials, false otherwise.

( 2006 EngineSoft

<M:\gates\segates1\SE II\Assignments\SDD\SDD v2.0 \Drafts\SDD v2.0-4.doc >

__MACOSX/se_lectures/Day19/._SDD v2.0-4.doc

se_lectures/Day19/SDD and Project Practice.pptx

Practice

Software Design Document

A document that captures all our design.

Can be used as a reference on how to implement a software system.

Can also be used to maintain the system or generate testing of the system:

Such as unit testing and integration testing.

SDD

I won’t ask you to do one..

But I’ll show and provide it as a reference.. You will need it later (or earlier in the case of some of you)

Practice

Practice more!

__MACOSX/se_lectures/Day19/._SDD and Project Practice.pptx