Presentation is loading. Please wait.

Presentation is loading. Please wait.

Edsger W. Dijkstra Simplicity is prerequisite for reliability.

Similar presentations


Presentation on theme: "Edsger W. Dijkstra Simplicity is prerequisite for reliability."— Presentation transcript:

1 Edsger W. Dijkstra Simplicity is prerequisite for reliability

2 CSC 213 – Large Scale Programming

3 Today’s Lecture

4 Our Goal

5 Our Nemesis

6 Other Nemesis

7

8 Electric Boogaloo  Developing automated DJ for clubs  Plays music at raves  Chooses songs using party-goers requests  Removes people who do not belong  Colleague already wrote user stories  Then went on vacation for next few months

9 Electric Boogaloo  Developing automated DJ for clubs  Plays music at raves  Chooses songs using party-goers requests  Removes people who do not belong  Colleague already wrote user stories  Then went on vacation for next few months you are the sucker  For this project, you are the sucker

10 Electric Boogaloo User Stories User wants hip-hop Partier realizes there is a real lack of hip-hop. They request a hip-hop song be played. The system randomly selects a song from its list of hip-hop songs and adds it to the song queue. When removed from the queue, the system plays the song and displays its name and artist. (Similar stories exist for electronica & Stevie Wonder)

11 Oops… Forgot Something User wants Jonas Brothers A user requests a Jonas Brothers song be played. The system takes their picture and sends it to the security guards.

12 Oops… Forgot Something User wants Jonas Brothers A user requests a Jonas Brothers song be played. The system takes their picture and sends it to the security guards. The guards taze the undeserving guest and physically throw them out of the party.

13 What’s Next?

14 Find the Classes  Designing classes next step in process  Could help find & fix inconsistent requirements  Unclear requirements clarified and made easy  Outlining classes makes coding easy  Already know methods to call from other classes  Will provide chance to do some easy debugging  Pretty pictures drawable from your design  This is an IMPORTANT consideration

15 Find the Classes  Designing classes next step in process  Could help find & fix inconsistent requirements  Unclear requirements clarified and made easy  Outlining classes makes coding easy  Already know methods to call from other classes  Will provide chance to do some easy debugging  Pretty pictures drawable from your design  This is an IMPORTANT consideration

16 Pictures Worth 1,000 Words

17

18

19

20

21 Why Draw Classes?  Pictures used to share ideas easily  Gets everyone up & coding at once  Group spends lab watching you code…  …or get suckers to do work while you relax  Now want team of suckers to work in parallel

22 Why Draw Classes?  Pictures used to share ideas easily  Gets everyone up & coding at once  Group spends lab watching you code…  …or get suckers to do work while you relax  Now want team of suckers to work in parallel

23 Why Draw Classes?  Pictures used to share ideas easily  Gets everyone up & coding at once  Group spends lab watching you code…  …or get suckers to do work while you relax  Now want team of suckers to work in parallel  Methods & their signatures included in diagrams  Can write code using all classes, even unwritten ones

24 From User Stories to Classes  Classes represent things  Look for nouns This process is much more art than science Actors are nouns, but often external to system Actions may need classes to transmit data  Develop rules of thumb as you go along

25 From User Stories to Classes  Classes represent things  Look for nouns This process is much more art than science Actors are nouns, but often external to system Actions may need classes to transmit data  Develop rules of thumb as you go along Good judgment comes from experience, and experience comes from bad judgment. – Fred Brooks

26 Start Your (mp3) Engines Classes neededUser wants hip-hop Partier requests a hip- hop song be played. Randomly select a song from the list of hip-hop songs & add it to the song queue. When removed from the queue, play the song & displays its name and artist.

27 Start Your (mp3) Engines Classes neededUser wants Jonas Bros. A user requests a Jonas Brothers song be played. The system takes their picture and sends it to the security guards. The guards taze the undeserving guest and haul them out of the party.

28 UML Class Diagrams  Classes drawn in 3-part box  Top portion shows class name  Middle portion has field names & types  In bottom, methods with params & return types  Language-independent diagrams used in this  Work with & used by many languages  All variables written using following format : name : type

29 Class Relations  Generalization for extends & implements  Use open triangle ( ) from subclass to superclass  Declaring class lists methods & field only  Solid line for extends ; dashed for implements  Important fields drawn as associations  Use open arrow (  ) to fields class  Label with multiplicity & field name  Do not list field in middle section of class

30 More Relationships  Aggregation if source has target in a collection  Collection is field in source class & holds targeted items  Drawn using open diamond ( ) toward the source  Composition when target depends on source  Target object used only by source  Cannot have getter & cannot return reference to target  Collection often used to hold target (but not always)  Drawn using closed diamond ( ) toward the source

31 Drawing Relationships  Nearly all relationships must be labeled

32 Drawing Relationships  Nearly all relationships must be labeled Boyfriend-Girlfriend Just Friends Friends “with benefits” Sweeties Married Best Friends

33 Drawing Relationships  Nearly all relationships must be labeled  Except generalizations; means different thing  Near midpoint of arrow, specify name of field  Also specify numbers involved on each side  Number written down on each end of the link  Can be specific number of objects included  Could be some range of numbers like ‘2..5’  + means 1 of more objects required to be used  Use Kleene’s star ‘*’ for 0 or more objects

34 From User Stories to Classes public  Uses should become public methods  Start assuming this until proven otherwise  User stories verbs become methods in the classes  Pre- & post-conditions should be also be added  Think and then add to javadoc comments  Private methods may add to the preconditions  Always specify assumptions explicitly  Will save TONS of debugging time

35 Draw the Classes Used User wants Stevie Wonder Partier needs more funk & requests Stevie Wonder. The system randomly selects a Stevie Wonder song & adds it to the queue. When its turn arrives, the system will play the song and display its name and artist.

36 For Next Lecture  Week #2 homework available on web/Angel  Due by 5:00PM Tuesday  Submit assignment via  Link to article for lab found on lecture page  Reading for Friday available on web/Angel  What else can we do before coding?  Is there something more that enables our laziness?  How to trick smarter suckers into doing our work?


Download ppt "Edsger W. Dijkstra Simplicity is prerequisite for reliability."

Similar presentations


Ads by Google