1 Data Structures CSCI 132, Spring 2014 Lecture 3 Programming Principles and Life Read Ch. 1.

Slides:



Advertisements
Similar presentations
Data Structures Chapter 1 Programming Principles Andreas Savva.
Advertisements

Procedures and Stacks. Outline Stack organization PUSH and POP instructions Defining and Calling procedures.
1 The Game of Life Supplement 2. 2 Background The Game of Life was devised by the British mathematician John Horton Conway in More sophisticated.
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
Cellular Automata (Reading: Chapter 10, Complexity: A Guided Tour)
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter1 PROGRAMMING PRINCIPLES. Problems of Large Programs 1.The patchwork approach --- Disadvantage: if any change must be made, it will have unpredictable.
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
1 CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
Chapter 1 Principles of Programming and Software Engineering.
Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand.
Programming Fundamentals (750113) Ch1. Problem Solving
BPC.1 Basic Programming Concepts
Data Structures and Programming.  John Edgar2.
Modular Programming Chapter Value and Reference Parameters t Function declaration: void computesumave(float num1, float num2, float& sum, float&
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
CS1: chr, jeh, & Testing vs. Debugging Testing finds problems –Unit test –Integration test –System test Debugging finds and fixes causes.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
CIS 068 Welcome to CIS 068 ! Stacks and Recursion.
Chapter 3 Developing an algorithm. Objectives To introduce methods of analysing a problem and developing a solution To develop simple algorithms using.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
1 ENERGY 211 / CME 211 Lecture 26 November 19, 2008.
CSE 219 Computer Science III Program Design Principles.
1 C++ Plus Data Structures Nell Dale Chapter 1 Software Engineering Principles Modified from the Slides made by Sylvia Sorkin, Community College of Baltimore.
Kruse/Ryba Ch011 Object Oriented Data Structures Programming Principles Introduction Programming Style Coding, Testing, Further Refinement Program Maintenance.
Oct 15, 2007Sprenkle - CS1111 Objectives Creating your own functions.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
1 Data Structures CSCI 132, Spring 2014 Lecture 4 Implementing Life.
Programming Principles Chapter 1. Objectives Discuss the program design process. Introduce the Game of Life. Discuss object oriented design. – Information.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Testing and Debugging Session 9 LBSC 790 / INFM 718B Building the Human-Computer Interface.
C Programming Lecture 8-1 : Function (Basic). What is a Function? A small program(subroutine) that performs a particular task Input : parameter / argument.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
The Software Development Process
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Design - programming Cmpe 450 Fall Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
1 Recursion n what is it? n how to build recursive algorithms n recursion analysis n tracing simple recursive functions n hands on attempts at writing.
Chapter 7 Implementation. Implementation Approaches F Big bang –Code entire system and test in an unstructured manner F Top-down –Start by implementing.
CSI 1340 Introduction to Computer Science II Chapter 1 Software Engineering Principles.
1 Data Structures CSCI 132, Spring 2014 Lecture 1 Big Ideas in Data Structures Course website:
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
The Hashemite University Computer Engineering Department
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Principles of Programming. Achieving an Object-Oriented Design  Abstraction and Information Hiding  Object-Oriented Design  Functional Decomposition.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Evolution of C and C++ n C was developed by Dennis Ritchie at Bell Labs (early 1970s) as a systems programming language n C later evolved into a general-purpose.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Testing It is much better to have a plan when testing your programs than it is to just randomly try values in a haphazard fashion. Testing Strategies:
CSC 107 – Programming For Science. Today’s Goal  Write functions that take & return values  How parameters declared and how we call functions  What.
Testing and Debugging UCT Department of Computer Science Computer Science 1015F Hussein Suleman March 2009.
Implementation Topics Describe –Characteristics of good implementations –Best practices to achieve them Understand role of comments Learn debugging techniques.
Kruse/Ryba Ch011 Object Oriented Data Structures Programming Principles Introduction Programming Style Coding, Testing, Further Refinement Program Maintenance.
C++ Plus Data Structures
Principles of Programming and Software Engineering
About the Presentations
Programming Problem steps must be able to be fully & unambiguously described Problem types; Can be clearly described Cannot be clearly described (e.g.
Problem Solving Techniques
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
CSE 303 Concepts and Tools for Software Development
Algorithms and Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Software Development Chapter 1.
Presentation transcript:

1 Data Structures CSCI 132, Spring 2014 Lecture 3 Programming Principles and Life Read Ch. 1

2 CS Humor

3 Program Lifecycle Problem Specification Program Design Program Implementation Testing and Verification Maintenance

4 Problem Specification State precise goals of project. What is the input? What is the output? Divide the work into smaller problems (divide and conquer). Specify each smaller problem precisely. (Pre-conditions, Post-conditions). Keep dividing until small problems are easily solvable.

5 Program Design and Implementation Design: Carefully choose the data structures you will use (Lists, Stacks, Queues?) Decide how data is arranged, stored in memory, calculated, stored in files, etc. Choose an algorithm (We will learn how to analyze the behavior of algorithms to choose among them). Implementation: Implement using good programming techniques (data hiding, modularity, etc.)

6 Testing and Verification Test and re-test as you develop the program. Develop program in pieces and test each piece as it is finished. Think carefully about testing conditions. Test final program thoroughly.

7 Maintenance Maintenance is used to: Fix bugs found during program use. Add features as they become needed.

8 Programming Style Keep your code clear and simple. Use clear comments. Try to use meaningful variable names: input_file, number_courses, index Avoid cryptic variable names: indx, nmcs, x Use comments where needed to explain a block of code. Use white space and tabs to make your programs readable.

9 Program Refinement As you divide program into subproblems, think carefully about how to divide work into classes and functions. Rule of thumb: Classes are like nouns used to describe the problem (e.g. the Student class). Functions are like verbs: void AddCourse(string9 courseName)

10 Input and Output parameters Input parameters are used by the function but not changed by the function. They are usually pass-by- value. Output parameters contain the results of function execution. They are pass-by-reference. Input/Output parameters have an initial value used by the function and are modified by the function. They are pass-by-reference.

11 Local vs. Global variables Local Variables: Defined and used within a function. Exist only during function execution. Global variables: Defined outside function. Often exist throughout program execution. If a function modifies a global variable, it is called a side effect of the function. This is undesirable. Using global variables decreases the modularity of a function. Try to avoid using global variables.

12 Debugging Structured walkthrough Trace tools and snapshots Scaffolding Static analyzer

13 Program Testing The black box method. Test the following types of input: Easy values Typical values Extreme values Illegal values

14 Program Testing The glass box method. Trace all paths through a program: if ( x == 0) { a = 1; } else { a = 2; } Test values of x == 0 and x != 0. Good to do for modules. Not practical for large programs.

15 Program Testing The ticking box method. Don’t test. Tick…tick….tick…. Kaboom!!!

16 Rules of Life The neighbors of a given cell are the eight cells that touch it. Every cell is either living or dead. A living cell stays alive in the next generation if it has either 2 or 3 living neighbors; otherwise it dies (of loneliness or overcrowding) A dead cell becomes alive in the next generation if it has exactly 3 neighboring cells that are already alive. All births and deaths take place at exactly the same time for each generation.

17 Sample configurations There are lots of websites devoted to life. Check out:

18 Why is Life Interesting? John Conway developed Life rules in He tried lots of rules, but only these rules resulted in interesting complexity. Life is an example of a Cellular Automaton. Life exhibits Emergent Complexity. Life is a Turing Machine.

19 Specifications What do we want our program to do? (We will answer this question in class).