SOEN 343 Software Design Computer Science and Software

  • Slides: 24
Download presentation
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004

SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin SOEN 343, © P. Chalin SOEN 344, © P. Chalin

Agenda – Lecture 11 b • • Exercise Set 8: finishing up GRASP: Indirection

Agenda – Lecture 11 b • • Exercise Set 8: finishing up GRASP: Indirection Interfaces (& Larman’s example of Composite) From Requirements to Design 10/3/2020 SOEN 343, © P. Chalin, 2

Sample JSP: Hello. jsp – Exercise Set 8 used View. Task. List. jsp <%@

Sample JSP: Hello. jsp – Exercise Set 8 used View. Task. List. jsp <%@ page content. Type=“…" import=“…" %> <html> <% String full. Name = (String) request. get. Attribute("full. Name"); %> <head><title>Hello</title></head> <body> <h 1>Hello <%= full. Name %>!</h 1> </body> </html> 10/3/2020 SOEN 343, © P. Chalin, 3

GRASP • • • … Polymorphism. Pure Fabrication. Indirection. Protected Variations. 10/3/2020 SOEN 343,

GRASP • • • … Polymorphism. Pure Fabrication. Indirection. Protected Variations. 10/3/2020 SOEN 343, © P. Chalin, 4

GRASP: Indirection Problem • Where to assign a responsibility to avoid direct coupling between

GRASP: Indirection Problem • Where to assign a responsibility to avoid direct coupling between two (or more) things? How to decouple objects so that low coupling is supported and reuse potential remains higher? Solution • Assign the responsibility to an intermediate object to mediate between other components or services so that they are not directly coupled. Can you think of an example from EA? 10/3/2020 SOEN 343, © P. Chalin, 5

Do-it-all Transaction Script 10/3/2020 Page Controller redesign Domai Presentati Data Source on n Redesigning

Do-it-all Transaction Script 10/3/2020 Page Controller redesign Domai Presentati Data Source on n Redesigning Do-it-all TS (6 classes) Template View Person Transaction Script Person Mapper Table Data Gateway SOEN 343, © P. Chalin, 6

Indirection Mapper • Mapper isolates Person from TDG and TDG from Person. 10/3/2020 SOEN

Indirection Mapper • Mapper isolates Person from TDG and TDG from Person. 10/3/2020 SOEN 343, © P. Chalin, 7

Interfaces • A class defines both – A type, and – A (complete or

Interfaces • A class defines both – A type, and – A (complete or partial) implementation. • An interface defines only a type. • An interface contains only – Non-static, public methods, or – Static, public final fields. 10/3/2020 SOEN 343, © P. Chalin, 8

Happy Interface public interface Happy { int i = 0; void happy(); } •

Happy Interface public interface Happy { int i = 0; void happy(); } • Actually represents this (which is also legal) public interface Happy { static final int i = 0; /* non-static */ abstract void happy(); } 10/3/2020 SOEN 343, © P. Chalin, 9

Interfaces: Illustration (Realization of multiple interfaces) (Diagram given in class) • Person, HS_Person •

Interfaces: Illustration (Realization of multiple interfaces) (Diagram given in class) • Person, HS_Person • Happy, Sad interfaces. 10/3/2020 SOEN 343, © P. Chalin, 10

Composite Pricing Strategies • Interface • Realization 10/3/2020 SOEN 343, © P. Chalin, 11

Composite Pricing Strategies • Interface • Realization 10/3/2020 SOEN 343, © P. Chalin, 11

Recall … • Way back in week 5 b we asked the question …

Recall … • Way back in week 5 b we asked the question … How do I come up with a design? 10/3/2020 SOEN 343, © P. Chalin, 12

How Do I Come Up With a Design? • What are the inputs to

How Do I Come Up With a Design? • What are the inputs to the activities of design? • What are the outputs? 10/3/2020 SOEN 343, © P. Chalin, 13

Design Activities: Inputs & Outputs • Product requirements • Architectural factors … • Architecture

Design Activities: Inputs & Outputs • Product requirements • Architectural factors … • Architecture Document • Project plan – Architectural Style(s) • … 10/3/2020 SOEN 343, © P. Chalin, 14

Design Input: SRS • What is contained in the SRS? (name some of its

Design Input: SRS • What is contained in the SRS? (name some of its parts) 10/3/2020 SOEN 343, © P. Chalin, 15

Design: From SRS to. . . • Domain Model • Design Model • Use

Design: From SRS to. . . • Domain Model • Design Model • Use Case Model • Control Style / Pattern • User-interface design … 10/3/2020 SOEN 343, © P. Chalin, 16

Design Model Classes • Domain Model often used as first approximation to Design Model.

Design Model Classes • Domain Model often used as first approximation to Design Model. • Domain Model contains – Conceptual classes • Conceptual classes used as basis for similarly named design classes. • (E. g. Larman, Chapter 16, p. 222. ) 10/3/2020 SOEN 343, © P. Chalin, 17

Domai Presentati Data Source on n EA Patterns Page Controller Template View Front Controller

Domai Presentati Data Source on n EA Patterns Page Controller Template View Front Controller Transform View Transaction Script Domain Model Data Mapper Active Record Table Module Row Data Gateway Table Data Gateway 10/3/2020 SOEN 343, © P. Chalin, 18

Enterprise Applications: Domain Model • Requirements Domain Model 10/3/2020 • Design Model: classes Domain

Enterprise Applications: Domain Model • Requirements Domain Model 10/3/2020 • Design Model: classes Domain Model pattern SOEN 343, © P. Chalin, 19

From Requirements to Design Requirements artifacts: e. g. Design artifacts: e. g. • Software

From Requirements to Design Requirements artifacts: e. g. Design artifacts: e. g. • Software Architecture Document • Domain Model • Design Model • Use Case Model 10/3/2020 • User-interface design … SOEN 343, © P. Chalin, 20

Conceptual Classes to Design Classes • Domain Model pattern 10/3/2020 SOEN 343, © P.

Conceptual Classes to Design Classes • Domain Model pattern 10/3/2020 SOEN 343, © P. Chalin, 21

Representational Gap • Larman, Section 17. 2: The object developer has taken inspiration from

Representational Gap • Larman, Section 17. 2: The object developer has taken inspiration from the real-world domain in creating software classes. Therefore, the representational gap between how stakeholders conceive the domain, and its representation in software, has been lowered. 10/3/2020 SOEN 343, © P. Chalin, 22

From Rich Conceptual Domain Model to Rich set of Domain Model classes 10/3/2020 SOEN

From Rich Conceptual Domain Model to Rich set of Domain Model classes 10/3/2020 SOEN 343, © P. Chalin, 23

Tutorial • Support for A 2. • A 3 will be posted shortly. 10/3/2020

Tutorial • Support for A 2. • A 3 will be posted shortly. 10/3/2020 SOEN 343, © P. Chalin, 24