Documentation and Comments. What’s a comment? A comment is a simple form of documentation. Documentation is text that you the programmer write to explain.

Slides:



Advertisements
Similar presentations
Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
Advertisements

ENGLISH AS A SECOND LANGUAGE PRESCRIPTION SYSTEM.
CS0007: Introduction to Computer Programming Console Output, Variables, Literals, and Introduction to Type.
Introduction to C Programming
10 November JavaScript. Presentation Hints What do YOU think makes a good presentation Some of my suggestions Don’t write full sentences on slides Talk,
CODING Research Data Management. Research Data Management Coding When writing software or analytical code it is important that others and your future.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
Computer Science 101 Introduction to Programming.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Python Programming Fundamentals
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Functions Part I (Syntax). What is a function? A function is a set of statements which is split off into a separate entity that can be used like a “new.
Introduction to Algorithm Design and Documentation CSIS 1595: Fundamentals of Programming and Problem Solving 1.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
Computer Science 101 Introduction to Programming.
Web Programming Basics of HTML. HTML stands for Hyper Text Mark-up Language A mark-up language is different than those that you have learned before in.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
By the end of this session you should be able to...
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
Introduction to Programming with RAPTOR
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
HTML HTML: Hypertext Markup Language. The basic language of the World Wide Web. Developed around 1991 at the CERN lab on the French-Swiss border by Tim.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 1 Simple Python Programs Using Print, Variables, Input.
Algorithms  Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1. Understand the application of Pseudo Code for programming purposes 2. Be able to write algorithms in Pseudo Code.
Sahar Mosleh California State University San MarcosPage 1 JavaScript Basic.
Chapter 2 part #1 C++ Program Structure
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
12/14/2016CS150 Introduction to Computer Science 1 Announcements  Website is up!   All lecture slides, assignments,
C OMPUTER P ROGRAMMING 1 Input and Variables. I/O S TATEMENTS : I NPUT & V ARIABLES Input is the term used to describe the transfer of information from.
Getting Started with HTML. HTML  Hyper Text Markup Language  HTML isn’t a program language, its known as a markup language  A Markup language has tags.
Program Development Cycle 1.Edit program 2.Compile program - translates it from C to machine language 3. Run/execute your program. 4. If not satisfied,
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
COMPUTER PROGRAMMING Year 9 – Unit 9.04 Week 3. Open the Python INTERPRETER Can you use the interpreter to solve these maths problems? 156 add
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
GCSE Computing: Programming GCSE Programming Remembering Python.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Quiz 1 A sample quiz 1 is linked to the grading page on the course web site. Everything up to and including this Friday’s lecture except that conditionals.
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
A little PHP. Enter the simple HTML code seen below.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Vocabulary Quiz Today Take a few minutes to look over your vocab silently if you would like. If you owe me vocab homework, drop it in the in-bin. (This.
Development Environment
Topic: Python’s building blocks -> Variables, Values, and Types
A Playful Introduction to Programming by Jason R. Briggs
Introduction to Programming
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Think What will be the output?
Variables, Expressions, and IO
Intro to PHP & Variables
CS190/295 Programming in Python for Life Sciences: Lecture 1
Week 3 Computer Programming Learning Objective:
Number and String Operations
We are starting to program with JavaScript
Escape sequences: Practice using the escape sequences on the code below to see what happens. Try this next code to help you understand the last two sequences.
T. Jumana Abu Shmais – AOU - Riyadh
COMPUTER PROGRAMMING PYTHON
CS 115 A First Look at Python
Introduction to Programming
Class 2.
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
Introduction to Programming
Presentation transcript:

Documentation and Comments

What’s a comment? A comment is a simple form of documentation. Documentation is text that you the programmer write to explain to someone else what your program is doing User manuals Prompts to the user during execution Design of the logic of the program A test plan for the program Comments inside the code of the program

Why do comments? You write comments to other people not to a computer All languages ignore comments – they are stripped from the code before the translator even sees them Who reads your code? These people also read your comments! Other team members if you are working on code as a team The programmer who gets the job of maintaining your code after you have left the company Yourself, maybe a week later, trying to remember why you did things that way Your TA while grading your program A comment is a chance to explain WHY you did this thing or that, not to explain HOW. The code itself tells how it was done.

How to do comments In Python there are two ways First way is to use a # (hash mark, number sign, pound sign) Everything you type to the right of the # sign to the end of that line is ignored by the interpreter For longer comments, you can use ‘’’ (that is 3 single quotes together) Once you’ve typed in ‘’’ you can enter as much text as you like, lines and paragraphs and whole pages. Everything is ignored until you enter another ‘’’

Where to do comments The Header comment (see Programming Standard page) Name, Section number Purpose of program Date completed Preconditions (inputs to program) Postconditions (outputs from program) Goes at the top of the source code of program assignments, good practice to put in lab assignment programs

Where to do comments (continued) Not every line of code needs a comment Write comments as though you were talking to a student in our class, i.e. they know some Python A comment like ctr = 0 # set variable to 0 is not helpful! A reader can tell what the code does Better would be ctr = 0 # initialize counter for lines If a comment gets long, put it on the line above the statement it’s about, rather than have to scroll the window back and forth