More Functional Decomposition

Slides:



Advertisements
Similar presentations
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Advertisements

Introduction to Functional Decomposition Intro to Computer Science CS 1510 Dr. Sarah Diesburg.
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
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.
More on Functions (Part 2) Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
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.
L061 Algorithms, Part 3 of 3 Topics Top down-design Structure charts Reading Sections , 3.3.
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 (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.
Software Development.
CS240: Advanced Programming Concepts
Algorithms IV Top-Down Design.
More on Functions (Part 2)
IST256 : Applications Programming for Information Systems
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
UMBC CMSC 104 – Section 01, Fall 2016
Chapter 8 Namespaces and Memory Realities
Welcome to CS 1010! Algorithmic Problem Solving.
Introduction to Functional Decomposition
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
Lists – Indexing and Sorting
Computational Thinking
String Encodings and Penny Math
Intro to Computer Science CS1510 Dr. Sarah Diesburg
More Functional Decomposition
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
4. Computational Problem Solving
Intro to Computer Science CS1510 Dr. Sarah Diesburg
More on Functions (Part 2)
More on Functions (Part 2)
Lists – Indexing and Sorting
Intro to Nested Looping
Types, Truth, and Expressions (Part 2)
Star Wars Rebellion A Lucas Arts game.
Recursion Taken from notes by Dr. Neil Moore
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Thinking about programming
Chapter 8 Namespaces and Memory Realities
Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg
More Functional Decomposition
CS150 Introduction to Computer Science 1
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
Presentation transcript:

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

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!