march 1, 2004cs 509 - wpi1 cs 509 design of software systems lecture #6 monday, march 1, 2004

22
March 1, 2004 CS 509 - WPI 1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

Upload: brett-rose

Post on 17-Jan-2018

217 views

Category:

Documents


0 download

DESCRIPTION

March 1, 2004CS WPI3 Term Project Administration §Phase 3 – CIS Design (and journals) due §Return Quiz #3 §Hand out Phase 4 assignment §Change to grading policy: P4 5%, P5 10% §Phase 4 discussion l Only have 1 week for analysis l Would it be more or less productive to have larger groups for phase 4? 2 groups of 4 instead of 4 groups of 2?

TRANSCRIPT

Page 1: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 1

CS 509Design of Software Systems

Lecture #6Monday, March 1, 2004

Page 2: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 2

Term Project AdministrationQuestionsReview of Chapter 10In-class Exercises:

Discuss contents of new text book, choose lecture topics

Review requirements for HIS

Class Format for Today

Page 3: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 3

Term Project AdministrationPhase 3 – CIS Design (and journals) dueReturn Quiz #3Hand out Phase 4 assignmentChange to grading policy: P4 5%, P5

10%Phase 4 discussion

Only have 1 week for analysis Would it be more or less productive to have

larger groups for phase 4?• 2 groups of 4 instead of 4 groups of 2?

Page 4: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 4

Questions?

About what was covered last timeFrom the readingAbout the Term ProjectAnything else?

Page 5: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 5

Chapter 10

Mapping Models to Code

Page 6: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 6

Overview of ActivitiesWhat are the purposes of the

activities in this chapter? Optimizing the class model Mapping associations to collections Mapping operation contracts to

exceptions Mapping the class model to a storage

schema

Page 7: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 7

OptimizationsAddress performance

requirements of system modelOptimizing associations:

Reducing multiplicity Adding redundancy Why do each of the above?

Adding derived attributes

Page 8: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 8

TransformationsModel transformationsRefactoringsForward engineeringReverse engineering

Page 9: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 9

Model TransformationsApplied to an object model, produces

another object modelPurpose:

To simplify or optimize original model To bring into closer compliance with

requirementsActions:

Add, remove or rename classes, operations, associations and/or attributes

Page 10: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 10

RefactoringTransformation of source codeImprove readability or modifiability

without changing behaviorFocus on a specific field or method of

classDone in small incremental steps

interwoven with testingExamples: (What do they do?)

Pull Up Field, Pull Up Constructor, Pull Up Method

Page 11: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 11

Forward Engineering

Applied to a set of model elementsResults in a set of source code

statements: Class declaration, expression, DB schema

Maintain strong correspondence between object design model & code

Reduce number of errors introduced during implementation

Page 12: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 12

Reverse Engineering

Applied to source codeResults in a set of model elementsRecreate the model for an existing

system Why?

Does not necessarily create original model Why not?

Page 13: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 13

Transformation PrinciplesGoal is to improve designMaking changes is potentially hazardousHow to avoid introducing new errors:

Address a single criteria or design goal Local transformations, not architectural

changes Applied in isolation to other changes (how?) Followed by testing to validate

Page 14: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 14

Optimizing for Performance

Increase in performance may result in more complexity

Want a balance between efficiency & clarity Minimize repeated association traversals Reduce “many” associations to “one” Eliminate unneeded classes by moving

attributes

Page 15: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 15

More OptimizationsCollapsing objects into attributes

How do you know where this applies? When should this activity be done?

Delaying expensive computations Proxy design pattern may be useful

Caching results of expensive computations Data can be stored temporarily (time vs.

space) Need to be careful about when to update

Page 16: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 16

Mapping AssociationsAssociations in UML have no direct

counterpart in JavaCan map to reference or collectionUnidirectional vs. bi-directionalOne-to-one, one-to-many, many-to-

manyQualified associationsAssociation classes

Page 17: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 17

From Contracts to Exceptions

Contracts are mapped to exceptions using a corresponding check in the code (an if statement) that throws an exception if a contract condition is not satisfied When is it necessary to check contract

conditions? How do inheritance and encapsulation

apply?

Page 18: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 18

Persistent (Relational) StorageMapping object models to persistent

storage required defining a schemaTables and keys:

Primary key, candidate key, foreign keyMap each class to a table of the

same nameMap attributes to columns in tableChoose primary key (how?)

Page 19: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 19

Association RelationshipsBuried associations with multiplicity

one Why is this called a buried association? How does it work?

Association (or Bridge) Table What is a bridge table? What is it used for? How does it work?

Page 20: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 20

Mapping InheritanceVertical mapping

Typo in book on page 418 (sub vs. super)Horizontal mapping

What are the differences? The trade-offs? Which one has a “role” column? What is it for?

Page 21: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 21

In-class Exercises

Discuss contents of new text bookChoose lecture topics for:

3/8, 3/15, 3/22

Review requirements for HIS Work on defining attributes for

categories

Page 22: March 1, 2004CS 509 - WPI1 CS 509 Design of Software Systems Lecture #6 Monday, March 1, 2004

March 1, 2004 CS 509 - WPI 22

For Next Time

Phase 4 due (HIS RAD) and Journals

Reading TBDThink about course content for

CS562