01.02.2013 Views

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

Software Development Cross Solution - Index of - Free

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

design refactoring<br />

The Date class currently<br />

handles the job <strong>of</strong> seeing<br />

if a particular event<br />

is appropriate for a<br />

particular date.<br />

FirstDate<br />

# validateEvent(event : Event)<br />

:boolean<br />

154 Chapter 5<br />

Your design at the moment makes it hard work to add events, change event names,<br />

and even deal with additional dates. Take a look at the current design and mark up<br />

what changes you’d make to apply the single responsibility principle to the iSwoon<br />

design (and in the process, make it easier to add new events and dates).<br />

Date<br />

+ seeMovie() :void<br />

+ goToRestaurant() :void<br />

+ orderFlowers() :void<br />

+ goOnDate() :boolean<br />

# validateEvent(event : Event):boolean<br />

SecondDate<br />

# validateEvent(event : Event)<br />

:boolean<br />

All <strong>of</strong> the logic in these methods<br />

needs to be updated every time you<br />

add a new type <strong>of</strong> event.<br />

Download at WoweBook.Com<br />

There’s a method<br />

for each type <strong>of</strong><br />

event that can be<br />

added to a date.<br />

ThirdDate<br />

# validateEvent(event : Event)<br />

:boolean

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!