Herbert G. Mayer, PSU CS Status 8/2/2013

Slides:



Advertisements
Similar presentations
ECE 103 Engineering Programming Chapter 54 Recursion Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material developed.
Advertisements

1 CS 106, Winter 2009 Class 11, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
1 CS 106, Winter 2009 Class 5, Section 4 Slides by: Dr. Cynthia A. Brown, Instructor section 4: Dr. Herbert G. Mayer,
Algorithm Programming Coding Advices Bar-Ilan University תשס " ו by Moshe Fresko.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
ECE 103 Engineering Programming Chapter 10 Variables, AKA Objects Herbert G. Mayer, PSU CS Status 6/19/2015 Initial content copied verbatim from ECE 103.
1 CS 106 Computing Fundamentals II Chapter 17 “Introduction To VBA” Herbert G. Mayer, PSU CS status 6/30/2013 Initial content copied verbatim from CS 106.
1 CS 106 Computing Fundamentals II Chapter 25 “Variables, Assignment Statement” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
1 CS 106 Computing Fundamentals II Chapter 29 “Creating A User Form” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim from CS 106.
1 CS 106 Computing Fundamentals II Chapter 7 “Showing Developer Tab” Herbert G. Mayer, PSU CS status 6/17/2013 Initial content copied verbatim from CS.
1 CS 106 Computing Fundamentals II Chapter 4 “Excel Basics for Mac” Herbert G. Mayer, PSU CS status 6/27/2013 Initial content copied verbatim from CS 106.
1 CS 106 Computing Fundamentals II Chapter 34 “Conditionals In Excel” Herbert G. Mayer, PSU CS Status 7/17/2013 Initial content copied verbatim from CS.
Test-based programming Ask: “What should this software do?” Write a test first “Does this software do X correctly?” Fill in the code, and keep working.
Designing with Procedures 1. Designing a Program with Procedures If the code for your program is going to be less than one page, normally don’t bother;
SE: CHAPTER 7 Writing The Program
CS 320 Assignment 1 Rewriting the MISC Osystem class to support loading machine language programs at addresses other than 0 1.
1 CS 106 Computing Fundamentals II Chapter 61 “Loops” Herbert G. Mayer, PSU CS Status 7/29/2013 Initial content copied verbatim from CS 106 material developed.
1 CS 106 Computing Fundamentals II Chapter 84 “Array Formulae” Herbert G. Mayer, PSU CS status 6/14/2013 Initial content copied verbatim from CS 106 material.
1 CS 106 Computing Fundamentals II Chapter 67 “Working With Files” Herbert G. Mayer, PSU CS status 6/24/2013 Initial content copied verbatim from CS 106.
ECE 103 Engineering Programming Chapter 36 C Storage Classes Herbert G. Mayer, PSU CS Status 8/4/2014 Initial content copied verbatim from ECE 103 material.
1 CS 106 Computing Fundamentals II Chapter 75 “Arrays” Herbert G. Mayer, PSU CS Status 7/31/2013 Initial content copied verbatim from CS 106 material developed.
1 CS 106 Computing Fundamentals II Chapter 21 “Computer Organization” Herbert G. Mayer, PSU CS Status 7/9/2013 Initial content copied verbatim from CS.
1 CS 106 Computing Fundamentals II Chapter 23 “Controls And Events” Herbert G. Mayer, PSU CS Status 7/5/2013 Initial content copied verbatim from CS 106.
1 CS 106 Computing Fundamentals II Chapter 211 “Coding And Debugging” Herbert G. Mayer, PSU CS status 6/29/2013 Initial content copied verbatim from CS.
CS 161 Introduction to Programming and Problem Solving Chapter 18 Control Flow Through C++ Program Herbert G. Mayer, PSU Status 10/8/2014 Initial content.
1 CS 106 Computing Fundamentals II Chapter 210 “Adding Controls to User Forms” Herbert G. Mayer, PSU CS Status 7/4/2013 Initial content copied verbatim.
ECE 103 Engineering Programming Chapter 31 C Scopes Herbert G. Mayer, PSU CS Status 8/1/2015 Initial content copied verbatim from ECE 103 material developed.
1 CS 106 Computing Fundamentals II Chapter 6 “How To Zip & Unzip Files” Herbert G. Mayer, PSU CS status 6/17/2013 Initial content copied verbatim from.
1 CS 106 Computing Fundamentals II Chapter 28 “Scope” Herbert G. Mayer, PSU CS Status 7/14/2013 Initial content copied verbatim from CS 106 material developed.
Be “GUI ready” developing in RPG by Robert Arce from PrismaTech. Be “GUI ready” developing in RPG-ILE Presented by: Robert Arce.
Recursion. Definitions I A recursive definition is a definition in which the thing being defined occurs as part of its own definition Example: A list.
Chapter 5 Section 2 The Theory Of Production. Production Functions Figure that shows how total output changes based on the change of a single variable.
1 CS 106 Computing Fundamentals II Chapter 42 “Sub Procedures And Functions” Herbert G. Mayer, PSU CS Status 8/5/2013 Initial content copied verbatim from.
1 CS 106 Computing Fundamentals II Chapter 85 “Excel Tables” Herbert G. Mayer, PSU CS status 6/14/2013 Initial content copied verbatim from CS 106 material.
CMSC 104, Version 8/061L16IncrementalProg.ppt Incremental Programming Topics Review of Incremental Programming Example of Incremental Programming Reading.
CS 106 Computing Fundamentals II Chapter 5 “Excel Basics for Windows”
VISUAL BASIC .NET Chapter 3 Assignment Sheet
CS 106 Computing Fundamentals II Chapter 35 “Controls For Choices”
CS1371 Introduction to Computing for Engineers
Organization of Programming Languages
CS 106 Computing Fundamentals II Chapter 77 “Algorithm”
CS 106 Computing Fundamentals II Chapter 33 “Conditional Statements”
UNIX PROCESSES.
Functions.
Introduction to Events
CSC 253 Lecture 8.
CSC 253 Lecture 8.
CS 106 Computing Fundamentals II Chapter 71 “Indexing”
Code Smells 1.
CS 106 Computing Fundamentals II Chapter 73 “Ranges”
CS 106 Computing Fundamentals II Chapter 66 “Working With Strings”
Nate Brunelle Today: Functions again, Scope
Chapter 6 - Procedures and Macros
CSE 303 Concepts and Tools for Software Development
ECE 103 Engineering Programming Chapter 56 Runtime Errors
CS 106 Computing Fundamentals II Chapter 64 “For Loop Variations”
ECE 103 Engineering Programming Chapter 19 Nested Loops
ECE 103 Engineering Programming Chapter 12 More C Statements
ECE 103 Engineering Programming Chapter 51 Random Numbers
ECE 103 Engineering Programming Chapter 25 C Strings, Part 1
ECE 103 Engineering Programming Chapter 46 argc, argv, envp
ECE 103 Engineering Programming Chapter 37 C Macro Parameters
ECE 103 Engineering Programming Chapter 8 Data Types and Constants
CS 106 Computing Fundamentals II Chapter 69 “Event Loop”
ECE 103 Engineering Programming Chapter 20 Change in Flow of Control
ECE 103 Engineering Programming Chapter 35 C Pointers, Part 1
ECE 103 Engineering Programming Chapter 38 C Pointers, Part 2
Nate Brunelle Today: Functions again, Scope
Chapter (3) - Procedures
Refactoring.
Presentation transcript:

CS 106 Computing Fundamentals II Chapter 43 “Designing With Procedures” Herbert G. Mayer, PSU CS Status 8/2/2013 Initial content copied verbatim from CS 106 material developed by CS professors: Cynthia Brown & Robert Martin

Syllabus Designing With Procedures Information Sharing Procedure Specification Implementation Refactoring Example

Designing With Procedures If the code for your program is way less than one page, normally don’t bother with formal design; otherwise: List the major steps of the program. See if it makes sense to use a procedure for each major step Look for opportunities to use a procedure to avoid duplication of code

Information Sharing What information does each procedure need? What should the formal parameters be? Which global variables will be accessed or even changed? What should be handled by local variables? Keep in mind that variables should be local unless there is a very good reason to make them global!

Procedure Specification For each procedure in your design, write a brief description of what it does, what global variables it changes, and what parameters it needs. If it is a function, include what value it returns Step through an execution of your process and make sure the information flow is correct Remember to develop tests before you write code!

Implementation DO NOT WRITE THE WHOLE PROGRAM AT ONCE!!!! You can write just one procedure, or just parts of a couple of procedures, and test them. Keep adding bits using your design as a guide until you have all the functionality. Write enough printing code as you go along to see what’s happening. If you have to write extra code, it will save you time in the long run. Or, step through.

Refactoring Rewriting existing code to improve it is a common operation Often features are added to a program incrementally and at some point it just gets too messy, unwieldy, and hard to understand Changing and improving the code structure is called refactoring