1 / 16

Activity Diagrams

Activity Diagrams. What happens next?. Introduction. What are the two main parts of a computer program? Data Algorithms We have previously emphasized how real-world information can be turned into data. We will now begin to describe how the data can be analyzed and processed

lydia
Download Presentation

Activity Diagrams

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Activity Diagrams What happens next?

  2. Introduction • What are the two main parts of a computer program? • Data • Algorithms • We have previously emphasized how real-world information can be turned into data. • We will now begin to describe how the data can be analyzed and processed • An algorithm is a step-by-step set of instructions for performing some task. • An algorithm is something like an instruction manual.

  3. Overview • Examples of everyday algorithms • A recipe for baking a cookie. • Directions to your friend on how to get to Kwik Trip. • A user manual for operating your cell phone. • Instructions for completing your tax forms. • A computer program.

  4. Overview • In computer programming, the set of instructions must be very well defined. This involves knowing the actions that should take place and the order of those actions. • Baking: Do you mix the liquids before or after adding the flour? • Building a house: Do you put up the drywall before or after the electrical wiring work? Do you finish the landscaping before or after the plumbing work? • Business: Does a business invest in high quality furniture before or after the CEO has approved? Does the CEO approve before or after the board has approved? How does the board approve?

  5. Describe the workflow • Example directions for cooking chocolate chip cookies: • Preheat oven to 375° F. • Combine flour, baking soda and salt in small bowl. • Beat butter, white sugar, brown sugar and vanilla extract in large bowl until creamy. • Add eggs to the creamy mixture, one at a time, beating well after each addition. • Gradually beat in flour mixture. • Stir in chocolate morsels. • Drop by rounded tablespoon onto ungreased baking sheets.  • Bake for 9 to 11 minutes or until golden brown. • Cool on baking sheets for 2 minutes; remove to wire racks to cool completely. 

  6. Activity Diagram • Activity Diagrams: Activity diagrams describe the flow of an algorithm. • An activity diagram is a "model" of the flow • Activity diagrams are a type of graph. • The diagrams show the sequence of activities performed. • Activity diagrams are part of the Unified Modeling Language (UML) • Activity diagrams can show activities that are conditional or parallel

  7. Activity Diagram Elements Eat dinner Eat dinner Snack on anchovies Study for CT100 • Simple Activity diagrams consist of: • Initial node. • Final node. • Action nodes. • Flows (sequences) given by arcs.

  8. Details • The initial node indicates where to start • The activity described by the diagram ends with the final node. • An activity can have more than one final node. • Action nodes operate on data and pass data to other actions. • The sequence of actions is defined by the arcs of the diagram.

  9. Setting the time of a Wristwatch Pull crown out Turn crown counterclockwise to desired time Push crown in

  10. Conditional Actions [no exam tomorrow] [exam tomorrow] Study Waste time on Facebook • Some actions are conditional. How would you say that you need to study if you have an exam tomorrow otherwise you would waste time on Facebook? • What are the actions • What is the condition? • A diamond indicates points at which a flows split (a condition) or merge

  11. Can have more than two splits

  12. Logging In enter user name enter user password [Cancel is clicked] [Login is clicked] Check name/password cancel login [name/password is invalid] Show desktop [name/password is valid] Show Error msg

  13. Repetition Sometimes you would like to repeat some action. This doesn't require new diagram elements but can be expressed via actions, arcs, and conditionals.

  14. Repetition [ending condition] repeated action [continue condition] repeated action [continue condition] [ending condition]

  15. Repetition example

  16. Example • In class exercise: • Write the diagram that says: I would like to eat a slice of pizza until I'm full and then study, watch Star Wars on Blu-ray and go to bed.

More Related