CSE1301 Computer Programming: Lecture 13 Documentation.

Slides:



Advertisements
Similar presentations
Variables in C Amir Haider Lecturer.
Advertisements

CSE 105 Structured Programming Language (C)
P5, M1, D1.
Internal Documentation Conventions. Kinds of comments javadoc (“doc”) comments describe the user interface: –What the classes, interfaces, fields and.
Programming Logic and Design Fourth Edition, Introductory
Documentation 1 Comprehending the present – Investing in the future.
Programming Logic and Design Fourth Edition, Introductory
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
1 Introduction to Software Engineering Lecture 42 – Communication Skills.
Introduction to Computers and Programming Class 6 Introduction to C Professor Avi Rosenfeld.
Modules, Hierarchy Charts, and Documentation
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
Chapter 1 Program Design
1 CSE1301 Computer Programming: Lecture 25 Software Engineering 2.
20 February Detailed Design Implementation. Software Engineering Elaborated Steps Concept Requirements Architecture Design Implementation Unit test Integration.
Algorithm Programming Coding Advices Bar-Ilan University תשס " ו by Moshe Fresko.
Chapter 3 Planning Your Solution
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
System Implementation
1 L07SoftwareDevelopmentMethod.pptCMSC 104, Version 8/06 Software Development Method Topics l Software Development Life Cycle Reading l Section 1.4 – 1.5.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Bret Juliano. Introduction What Documentation is Required? – To use a program – To believe a program – To modify a program The Flow-Chart Curse Self-Documenting.
Simple Program Design Third Edition A Step-by-Step Approach
المحاضرة الثالثة. Software Requirements Topics covered Functional and non-functional requirements User requirements System requirements Interface specification.
CS 360 Lecture 3.  The software process is a structured set of activities required to develop a software system.  Fundamental Assumption:  Good software.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Software Requirements Engineering CSE 305 Lecture-2.
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
BTEC Unit 06 – Lesson 08 Principals of Software Design Mr C Johnston ICT Teacher
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
SE: CHAPTER 7 Writing The Program
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Programming Principles Chapter 1. Objectives Discuss the program design process. Introduce the Game of Life. Discuss object oriented design. – Information.
Introduction to programming in the Java programming language.
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
6/3/2016 CSI Chapter 02 1 Introduction of Flow of Control There are times when you need to vary the way your program executes based on given input.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
The Software Development Process
The Other Face Or Why Document? By Chris Bradney Or Why Document? By Chris Bradney.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Intermediate 2 Computing Unit 2 - Software Development.
CS 11 C track: lecture 2 Last week: basics of C programming compilation data types ( int, float, double, char, etc.) operators ( + - * / = == += etc.)
9/29/99B-1 CSE / ENGR 142 Programming I Variables, Values, and Types © 1998 UW CSE.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Chapter 3 AS3 Programming. Introduction Algorithms + data structure =programs Why this formula relevant to application programs created in flash? The.
Software Development Process CS 360 Lecture 3. Software Process The software process is a structured set of activities required to develop a software.
ATS Programming Short Course I INTRODUCTORY CONCEPTS Tuesday, Feb 10th, 2009 Introduction to Programming.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
 System Requirement Specification and System Planning.
Chapter 2: Input, Processing, and Output
System Design.
Revision Lecture
ICS103 Programming in C Lecture 3: Introduction to C (2)
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Designing and Debugging Batch and Interactive COBOL Programs
Structured Program
Documentation for Developers
Chapter 2: Input, Processing, and Output
Variables in C Topics Naming Variables Declaring Variables
CSCE-221 C++ Coding Standard/Guidelines
Presentation transcript:

CSE1301 Computer Programming: Lecture 13 Documentation

Topics System documentation –Internal Documentation (in-line comments) –Program Documentation (external) User documentation Reading: The Style, Chapter 1, 2, 4 and 7. Brookshear 6.5 (4/e and 5/e), 6.6 (6/e).

Documentation Is usually neglected or poorly done It is vital to the usability of software It is the difference between a program and a marketable product Documentation may occupy up to 30% or more of the development time

Why is documentation needed? Software is no use unless people can use and maintain it. Two purposes: –explain software features, describe how to use them: user documentation. –describe software so system can be maintained later in life cycle: system documentation (including internal documentation).

System documentation Historically: final source pograms + sketchy explanations written after software was developed. This is no longer acceptable. Begins with original system specifications, continues through the software's life cycle. The development of system documentation is an on-going process: –must be updated as specs or design changes. –made easier by CASE tools.

Internal documentation General Philosophy Write comments where they will provide additional and necessary information for people reading your code. Note - if you had trouble writing the code, someone else will have trouble reading it!

Strategic comments Describe how a function or type behaves Explain the interface of a program Typically appear in a block

Tactical comments Describe the use of a variable or a complicated section of code Explain implementation details Typically appear on a single line

Non-Trivial Comments: Bad example Restating what code says doesn't help reader. int age = 7; /* declare age variable */ char name[20]; /* declare string var for name */ /* * Read in a name and age and then check if its * end of input or if age is 7 and if neither * is the case then print out the name and age */ while ((scanf("%s %d", name, &age)!=EOF) && (age != 7)) { printf("%s %d\n", name, age); }

Non-Trivial Comments: Good Example int age = 7; char name[MAXNAMELEN+1]; /* * Read in and print out name and age pairs, * until a 7 year old is found. */ while ((scanf("%s %d", name, &age) != EOF) && (age != 7)) { printf("%s %d\n", name, age); }

Comment Blocks When describing a block of code, use a comment block which is easily distinguishable from the code around it.

Comment Blocks: Bad Example /* This is a multi-line comment. It describes the function which follows it. */ int myfunc() {... }

Comment Blocks: Good Example /* * This is a multi-line comment. It describes the * function which follows it. * Note the layout of the *'s and the beginning * and end of the comment. */ int myfunc() {... }

Comment Blocks: Good Example 2 /* ** This is a multi-line comment. It describes the ** function which follows it. ** Note the layout of the *'s and the beginning ** and end of the comment. */ int myfunc() {... }

Use of language Use plain English and full sentences in the text of a block comment.

Use of language: Bad example /* * this is a multi-line comment, obviously * spans number of lines * not conventional sentence form where * does one * sentence end and another start */

Use of language: Good example /* * This is a multi-line comment which obviously * spans a number of lines. It is in conventional * sentence form. */

Single Line Comments Short single lines of code may be given a comment that starts and ends on that same line.

Single Line Comments: Bad Example (over -commented) /* * The next line declares a variable which holds * the number of failures in the course */ int failures; int students; /* How many students enrolled */ /* Array of course code strings */ char ** courseCodes;

Single Line Comments: Good Example int failures; /* Number of failures */ int students; /* Number of students */ char** coursecodes; /* Array of course codes */ Note the alignment.

Comment Maintenance Ensure that comments and code are maintained together Example const int numSides = 3; /* a triangle */ Later becomes: const int numSides = 4; /* a triangle */

Use of abbreviations Do not use abbreviations in comments unless they are clearly defined for the project. Bad Example /* Calc dist b/w pts */ dist = sqrt(sqr(ax - bx) + sqr(ay - by)); Good Example /* Calculate the distance between points a and b. */ dist = sqrt(sqr(ax - bx) + sqr(ay - by));

Headings for different modules If comments are to be divided into sections, each section of field heading must be in upper-case.

Headings for different modules: Bad Example /* * * Name: findMin * Description: * * This code will minimise a user * specified function * */

Headings for different modules: Good Example /* * * NAME: * findMin * * DESCRIPTION: * This code will minimise a user * specified function. * */

Coding Standards (See “The Style”) Layout of code Consistent indenting (use of tabs) Visual separation Bracing style and block indentation Meaningful (standard) names Abbreviations

Other Internal Documentation Legal notices Revision history

User documentation Explains how to use the program Assumes nothing about user Explains how to "drive" it States what assumptions are made Specifies likely error conditions and known bugs Estimates space/time efficiency Outlines theoretical background

User documentation example See StudentMarksUserDoc (Document 1) in lecture notes

Program documentation Describes the specifications by which the system was verified Explains how to maintain and/or modify the program Assumes some understanding on the part of the reader Describes the purpose of all non-trivial variables and data structures

Program documentation (cont.) Gives an overview of the algorithm (including flow-diagrams, structure charts) States conventions/standards used Lists entire source code Gives example results Explains the purpose of each module/subroutine individually

Program documentation (cont.) Highlights non-standard language usage (portability constraints) Suggests possible improvements or extensions

Program documentation example See StudentMarksProgramDoc (Document 2) in lecture notes

Summary Documentation is important! You should –Include comments in your programs –Follow the "rules" for comments and general "style" External documentation includes: –Program documentation –User documentation