Presentation is loading. Please wait.

Presentation is loading. Please wait.

Models of Computation 1 Activity Diagrams

Similar presentations


Presentation on theme: "Models of Computation 1 Activity Diagrams"— Presentation transcript:

1 Models of Computation 1 Activity Diagrams
Software to Go with the Flow

2 Software Engineering Step #1 Analyze the problem. Step #2
Design the architecture of a solution. Step #3 Implement the design as a computer program. In CS101 you spend almost no time with steps 1 & 2, but good SEs devote more time to this than to coding.

3 Software Engineering Step #1 Analyze the problem. Step #2
Implement the design as a computer program. Step #2 Design the architecture of a solution. The work of software design is much like the work of an architect.

4 What are the ingredients of a computer program?
1) data Software design must also focus on these. 2) algorithm (instructions) Algorithms to manipulate those data. Note that earlier lectures discussed how information is encoded as computer data and a look at some algorithms. We talked about two types of algorithms: divide & conquer algorithms and greedy algorithms. This lecture and the next focus on tools for algorithmic design; the lecture after that is about organizing data.

5 Algorithmic Thinking examples of algorithms
DEFN (revisited) An algorithm is a group of instructions (often expressed informally) for performing some task. examples of algorithms • recipe for baking cookies • a set of travel directions • directions for operating your cell phone • procedures for registering for next semester’s classes • instructions for completing an income tax form Algorithms are everywhere in our world. We all need to READ them ...and our world would be a better place if more people could WRITE them (properly). • a computer program

6 Diagrams Software Design Software Diagrams Activity Diagrams
“Picture that!” “One picture is worth a thousand words.” Software Design Software Diagrams Activity Diagrams State Diagrams Talk about architects using blueprints of many kinds - blueprints of superstructure, blueprints of floor plans, blueprints of electrical systems, blueprints of plumbing, blueprints of heatig/ventilation In this lecture we focus on ACTIVITY DIAGRAMS - next week it is state diagrams

7 Activity Diagrams the purpose the notation
• a notation for depicting algorithms • captures the flow of an algorithm • activity diagrams are a kind of flow diagram / flowchart • part of the Unified Modeling Language (UML) the notation an action to be performed Flow can be thought of as the steps of an algorithm along with the order in which those steps are performed. a flow that determines the order of actions a point at which flows merge or split (a choice)

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

9 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.

10 Conditional Actions Waste time on Facebook Study
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 [exam tomorrow] [no exam tomorrow] Study Waste time on Facebook

11 Simple Activity Diagram
Instructions for setting wristwatch time Talk about sequence

12 Making Choices in Algorithms
the pattern from some previous part of the diagram ••• Choice #1 Choice #N Talk about the kind of choices made in algorithms (a chess-playing algorithm, an algorithm to handle menu-driven input, anti-lock brake software. Choice #2

13 Login Algorithm Notice how the choices are labeled ... with PROPOSITIONS. Note: I’m using blue for user and green for system -- not standard UML, but useful.

14 Repetition in Algorithms
the patterns The circular flow is where the name “LOOP” comes from.

15 Fudge Algorithm Q: What’s missing? A: The EAT action.

16 Login Algorithm 2 The point here is to demonstrate there are different algorithms. This one is probably more true to the way login panels actually work. Note how actions (from the last algorithm) are used as conditions here.

17 Flight Reservation Algorithm

18 Email Client Algorithm

19


Download ppt "Models of Computation 1 Activity Diagrams"

Similar presentations


Ads by Google