120 likes | 378 Views
Modeling Solutions. Explicit problem solving. http://www.flickr.com/photos/hyougushi/337024525/sizes/o/in/photostream/. Models. Life is full of models toy airplane model train fashion models weather models geo-physical models financial models
E N D
Modeling Solutions Explicit problem solving http://www.flickr.com/photos/hyougushi/337024525/sizes/o/in/photostream/
Models • Life is full of models • toy airplane • model train • fashion models • weather models • geo-physical models • financial models • Model : a replica or representation of some object or system.
Model • Models rely on abstraction to emphasize important characteristics and remove unnecessary detail • Architects use physical models of their buildings to highlight the aesthetics • Movie creators use storyboards to model a film in terms of separate scenes • Flight simulators are models of planes for the purpose of training pilots
Modeling Algorithms • Two techniques for modeling computation • Activity Diagram: • A way to model the sequence of actions that comprise an algorithm. • Also known as a flow-chart or flow-diagram • State Diagram: • A way to model the way data changes within an algorithm.
Details Activity : sequence of actions that can be thought of as a “single computation”. Control flow : the arrow points to what happens next. The arrow must end at either a rectangle or a diamond. An arrow can be thought of as “then do”. Decision/merge : wherever the control must split or join together. Start: the start of the algorithm End : the end of the algorithm
Example • Description • Start at the top • “then do” eat dinner • “then do” snack on anchovies • “then do” study for CT100 • Note: activity diagrams don’t give details about specific steps or data. Flow of control is nonetheless well specified. Eat dinner Snack on anchovies Study for CT100
Example A join is required wherever two or more flows come together
Optional Activities Optional activities can make good use of the selection pattern
More than two A decision can split into more than two channels of activity
Repetition Repetition involves a loop with conditionals