Detailed Code Design Ref ch 14 – Bennett et al.

Slides:



Advertisements
Similar presentations
Construction process lasts until coding and testing is completed consists of design and implementation reasons for this phase –analysis model is not sufficiently.
Advertisements

Software Engineering Key design concepts Design heuristics Design practices.
Lecture 6: Software Design (Part I)
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Revision Session 4 Systems and Software Design. Software Design-related Topics What are the key characteristics of a quality software design and how can.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
03/12/2001 © Bennett, McRobb and Farmer Class Design Based on Chapter 14 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and Design.
THE OBJECT-ORIENTED DESIGN WORKFLOW Interfaces & Subsystems.
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
1 CS1001 Lecture Overview Object Oriented Design Object Oriented Design.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Design Patterns Ref : Chapter 15 Bennett et al. useful groups of collaborating classes that provide a solution to commonly occuring problems. provide.
Systems Design. Analysis involves understanding and documenting user requirements in a clear and unambiguous way. It focuses on the business side and.
Chapter 25 More Design Patterns.
The chapter will address the following questions:
Architectural Design.
Object Oriented Software Development
The Design Discipline.
Why Analysis Process Refer to earlier chapters Models what the system will do makes it easier for understanding no environment considered (hence, system.
Systems Analysis and Design in a Changing World, Fifth Edition
Systems Analysis and Design in a Changing World, Fifth Edition
CS 3610: Software Engineering – Spring 2009 Dr. Hisham Haddad – CSIS Dept. Class Project OO Design Document Here is what you need to do for your class.
12 Systems Analysis and Design in a Changing World, Fifth Edition.
Ch:10 Component Level Design Unit 4. What is Component? A component is a modular building block for computer software Because components reside within.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part V: Design The Design Workflow Design Classes Refining Analysis Relationships.
Introduction To System Analysis and Design
1 ITEC 3010 “Systems Analysis and Design, I” LECTURE 10: Use Case Realizations [Prof. Peter Khaiter]
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 10 Use Case Design.
Systems Analysis and Design in a Changing World, 3rd Edition
SWE © Solomon Seifu ELABORATION. SWE © Solomon Seifu Lesson 12-5 Software Engineering Design Goals.
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
UHD::3320::CH121 DESIGN PHASE Chapter 12. UHD::3320::CH122 Design Phase Two Aspects –Actions which operate on data –Data on which actions operate Two.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Design Model Lecture p6 T120B pavasario sem.
Design CIS 4800 Kannan Mohan Department of CIS Zicklin School of Business, Baruch College Copyright © 2009 John Wiley & Sons, Inc. Copyright © 2008 Course.
Ch- 8. Class Diagrams Class diagrams are the most common diagram found in modeling object- oriented systems. Class diagrams are important not only for.
1 Software Engineering: A Practitioner’s Approach, 6/e Chapter 11a: Component-Level Design Software Engineering: A Practitioner’s Approach, 6/e Chapter.
Software Design Chapter 11. Purposes of Design Design transforms the specification into a design. The end purpose of the design is to produce detail and.
CHAPTER 3 MODELING COMPONENT-LEVEL DESIGN.
CMSC 345 Fall 2000 OO Design. Characteristics of OOD Objects are abstractions of real-world or system entities and manage themselves Objects are independent.
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
Component Design Elaborating the Design Model. Component Design Translation of the architectural design into a detailed (class-based or module- based)
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Object-Oriented Design Concepts University of Sunderland.
Class Diagrams. Terms and Concepts A class diagram is a diagram that shows a set of classes, interfaces, and collaborations and their relationships.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
OOD OO Design. OOD-2 OO Development Requirements Use case analysis OO Analysis –Models from the domain and application OO Design –Mapping of model.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
OBJECT-ORIENTED TESTING. TESTING OOA AND OOD MODELS Analysis and design models cannot be tested in the conventional sense. However, formal technical reviews.
11 Systems Analysis and Design in a Changing World, Fifth Edition.
1 M206 Chapter 31: An Overview of Software Development 1.Defining the problem 2.Analyzing the requirement – constructing initial structural model 3.Analyzing.
UNIT-IV Designing Classes – Access Layer ‐ Object Storage ‐ Object Interoperability.
GRASP – Designing Objects with Responsibilities
Chapter ? Quality Assessment
Conception OBJET GRASP Patterns
Software Engineering: A Practitioner’s Approach, 6/e Chapter 11 Component-Level Design copyright © 1996, 2001, 2005 R.S. Pressman & Associates, Inc.
TIM 58 Chapter 8: Class and Method Design
The Object Oriented Approach to Design
Object-Oriented Design
Chapter 20 Object-Oriented Analysis and Design
Design Tips.
An Introduction to Software Architecture
CS 8532: Advanced Software Engineering
Object Oriented Design & Analysis
Presentation transcript:

Detailed Code Design Ref ch 14 – Bennett et al

Job description for .net developer Strong understanding of OO design principles and design patterns Drive to participate in an Agile Development team, taking pride in writing Clean Code Knowledge of design techniques such as DI/IoC, SOLID, DDD

System design models refine analysis models by adding system environment or solution domain details and further refining and adding detail. At this point the analysis model should have been verified and validated using walkthroughs and other techniques.

Questions to ask Are all classes/operations/attributes necessary? Are any missing? Optimise the design through factoring out common code using inheritance and composition.

Architecture Considerations To simplify the next step, classes are often divided into packages which denote subsystems. Rule of thumb: use packages when your class diagram for the system is bigger than an A4 page. Packages are particularly useful for testing. We also need to consider our development environment here.

Dependencies A dependency between packages exists if changes to one package would have knock-on effects in another. These occur if a class :- sends a message to another has another as part of its data mentions another as a parameter to an operation. If a class changes its interface, any message it sends may no longer be valid Obviously we aim to minimise dependencies

Layered Architecture We’ve already examined how we can partition our system into entity classes, interface classes and control classes in analysis. In design we can add further layers depending on the environment.

Example : 4-layer architecture Presentation Layer User interface classes Control classes Entity classes Lower level data handling classes Application Logic Layer Business Logic Layer Domain Layer Data Management Layer

Package cohesion The Release Reuse Equivalency Principle The granule of reuse is the granule of release. The Common Closure Principle Classes that change together are packaged together. The Common Reuse Principle Classes that are used together are packaged together.

Coupling between packages The Acyclic Dependencies Principle The dependency graph of packages must have no cycles. The Stable Dependencies Principle Depend in the direction of stability. The Stable Abstractions Principle Abstractness increases with stability.

Detailed design of code Aim: transfer analysis model into a design model for software construction and produce a complete specification of classes. concerned with the design of classes, objects and their interactions.

Detailed design of code Classes identified during analysis provide detail on the business requirements of the system. Now we also need to think about the implementation architecture , the platform, the user interface and the storage of data. Add new classes to support inputs, outputs, processes and file or database structures. Many of these will be determined by the target implementation environment.

Detailed design of code considers Frameworks - reusable set of libraries or classes for a software system e.g..net includes classes, interfaces, and value types Class Libraries e.g. .net Framework class library is a library of classes, interfaces, and value types that provides access to system functionality Components - provide reusable code in the form of objects.

We will focus later on user interface and data management design BUT – we also need to ensure that all our classes are well designed All design principles are derived from 2 Basic Principles. What are they? Does what it says on the tin? Need to know basis?

We need to remember some of these when detailing our design.

Detailed specification of attributes and operation signatures Decide the data type of each attribute Decide how to handle derived attributes Add primary operations Define operation signatures and parameter types Define the visibility of attributes and operations.

Class Attributes Attributes are typed either using a base type from the language to be used or a type available in a library e.g. Boolean, character, float, double, money, string, etc. Attributes will also have a specific visibility Remember coupling – specify visibility of an attribute on a “need to know” basis. Derived attributes can be calculated from others.

Visibility + Public directly accessible by all - Private visible to the object itself # Protected visible to object and descendants ~ Package visible to classes in the same package

Operation signatures Each operation needs to be specified in terms of the number and type of parameters it passes and its return type (signature) e.g. lodge(amount:money):boolean e.g. if (myacc.lodge(500)) { ……} else {…..}

Why use boolean as a return type? Class bankaccount -accountno:string -balance:money =0.00 +open(initialbal:money, accno:string) +getbalance():float +withdraw(amount:money):boolean +lodge(amount:money):boolean +close() Note that you can specify initial values Why use boolean as a return type?

Class depositaccount:bankaccount overdraft_allowed:Money interest_rate: Percentage /availablebal:Money /amountoverdrawn:Money chargeinterest(period:time) checkoverdrawn():boolean Derived attributes

Should we show primary operations on a class diagram? get, set, constructors, destructor – sometimes it can be assumed these are available so no need to specify unless they specifically need to be publically visible e.g. you might need more than one constructor. There should be a standard for a project regarding this as opinions differ as to their necessity.

C# has explicit destructors with the same name as the class with a ~ at the beginning. It is automatically called by the garage collector when the object ceases to exist. C# has properties which can implement get and set operations. We’ll examine these in the practical.

Attribute declarations can also specify multiplicity – this can be done using square brackets (like an array declaration e.g. qualification: String[0..10]

Interfaces If a class can present more than one external interface to another class e.g. – only some classes can do certain things like change certain attributes – then the interface construct is used to show this.

Associations 1-1 Association Need to analyse the message passing between the objects tied by the link.  See which direction messages are sent to see which object should contain the reference to the other object. We need to be careful about coupling here

Example Class gamestate Class screenmanager

Associations 1-Many Associations Need to analyse the message passing between the objects tied by the link.  See which direction messages are sent to see which object should contain the reference to the other object.#

Example A campaign has a collection of adverts. An invoice is for a collection of products A student has a list of modules that they’re enrolled in This can be done by including the collection in the class, but it is better sometimes to use a collection class to do this.

Class enrollist -mymodules:enrolment[6] -/averagemark: float Findfirst() Getnext() Addmodule() removemoduleIO Class student -ID: string -Name :string -Mymodulelist:enrollist Class enrolment Modulecode:string Date registered:date Result:float

Many- Many Associations Again, collection classes can be used. Many languages provide collection classes predefined (e.g. list, queue, array etc.). See if you can find what collection classes are available in c# - what are their operations?

Example : product list in C# public class Productlist { private List<product> products; public Productlist() products = new List<Product>(); } public void Add(Product p) products.Add(p); public Product GetProduct(int i) return(products[i]); ...}

Integrity Constraints Referential integrity – an object identifier refers to an object that exists e.g. What to do if an assigned staff member to a campaign leaves? Dependency constraints - attribute dependencies where one attribute depends on others need to be maintained. Domain integrity – attributes only hold permissible values.

Designing Operations Determining the best algorithm to perform the required function.

5 Principles of Class Design(SOLID) Single Responsibility Principle A class should have one, and only one, reason to change. Open Closed Principle You should be able to extend a classes behavior, without modifying it. Liskov Substitution Principle Derived classes must be substitutable for their base classes. Interface Segregation Principle Make fine grained interfaces that are client specific. Dependency Inversion Principle Depend on abstractions, not on concretions.

Inversion of Control /Dependency Injection How do we get the enrolments into the student? How can we ensure that the enrolment class is independent from the student class? IoC/DI :Make sure that the student class is not responsible for creating the enrolment objects. – we “inject” each enrolment into the list, and create it separately.

Principles of IOC Don’t call us we’ll call you Main classes aggregating other classes should not depend on the direct implementation of the aggregated classes. Both the classes should depend on abstraction either using interface or abstract class. Abstraction should not depend on details, details should depend on abstraction.

"Instead of a component being responsible for getting the required dependencies to perform a task, a container/factory should build and inject the dependencies into the component. Then the component can perform the sole activity for which it is responsible. The component need not care about from where it got its dependencies. Then the components code will be much more cleaner and testable".

DDD- Domain-driven design approach to developing software for complex needs by connecting the implementation to an evolving model of the core business concepts project's primary focus -core domain and domain logic creative collaboration between technical and domain experts to cut closer to the conceptual heart of the problem

Essentially ... Model software on the user domain Ensure agreed set of semantics Minimise coupling Maximise cohesion – design code where components are clear about what they do and map directly to domain objects. Minimise coupling – pass info on a need to know basis and reduce dependencies.