How to develop a program CSE 160 University of Washington 1.

Slides:



Advertisements
Similar presentations
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Advertisements

Coding. Steps to Success 1.Create a PLAN including a detailed statement of requirements (SORs) 2.Write algorithms based on the SORs 3.Write pseudocode.
1.4 Programming Tools Flowcharts Pseudocode Hierarchy Chart
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2 - Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 2 - Problem Solving
19-1 Programming… The Pencil and Paper Computer The Pencil & Paper Instruction Set: (table on p148) The Operand specifies a memory location.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Program Design and Development
Computers: Tools for an Information Age
Computer Science 1620 Programming & Problem Solving.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
Introduction to Computers and Programming
Introduction to Programming (in C++) Introduction Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
The Art of Programming Top-Down Design. The Art of Problem Solving The art of problem solving is the transformation of an English description of a problem.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Software Development Concepts ITEC Software Development Software Development refers to all that is involved between the conception of the desired.
6 Steps of the Programming Process
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
The Software Development Life Cycle. Software Development SDLC The Software Development Life-Cycle Sometimes called the program development lifecycle.
CSE 219 Computer Science III Program Design Principles.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
The Software Development Process
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Chapter One An Introduction to Programming and Visual Basic.
CSE 190p wrapup Michael Ernst CSE 190p University of Washington.
Introduction to programming Carl Smith National Certificate Year 2 – Unit 4.
The Art of Programming. The process of breaking problems down into smaller, manageable parts By breaking the problem down, each part becomes more specific.
INLS 560 – F UNCTIONS Instructor: Jason Carter.
1/32 This Lecture Substitution model An example using the substitution model Designing recursive procedures Designing iterative procedures Proving that.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Expressing Algorithms as Flowcharts and Pseudocode
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Efficiently Solving Computer Programming Problems Doncho Minkov Telerik Corporation Technical Trainer.
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
Introduction to Computing Systems and Programming Programming.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
How to develop a program CSE 140 University of Washington 1.
 Problem Analysis  Coding  Debugging  Testing.
Introduction to Programming in C++ Seventh Edition Chapter 1: An Introduction to Programming.
Program design Program Design Process has 2 phases:
How to develop a program
ICS 3UI - Introduction to Computer Science
CSCI-235 Micro-Computer Applications
Topic: Functions – Part 2
Think What will be the output?
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Overview Instruction Codes Computer Registers Computer Instructions
CMIS 102 Education for Service-- snaptutorial.com
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Problem Solving Techniques
How to develop a program
Designing Programs.
Algorithms, Part 2 of 3 Topics Problem Solving Examples Pseudocode
Chapter One: An Introduction to Programming and Visual Basic
The Programming Process
How to develop a program
CMPT 120 Lecture 16 – Unit 3 – Graphics and Animation
How to develop a program
Presentation transcript:

How to develop a program CSE 160 University of Washington 1

Program development methodology: English first, then Python 1.Define the problem 2.Decide upon an algorithm 3.Translate it into code Try to do these steps in order 2

Program development methodology: English first, then Python 1.Define the problem A.Write an English description of the input and output for the whole program. (Do not give details about how you will compute the output.) B.Create test cases for the whole program Input and expected output 2.Decide upon an algorithm 3.Translate it into code Try to do these steps in order 3

Program development methodology: English first, then Python 1.Define the problem 2.Decide upon an algorithm A.Implement it in English Write the recipe or step-by-step instructions B.Test it using paper and pencil Use small but not trivial test cases Play computer, animating the algorithm Be introspective – Notice what you really do – May be more or less than what you wrote down – Make the algorithm more precise 3.Translate it into code Try to do these steps in order 4

Program development methodology: English first, then Python 1.Define the problem 2.Decide upon an algorithm 3.Translate it into code A.Implement it in Python Decompose it into logical units (functions) For each function: – Name it (important and difficult!) – Write its documentation string (its specification) – Write tests – Write its code – Test the function B.Test the whole program Try to do these steps in order 5

Program development methodology: English first, then Python 1.Define the problem 2.Decide upon an algorithm 3.Translate it into code Try to do these steps in order – It’s OK (even common) to back up to a previous step when you notice a problem – You are incrementally learning about the problem, the algorithm, and the code – “Iterative development” 6

The Wishful Thinking approach to implementing a function If you are not sure how to implement one part of your function, define a helper function that does that task – “I wish I knew how to do task X” – Give it a name and assume that it works – Go ahead and complete the implementation of your function, using the helper function (and assuming it works) – Later, implement the helper function – The helper function should have a simpler/smaller task Can you test the original function? – Yes, by using a stub for the helper function – Often a lookup table: works for only 5 inputs, crashes otherwise, or maybe just returns the same value every time 7

ThinkPython 3.12 Why functions? It may not be clear why it is worth the trouble to divide a program into functions. There are several reasons: Creating a new function gives you an opportunity to name a group of statements, which makes your program easier to read and debug. Functions can make a program smaller by eliminating repetitive code. Later, if you make a change, you only have to make it in one place. Dividing a long program into functions allows you to debug the parts one at a time and then assemble them into a working whole. Well-designed functions are often useful for many programs. Once you write and debug one, you can reuse it. 8