COSC345 Software Engineering. Documentation
|
|
- Eugene Floyd
- 5 years ago
- Views:
Transcription
1 COSC345 Software Engineering Documentation
2 Documentation Self-documenting code Comments Outline
3 Documentation And Comments McConnell Most developers like writing documentation If the standards aren t unreasonable It is a sign of pride (just like good layout) Documentation Outside the program Functional specification Product manuals First version written by the chief architect Revisions done by professional authors Can be as much as 2/3 of the project effort (Boehm, 1984) Inside the program We call these comments
4 Comments Source Code Documentation Detailed description of the code Most likely to be correct as they change with the code The best form is the code itself! Aim for total legibility, completely self-documenting code Use a straightforward approach to coding Choose meaningful variable names Use appropriate routine names Use named constants (no magic-numbers) Ensure a clear and consistent layout Reduce the use of break & continue: use a clean code flow Use simple data structures
5 What Does This Do? for i := 1 to Num do MeetsCriteria[ i ] := True; for i := 1 to Num / 2 do begin j := i + i; while ( j <= Num ) do begin MeetsCriteria[ j ] := False; j := j + i; end; end; for i := 1 to Num do if MeetsCriteria[ i ] then writeln( i, ' meets criteria ' ); Taken from McConnell
6 What Does This Do? for PrimeCandidate:= 1 to Num do IsPrime[ PrimeCandidate] := True; for Factor:= 1 to Num / 2 do begin FactorableNumber := Factor + Factor; while ( FactorableNumber <= Num ) do begin IsPrime[ FactorableNumber ] := False; FactorableNumber := FactorableNumber + Factor; end; end; for PrimeCandidate:= 1 to Num do if IsPrime[ PrimeCandidate] then writeln( PrimeCandidate, ' is Prime ' ); Taken from McConnell
7 McConnell s Checklist (adapted) Routines Does the name describe exactly what the routine does? Does it perform one well-defined task? Are all separate parts separated (into different routines)? Is the interface obvious and clear? Data Do type names document the declaration? Are variables well named? Are variables only used for the purpose they are named? Are loop variables given informative names (not: i,j,k,x)? Are enumerated types used instead of flags? Are constants used instead of magic values (and strings)? Are constants distinguished from types from variables?
8 McConnell s Checklist (adapted) Data organization Are extra variables used for clarity when needed? Are all references to a variable close to each other? Are data structures simple (do they reduce complexity)? Is complex data accessed through access routines (get and put)? Control Is the normal path of the code clear? Are related statements grouped together (and separated by spaces)? Are independent groups of statements in a separate routine? Does the normal case follow the if (and not the else)? Do control structures minimize complexity? Does each loop perform one and only one operation? Is nesting minimized (should you use a routine for that)? Are Boolean operations minimized (are they readable)?
9 McConnell s Checklist (adapted) Layout Does the program s layout show the structure? Design Is the code straightforward? Does it avoid cleverness? Are the implementation details hidden? Are domain structures used (rather then computer structures)?
10 Comments Are Bad! Comments make the code harder to read Worse: you have to read both Natural languages are imprecise Programming languages are precise Comments are long and prone to inconsistencies Programming statements are short and to the point How can a comment be clear if the code isn t clear? Out of date comments are dangerous Very few people keep comments up-to-date Highly commented parts of code have the highest error rate (Lind & Vairavan 1989) Don t comment tricky code, re-write it!
11 Comments Are Good! All the arguments against comments are true But those weren t good comments Comments should be used at a high level of abstraction High level languages for programming Higher level of abstraction for the comments Comments clarify the intent of the code Comments don t repeat or explain the code They should read like headings in a textbook One short sentence in natural language Disagreement between code and comments? Both are probably wrong! Comments make you think about the code If its hard to explain its probably wrong
12 What Does This Do? // write out the sums 1..n for all n from 1 to num crnt = 1; prev = 0; sum = 1; for (i = 1; i < num; i++) { System.out.println( sum ); sum = crnt + prev; prev = crnt; crnt = sum; } Taken From (adapted from McConnell): jeroen.a-eskwadraat.nl/projects/ vakken/prtki/website/collegelex1.pdf
13 Kinds of Comments Repeat of the code Pointless: read the code Explanation of the code Pointless: the code probably needs a re-write Marker in the code Used during development to mark what has to be done Remove when the coding session is over? Summary of the code Designed to help readers of the code Description of intent Explains the purpose of the code to a reader All comments (except summary & intent) are redundant Navigational markers are sometimes useful too
14 Comment Placement Individual lines Put on the end of the line of code What do these (real world) comments mean? long time /* no c */ mov ax, 723h /* R.I.P.L.V.B. */ Only comment when lines are complicated (better: break it up) Don t individual line comment a loop or block start / end Does it apply to the for or the contents of the for? Good for structure member declarations Good to mark a previous error (to stop someone fixing it) Blocks of code Indent with the block of code to maintain readability Explain what to expect (comment before, not after) Explain surprises Discuss why not how Avoid abbreviations
15 Comment Places Variables and types Comment units and allowable ranges Comment encodings (better: use an enum) Comment limits on input data Document each bit in a flag Document global variables (why must they be global) Relationships between variables Special cases Exhaustively comment a compiler work around How else can someone know why the code is peculiar? Exhaustively comment style violations Why was it necessary to break convention Don t comment bad code rewrite it (Kernighan and Plauger, 1978)
16 Routines '******************************************************************* ' Name: CopyString ' ' Purpose: This routine copies a string from the source ' string (source) to the target string (target). ' ' Algorithm: It gets the length of "source" and then copies each ' character, one at a time, into "target". It uses ' the loop index as an array index into both "source" ' and "target" and increments the loop/array index ' after each character is copied. ' ' Inputs: input The string to be copied ' ' Outputs: output The string to receive the copy of "input" ' ' Interface Assumptions: None ' ' Modification History: None ' ' Author: Dwight K. Coder ' Date Created: 10/1/04 ' Phone: (555) '*******************************************************************
17 Routines and Modules Keep comments with the code they describe Better: keep comments out of the routines Document the source of an algorithm So you can go and look it up (to fix any bugs) Mark routines with comments Helps break-up the code and helps with navigation Document modules Document the purpose (at the top) Remember: the routines are already documented
18 Recommendations Treat comments as code Keep comments indented with the blocks of code Make comments look like indented blocks of code /* Comment */ Comment as you go along You re unlikely to go back and do it later You need the comments while you are writing the code Don t write comments that are too long Never have a quota N lines of code per comment Because you ll write empty comments!
19 References S. McConnell, Code Complete, Chapter 19
6.170 Laboratory in Software Engineering Java Style Guide. Overview. Descriptive names. Consistent indentation and spacing. Page 1 of 5.
Page 1 of 5 6.170 Laboratory in Software Engineering Java Style Guide Contents: Overview Descriptive names Consistent indentation and spacing Informative comments Commenting code TODO comments 6.170 Javadocs
More informationEE 382 Style Guide. March 2, 2018
EE 382 Style Guide March 2, 2018 This is a short document describing the coding style for this class. All code written in this class is assumed to follow this coding style. 1 Indentation Indentations should
More informationC++ Style Guide. 1.0 General. 2.0 Visual Layout. 3.0 Indentation and Whitespace
C++ Style Guide 1.0 General The purpose of the style guide is not to restrict your programming, but rather to establish a consistent format for your programs. This will help you debug and maintain your
More informationCONTENTS: While loops Class (static) variables and constants Top Down Programming For loops Nested Loops
COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables
More informationSML Style Guide. Last Revised: 31st August 2011
SML Style Guide Last Revised: 31st August 2011 It is an old observation that the best writers sometimes disregard the rules of rhetoric. When they do so, however, the reader will usually find in the sentence
More informationC Coding Style Guide Version 0.4
Technotes, HowTo Series C Coding Style Guide Version 0.4 by Mike Krüger, mike@icsharpcode.net Contents 1 About the C Coding Style Guide 1 2 File Organization.. 1 3 Indentation 2 4 Comments. 3 5 Declarations.
More informationBest Practices in Programming
Best Practices in Programming from B. Kernighan & R. Pike, The Practice of Programming Giovanni Agosta Piattaforme Software per la Rete Modulo 2 Outline 1 2 Macros and Comments 3 Algorithms and Data Structures
More informationSome Patterns for CS1 Students
Some Patterns for CS1 Students Berna L. Massingill Abstract Students in beginning programming courses struggle with many aspects of programming. This paper outlines some patterns intended to be useful
More informationProgramming Style. Quick Look. Features of an Effective Style. Naming Conventions
Programming Style Quick Look An effective programming style helps you write code that is easier to understand, debug, maintain, and port from system to system. This article discusses the general features
More informationCS 370 The Pseudocode Programming Process D R. M I C H A E L J. R E A L E F A L L
CS 370 The Pseudocode Programming Process D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Introduction At this point, you are ready to beginning programming at a lower level How do you actually write your
More informationQUIZ. What are 3 differences between C and C++ const variables?
QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,
More informationThe compiler is spewing error messages.
Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are
More informationIntro. Scheme Basics. scm> 5 5. scm>
Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if
More informationprintf( Please enter another number: ); scanf( %d, &num2);
CIT 593 Intro to Computer Systems Lecture #13 (11/1/12) Now that we've looked at how an assembly language program runs on a computer, we're ready to move up a level and start working with more powerful
More informationCIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts)
CIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts) Problem 0: Install Eclipse + CDT (or, as an alternative, Netbeans). Follow the instructions on my web site.
More informationCS112 Lecture: Making Choices
CS112 Lecture: Making Choices Objectives: Last revised 1/19/06 1. To review the Java if and if... statements 2. To introduce relational expressions and boolean operators 3. To discuss nested if statements
More informationQUIZ. What is wrong with this code that uses default arguments?
QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code
More informationThe Design Process. General Development Issues. C/C++ and OO Rules of Thumb. Home
A l l e n I. H o l u b & A s s o c i a t e s Home C/C++ and OO Rules of Thumb The following list is essentially the table of contents for my book Enough Rope to Shoot Yourself in the Foot (McGraw-Hill,
More informationDocumentation Nick Parlante, 1996.Free for non-commerical use.
Documentation Nick Parlante, 1996.Free for non-commerical use. A program expresses an algorithm to the computer. A program is clear or "readable" if it also does a good job of communicating the algorithm
More informationRepetition Through Recursion
Fundamentals of Computer Science I (CS151.02 2007S) Repetition Through Recursion Summary: In many algorithms, you want to do things again and again and again. For example, you might want to do something
More informationCOMP-202 Unit 4: Programming with Iterations
COMP-202 Unit 4: Programming with Iterations Doing the same thing again and again and again and again and again and again and again and again and again... CONTENTS: While loops Class (static) variables
More informationThe design recipe. Readings: HtDP, sections 1-5. (ordering of topics is different in lectures, different examples will be used)
The design recipe Readings: HtDP, sections 1-5 (ordering of topics is different in lectures, different examples will be used) Survival and Style Guides CS 135 Winter 2018 02: The design recipe 1 Programs
More informationClient Code - the code that uses the classes under discussion. Coupling - code in one module depends on code in another module
Basic Class Design Goal of OOP: Reduce complexity of software development by keeping details, and especially changes to details, from spreading throughout the entire program. Actually, the same goal as
More informationIntroduction to Programming Style
Introduction to Programming Style Thaddeus Aid The IT Learning Programme The University of Oxford, UK 30 July, 2013 Abstract Programming style is the part of the program that the human reads and the compiler
More informationRacket Style Guide Fall 2017
CS17 Integrated Introduction to Computer Science Hughes Racket Style Guide Fall 2017 Contents 1 Introduction 1 2 Naming 1 3 Formatting 1 4 Equality 3 5 Conditionals 4 5.1 Prefer Cond to If......................................
More informationIntroduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.
Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and
More informationList of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar
List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:
More informationC++ Programming Style Guide
C++ Programming Style Guide Computer Science Program Cedarville University Goal: Our goal is to produce well-written code that can be easily understood and will facilitate life-cycle maintenance. These
More informationErrors. Lecture 6. Hartmut Kaiser hkaiser/fall_2011/csc1254.html
Hartmut Kaiser hkaiser@cct.lsu.edu http://www.cct.lsu.edu/ hkaiser/fall_2011/csc1254.html 2 Abstract When we program, we have to deal with errors. Our most basic aim is correctness, but we must deal with
More informationVARIABLES. Aim Understanding how computer programs store values, and how they are accessed and used in computer programs.
Lesson 2 VARIABLES Aim Understanding how computer programs store values, and how they are accessed and used in computer programs. WHAT ARE VARIABLES? When you input data (i.e. information) into a computer
More informationRACKET BASICS, ORDER OF EVALUATION, RECURSION 1
RACKET BASICS, ORDER OF EVALUATION, RECURSION 1 COMPUTER SCIENCE 61AS 1. What is functional programming? Give an example of a function below: Functional Programming In functional programming, you do not
More informationControl Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003
Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an
More informationL o o p s. for(initializing expression; control expression; step expression) { one or more statements }
L o o p s Objective #1: Explain the importance of loops in programs. In order to write a non trivial computer program, you almost always need to use one or more loops. Loops allow your program to repeat
More informationTesting. UW CSE 160 Winter 2016
Testing UW CSE 160 Winter 2016 1 Testing Programming to analyze data is powerful It s useless (or worse!) if the results are not correct Correctness is far more important than speed 2 Famous examples Ariane
More informationAdministration. Conditional Statements. Agenda. Syntax. Flow of control. Lab 2 due now on floppy Lab 3 due tomorrow via FTP
Administration Conditional Statements CS 99 Summer 2000 Michael Clarkson Lecture 4 Lab 2 due now on floppy Lab 3 due tomorrow via FTP need Instruct account password Lab 4 posted this afternoon Prelim 1
More informationRepe$$on CSC 121 Spring 2017 Howard Rosenthal
Repe$$on CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Learn the following three repetition structures in Java, their syntax, their similarities and differences, and how to avoid common errors when
More informationJava Programming Style Guide
Java Programming Style Guide Computer Science Program Cedarville University Goal: Our goal is to produce well-written code that can be easily understood and will facilitate life-cycle maintenance. These
More informationControl Structures in Java if-else and switch
Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2017 January 23, 2017 Lecture 4CGS 3416 Spring 2017 Selection January 23, 2017 1 / 26 Control Flow Control flow refers to the specification
More informationDecision Making in C
Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed
More information17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended w
List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:
More informationRepetition CSC 121 Fall 2014 Howard Rosenthal
Repetition CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while
More informationCreating Word Outlines from Compendium on a Mac
Creating Word Outlines from Compendium on a Mac Using the Compendium Outline Template and Macro for Microsoft Word for Mac: Background and Tutorial Jeff Conklin & KC Burgess Yakemovic, CogNexus Institute
More informationJava Style Guide. 1.0 General. 2.0 Visual Layout. Dr Caffeine
September 25, 2002 Java Style Guide Dr Caffeine This document defines the style convention the students must follow in submitting their programs. This document is a modified version of the document originally
More informationC++ for Everyone, 2e, Cay Horstmann, Copyright 2012 John Wiley and Sons, Inc. All rights reserved. Using a Debugger WE5.
Using a Debugger WE5 W o r k E D E x a m p l e 5.2 Using a Debugger As you have undoubtedly realized by now, computer programs rarely run perfectly the first time. At times, it can be quite frustrating
More informationClasses, interfaces, & documentation. Review of basic building blocks
Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform
More informationCPE 112 Spring 2015 Exam II (100 pts) March 4, Definition Matching (8 Points)
Name Definition Matching (8 Points) 1. (8 pts) Match the words with their definitions. Choose the best definition for each word. Relational Expression Iteration Counter Count-controlled loop Loop Flow
More informationRepe$$on CSC 121 Fall 2015 Howard Rosenthal
Repe$$on CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while
More informationProgramming. We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems.
Plan for the rest of the semester: Programming We will be introducing various new elements of Python and using them to solve increasingly interesting and complex problems. We saw earlier that computers
More informationLecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan
Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful
More informationQUIZ. Source:
QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Ch. 4: Data Abstraction The only way to get massive increases in productivity is to leverage off other people s code. That
More informationWriter 5.4 Guide. Chapter 12 Lists: Tips and Tricks
Writer 5.4 Guide Chapter 12 Lists: Tips and Tricks Copyright This document is Copyright 2017 by the LibreOffice Documentation Team. Contributors are listed below. You may distribute it and/or modify it
More informationChapter 5 Errors. Bjarne Stroustrup
Chapter 5 Errors Bjarne Stroustrup www.stroustrup.com/programming Abstract When we program, we have to deal with errors. Our most basic aim is correctness, but we must deal with incomplete problem specifications,
More informationCS450 - Structure of Higher Level Languages
Spring 2018 Streams February 24, 2018 Introduction Streams are abstract sequences. They are potentially infinite we will see that their most interesting and powerful uses come in handling infinite sequences.
More informationChapter 5 Errors. Hyunyoung Lee. Based on slides by Bjarne Stroustrup.
Chapter 5 Errors Hyunyoung Lee Based on slides by Bjarne Stroustrup www.stroustrup.com/programming 1 Abstract When we program, we have to deal with errors. Our most basic aim is correctness, but we must
More informationProgramming Basics and Practice GEDB029 Decision Making, Branching and Looping. Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029
Programming Basics and Practice GEDB029 Decision Making, Branching and Looping Prof. Dr. Mannan Saeed Muhammad bit.ly/gedb029 Decision Making and Branching C language possesses such decision-making capabilities
More informationWrite for your audience
Comments Write for your audience Program documentation is for programmers, not end users There are two groups of programmers, and they need different kinds of documentation Some programmers need to use
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More informationUNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING
UNIVERSITY OF CALIFORNIA, SANTA CRUZ BOARD OF STUDIES IN COMPUTER ENGINEERING CMPE13/L: INTRODUCTION TO PROGRAMMING IN C SPRING 2012 Lab 3 Matrix Math Introduction Reading In this lab you will write a
More informationThe name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.
Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that
More informationCS106X Handout 03 Autumn 2012 September 24 th, 2012 Getting Started
CS106X Handout 03 Autumn 2012 September 24 th, 2012 Getting Started Handout written by Julie Zelenski, Mehran Sahami, Robert Plummer, and Jerry Cain. After today s lecture, you should run home and read
More informationCSCI0330 Intro Computer Systems Doeppner. Lab 02 - Tools Lab. Due: Sunday, September 23, 2018 at 6:00 PM. 1 Introduction 0.
CSCI0330 Intro Computer Systems Doeppner Lab 02 - Tools Lab Due: Sunday, September 23, 2018 at 6:00 PM 1 Introduction 0 2 Assignment 0 3 gdb 1 3.1 Setting a Breakpoint 2 3.2 Setting a Watchpoint on Local
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationDecision Management Community
Decision Management Community Challenge Jan-2016 INTRO I was happy to see a large number of submissions to the challenge. Just to make things clear, I did not start the challenge and I did not pick the
More informationWhile Loops CHAPTER 5: LOOP STRUCTURES. While Loops. While Loops 2/7/2013
While Loops A loop performs an iteration or repetition A while loop is the simplest form of a loop Occurs when a condition is true CHAPTER 5: LOOP STRUCTURES Introduction to Computer Science Using Ruby
More informationThe first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.
Graphing in Excel featuring Excel 2007 1 A spreadsheet can be a powerful tool for analyzing and graphing data, but it works completely differently from the graphing calculator that you re used to. If you
More informationCS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist
CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist In Handout 28, the Guide to Inductive Proofs, we outlined a number of specifc issues and concepts to be mindful about when
More informationLecture 5. Review from last week. Selection Statements. cin and cout directives escape sequences
Lecture 5 Selection Statements Review from last week cin and cout directives escape sequences member functions formatting flags manipulators cout.width(20); cout.setf(ios::fixed); setwidth(20); 1 What
More informationOutline. Data Definitions and Templates Syntax and Semantics Defensive Programming
Outline Data Definitions and Templates Syntax and Semantics Defensive Programming 1 Data Definitions Question 1: Are both of the following data definitions ok? ; A w-grade is either ; - num ; - posn ;
More informationCS106A, Stanford Handout #30. Coding Style
CS106A, Stanford Handout #30 Fall, 2004-05 Nick Parlante Coding Style When writing paper, you can have well-crafted, correctly spelled sentences and create "A" work. Or you can hack out the text in a hurry.
More informationUser Interface Programming OOP/Java Primer. Step 3 - documentation
User Interface Programming OOP/Java Primer Step 3 - documentation Department of Information Technology Uppsala University What is the documentation? Documentation about program in the program Clearly written
More informationProofwriting Checklist
CS103 Winter 2019 Proofwriting Checklist Cynthia Lee Keith Schwarz Over the years, we ve found many common proofwriting errors that can easily be spotted once you know how to look for them. In this handout,
More informationTESTING AND DEBUGGING
TESTING AND DEBUGGING zombie[1] zombie[3] Buuuuugs zombie[4] zombie[2] zombie[5] zombie[0] Fundamentals of Computer Science I Outline Debugging Types of Errors Syntax Errors Semantic Errors Logic Errors
More informationLecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationPPP Style Guide Stroustrup 1/29/2010. PPP Style Guide. Bjarne Stroustrup
PPP Style Guide Bjarne Stroustrup Introduction All major real-world software projects have a house style ( coding guide-lines, project standard or whatever they are called) to ensure clarity and consistency.
More informationLESSON 3. In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script.
LESSON 3 Flow Control In this lesson you will learn about the conditional and looping constructs that allow you to control the flow of a PHP script. In this chapter we ll look at two types of flow control:
More informationReliable programming
Reliable programming How to write programs that work Think about reliability during design and implementation Test systematically When things break, fix them correctly Make sure everything stays fixed
More informationWarm-Up: COMP Programming with Iterations 1
Warm-Up: Suppose I have a method with header: public static boolean foo(boolean a,int b) { if (a) return true; return b > 0; Which of the following are valid ways to call the method and what is the result?
More informationCreating Universally Designed Word 2013 Documents - Quick Start Guide
Creating Universally Designed Word 2013 Documents - Quick Start Guide Overview Creating accessible documents ones that work well with all sorts of technology can be a daunting task. The purpose of this
More informationSequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;
Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The
More informationConstruction: High quality code for programming in the large
Construction: High quality code for programming in the large Paul Jackson School of Informatics University of Edinburgh What is high quality code? High quality code does what it is supposed to do......
More informationSelec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal
Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Spring 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program
More informationEXAMINING THE CODE. 1. Examining the Design and Code 2. Formal Review: 3. Coding Standards and Guidelines: 4. Generic Code Review Checklist:
EXAMINING THE CODE CONTENTS I. Static White Box Testing II. 1. Examining the Design and Code 2. Formal Review: 3. Coding Standards and Guidelines: 4. Generic Code Review Checklist: Dynamic White Box Testing
More informationMaintainability and Readability. What makes code readable? Understandable code. General Routine Structure. General Module Structure
Maintainability and Readability elements of maintainability program readability module structure commenting coding standards code ownership 11/23/2012 Maintainability, Readability, Style & Standards 2
More informationIntroduction to Java Applications
2 Introduction to Java Applications OBJECTIVES In this chapter you will learn: To write simple Java applications. To use input and output statements. Java s primitive types. Basic memory concepts. To use
More informationCT 229 Java Syntax Continued
CT 229 Java Syntax Continued 29/09/2006 CT229 Lab Assignments One Week Extension for Lab Assignment 1. Due Date: Oct 8 th Before submission make sure that the name of each.java file matches the name given
More informationVISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0
VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 L J Howell UX Software 2009 Ver. 1.0 TABLE OF CONTENTS INTRODUCTION...ii What is this book about?... iii How to use this book... iii
More informationC Programming Style for CS 111: Programming Methodology
Autumn 2003 Shensheng Zhang C Programming Style for CS 111: Programming Methodology From material by Robert Plummer, Julie Zelenski, and Harry Lai As we will stress all the time, a working program is only
More informationDECISION STRUCTURES: USING IF STATEMENTS IN JAVA
DECISION STRUCTURES: USING IF STATEMENTS IN JAVA S o far all the programs we have created run straight through from start to finish, without making any decisions along the way. Many times, however, you
More informationText Input and Conditionals
Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()
More informationConditionals, Loops, and Style
Conditionals, Loops, and Style yes x > y? no max = x; max = y; http://xkcd.com/292/ Fundamentals of Computer Science Keith Vertanen Copyright 2013 Control flow thus far public class ArgsExample public
More informationDifference Between Dates Case Study 2002 M. J. Clancy and M. C. Linn
Difference Between Dates Case Study 2002 M. J. Clancy and M. C. Linn Problem Write and test a Scheme program to compute how many days are spanned by two given days. The program will include a procedure
More informationDeveloping Good Style
CS106 Handout #12 J Zelenski Jan 16, 2008 Developing Good Style As we will stress all quarter, a working program is only half the challenge constructing an elegant and well-engineered solution is your
More informationTechnical Writing. Professional Communications
Technical Writing Professional Communications Overview Plan the document Write a draft Have someone review the draft Improve the document based on the review Plan, conduct, and evaluate a usability test
More informationLecture 4 CSE July 1992
Lecture 4 CSE 110 6 July 1992 1 More Operators C has many operators. Some of them, like +, are binary, which means that they require two operands, as in 4 + 5. Others are unary, which means they require
More informationRepetition, Looping. While Loop
Repetition, Looping Last time we looked at how to use if-then statements to control the flow of a program. In this section we will look at different ways to repeat blocks of statements. Such repetitions
More informationCISC-124. Casting. // this would fail because we can t assign a double value to an int // variable
CISC-124 20180122 Today we looked at casting, conditionals and loops. Casting Casting is a simple method for converting one type of number to another, when the original type cannot be simply assigned to
More informationConditionals & Loops /
Conditionals & Loops 02-201 / 02-601 Conditionals If Statement if statements let you execute statements conditionally. true "then" part condition a > b false "else" part func max(a int, b int) int { var
More informationCS 115 Lecture. Boolean logic Taken from notes by Dr. Neil Moore
CS 115 Lecture Boolean logic Taken from notes by Dr. Neil Moore Boolean logic and logical operators There are three logical operators that let us combine Boolean expressions. They have lower precedence
More informationFirst-Order Translation Checklist
CS103 Winter 2019 First-Order Translation Checklist Cynthia Lee Keith Schwarz In this handout, we ve distilled five specific points that you should check in your first-order logic statements before submitting
More informationJava/RealJ Troubleshooting Guide
Java/RealJ Troubleshooting Guide by Bob Clark / Sharon Curtis / Simon Jones, September 2000 Some of these tips you will come across during your practical sessions, however we felt it would be helpful to
More information