More Functional Decomposition

Slides:



Advertisements
Similar presentations
Introduction to Functional Decomposition Intro to Computer Science CS 1510 Dr. Sarah Diesburg.
Advertisements

Problem Solving and Algorithm Design
Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer.
Algorithms and Problem Solving-1 Algorithms and Problem Solving Mainly based on Chapter 6: “Problem Solving and Algorithm Design” from the Book: “Computer.
Algorithms and Problem Solving
J. Michael Moore Software Design CSCE 110 Influenced by material developed by James Tam & Jennifer Welch.
J. Michael Moore Software Design CSCE 110 Influenced by material developed by James Tam & Jennifer Welch.
6-1 Problem Solving Problem solving is the act of finding a solution to a perplexing, distressing, vexing, or unsettled question.
Sort an array - the selection sort algorithm. Selection Sort Selection sort a classic computer algorithm that is used to sort an array The selection sort.
Chapter 11 Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Problem Solving and Algorithm Design. 2 Problem Solving Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled.
Authors of the Ages: Final Project. Part ONe ON YOUR OWN, you will research an author and put together a presentation about them. Who- is your author?
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Lab 07: Caesar Cypher Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Algorithms CS139 – Aug 30, Problem Solving Your roommate, who is taking CS139, is in a panic. He is worried that he might lose his financial aid.
Lecture 13: 10/10/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Intro to Nested Looping Intro to Computer Science CS1510 Dr. Sarah Diesburg.
CS139 – Algorithm Development Aug 23, 2004 WELCOME!
More on Functions Intro to Computer Science CS1510 Dr. Sarah Diesburg.
Algorithms CS280 – 10/20/05. Announcement  Part 1 of project 2 due.  Read chapters 10, 7 for this unit  Tuesday we will also be in the classroom We.
Chapter More on Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
More on Functions Intro to Computer Science CS1510 Dr. Sarah Diesburg.
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Algorithms Sept 4, Tuesday’s Lab You developed an algorithm Input – an 8 ½ x 11 inch piece of paper Audience – Fellow classmates Process – Instructions.
© 2016 AQA. Created by Teachit for AQA Lesson Representing algorithms (decomposition)
Software Development.
Algorithms IV Top-Down Design.
More on Functions (Part 2)
More Functional Decomposition
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
UNIT 3 – LESSON 5 Creating Functions.
Thinking about programming
CMSC201 Computer Science I for Majors Lecture 11 – Program Design
Chapter 8 Namespaces and Memory Realities
Welcome to CS 1010! Algorithmic Problem Solving.
Welcome to CS 1010! Algorithmic Problem Solving.
Introduction to Functional Decomposition
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Welcome to CS 1010! Algorithmic Problem Solving.
More Nested Loops and Lab 5
Module 5 Lesson 3 Extreme Scratch Cards
Computational Thinking
String Encodings and Penny Math
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Types, Truth, and Expressions (Part 2)
Intro to Nested Looping
Types, Truth, and Expressions (Part 2)
Problem Solving and Algorithm Design
More Functional Decomposition
Chapter 8 Namespaces and Memory Realities
Thinking about Strings
Exploring Computer Science Lesson 4-11
Intro to Computer Science CS1510 Dr. Sarah Diesburg
More on Functions (Part 2)
More on Functions (Part 2)
Intro to Nested Looping
Types, Truth, and Expressions (Part 2)
The first number is posted telling what random number was selected, I did this for testing purposes, in the real thing it would not be there. Since the.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Chapter 8 Namespaces and Memory Realities
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
More Functional Decomposition
String Encodings and Penny Math
CMSC201 Computer Science I for Majors Lecture 12 – Program Design
Intro to Computer Science CS1510 Dr. Sarah Diesburg
More Functional Decomposition
Types, Truth, and Expressions
Presentation transcript:

More Functional Decomposition Intro to Computer Science CS 1510 Dr. Sarah Diesburg

Questions on yesterday’s lab? Let’s create our own rock, paper, scissors hierarchical solution tree together

Functional Cohesion Functional cohesion* – each module should do just one thing and do it well * Special thanks to Dr. McCormick for the use of his materials from the book: Dale, Weems, and McCormick. Programming and Problem Solving with ADA 95.

Which module lack functional cohesion? Process credit card transactions Determine weight and pick color Print final score Pick floor covering and large screen television Determine costs of tuition and entertainment expenses Determine the cost of baking a cake Ask user preferences Determine average and letter grade

How to write cohesive modules Think about how you would solve the subproblem by hand Begin writing down the major steps If the step is simple enough to implement directly in Python, it is already concrete (do not refine it further) If you still need to think about implementing the step as a series of smaller steps, it is still abstract

How to write cohesive modules (cont.) If you are trying to write a series of steps and get overwhelmed by the details, you probably bypassed one or more levels of abstraction Look for pieces that can be written as more abstract steps to be broken down later

Example: Card Game War Let’s use the hierarchical solution tree we built to convert our script version into a version with functions that map to each module!