21Jan2003 - PowerPoint PPT Presentation

About This Presentation
Title:

21Jan2003

Description:

Determined Demeter. Entity/Boundary/Controller evolution from MVC. January 21 2003. Lecture 8 ... Demeter violations. Convert 'Gets' into 'Do' ... – PowerPoint PPT presentation

Number of Views:33
Avg rating:3.0/5.0
Slides: 12
Provided by: georgeh1
Learn more at: http://web.cs.wpi.edu
Category:

less

Transcript and Presenter's Notes

Title: 21Jan2003


1
Demeter Take 2-n-E/B/C
  • 21-Jan-2003
  • Lecture 8

2
Outline
  • Previous Business
  • HW1 due NOW
  • Electronic submission to be worked out. Will
    accept email (heineman_at_cs.wpi.edu) until 800 PM
    tonight
  • Reading Questions
  • Lecture Contents
  • Determined Demeter
  • Entity/Boundary/Controller evolution from MVC

3
Determined Demeter
  • Cast Demeter issue into MVC example

a ExampleApplet1
mTemperature
vTemperatureView
sScrollbar
vTextView
scrollbar_AdjustmentValueChanged
setTemperature (t)
modelChanged()
getTemperature()
getScale()
modelChanged()
getTemperature()
time
getScale()
  • Observe that each class obeys Demeter

4
Demeter violations
  • Controller asks model for views and then contacts
    them
  • Original Applet
  • BogusApplet

/ Set the value within the temperature model
/public void updateModel (int val) //
set model. model.setTemperature ((float)
val) Enumeration listEn
model.getListeners() while
(listEn.hasMoreElements()) IListener
view (IListener) listEn.nextElement()

5
Demeter violations
  • Convert Gets into Do
  • Instead of obj.getObject().doSomething() you now
    have obj.doSomething() which is then delegated to
    proper object
  • Reduce micro-management into delegation

6
Missing concerns with MVC
  • Who constructs these objects?
  • Who associates the relationships?
  • is this static or dynamic?
  • How does the user interact with the system to
    cause changes in the model?
  • does the view play a dual role?

7
Entity/Boundary/Controller
  • All objects are not created equal
  • Entity ? Represent persistent information
    required to implement desired system
  • Boundary ? Represent interactions between actors
    and system
  • Control ? Represent tasks that are performed by
    user and supported by system

8
Use case analysis
  • Use case name ApplyStyle
  • Entry Condition Text selected
  • Flow of Events 1. Selection range identified
  • 2. TextRegion contacted with s,e) and style
  • 3. Updated HTML extracted from TextRegion
  • 4. HTMLview refreshed with HTML String
  • Exit Condition none

9
How do Use Cases fit in?
b Boundary
cControl
b2 Boundary
e Entity
initiate
doSomething
doSomething
  • Control Object maps to use case
  • Pay attention to creation of objects

10
Thursday Assignments
  • Reading
  • read Chapter 5 handout
  • TAOO Chapter 4

11
References
  • Law of Demeter
Write a Comment
User Comments (0)
About PowerShow.com