Documenting a function. Documenting a function definition We have a template for information that we need you to put at the top of each function - if.

Slides:



Advertisements
Similar presentations
MEG 361 CAD Chapter 3 Basic Concepts of Graphics Programming.
Advertisements

Graphics Shapes. Setup for using graphics You have to import the graphics library You can use either “import graphics” or “from graphics import *” or.
BGI graphics library And Visual Studio.
Python Programming, 2/e1 CS177: Programming in Multimedia Objects Recitation Topic: Graphics Library.
Image Maps and Graphics Internet Basics and Far Beyond! Mrs. Wilson.
Chapter 7 Introduction to High-Level Language Programming.
© The McGraw-Hill Companies, 2006 Chapter 9 Software quality.
T T Population Sampling Distribution Purpose Allows the analyst to determine the mean and standard deviation of a sampling distribution.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Java Applets What is an Applet? How do you create.
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Four: Defining Your Own Classes *Instantiable.
CS 201 Functions Debzani Deb.
T T07-01 Sample Size Effect – Normal Distribution Purpose Allows the analyst to analyze the effect that sample size has on a sampling distribution.
1 Python Programming: An Introduction to Computer Science Chapter 3 Objects and Graphics.
Chapter 10 Classes Continued
Computer Science 111 Fundamentals of Programming I Introduction to Programmer-Defined Classes.
Epydoc API Documentation Extraction in Python Edward Loper.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
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.
WEB DESIGN USING DREAMWEAVER. The World Wide Web –A Web site is a group of related files organized around a common topic –A Web page is a single file.
1 Phase Testing. \ 2 Overview of Implementation phase Create Class Skeletons Define Implementation Plan (+ determine subphases) Define Coding Standards.
Computer Science 111 Fundamentals of Programming I Basic Program Elements.
Python Libraries Importing and Calling functions.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
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.
Object Oriented Programming … and other things you need to program in java.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 2 Graphics Programming with C++ and the Dark GDK Library Starting.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
JavaScript - A Web Script Language Fred Durao
Static Methods. 2 Objectives Look at how to build static (class) methods Study use of methods calling, parameters, returning values Contrast reference.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
Designing Programs and the Role of Functions Objectives Solve a few simple programs, emphasizing the steps involved in the process. Introduce the concept.
Some Graphics CS303E: Elements of Computers and Programming.
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Conics Conics Review. Graph It! Write the Equation?
Chapter 3 : Top Down Design with Functions By Suraya Alias.
Side effects A side effect is anything that happens in a method other than computing and/or returning a value. Example: public class hello { public int.
Printing in Python. Printing Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external.
Interaction with Graphics Also displaying GIFs. Text Output on the graphics window There is a class called Text which will put the message on the graphics.
The Circle. Examples (1) – (5) Determine the center and radius of the circle having the given equation. Identify four points of the circle.
Documentation Javadocs. Design/Documentation An essential ingredient of good Object Oriented programming is known as design by contract. This means that.
Libraries and APIs Don’t reinvent the wheel. What’s an API? API – Application Programmers Interface –We want to use code someone else has written –API’s.
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.
- draw a diameter - make a radius - join diameter and radius -join other end of diameter and radius - put in any angle for one of the angles formed - fill.
CS 115 Lecture 7 Graphics – coordinate systems, Text, Entry, aliases Taken from notes by Dr. Neil Moore.
Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.
VG101 RECITATION 5 By TAs. CONTENTS How to read Vg101Class.h Samples about graphics About assignment 5 Array.
CS 115 Lecture 6 Graphics Taken from notes by Dr. Neil Moore.
SUMMARY OF CHAPTER 2: JAVA FUNDAMENTS STARTING OUT WITH JAVA: OBJECTS Parts of a Java Program.
CS 115 Lecture 5 Math library; building a project Taken from notes by Dr. Neil Moore.
Review: A Structural View program modules -> main program -> functions -> libraries statements -> simple statements -> compound statements expressions.
Written by: Itzik Ben Shabat Technion - Israel Institute of Technology Faculty of Mechanical Engineering Laboratory for CAD & Lifecycle Engineering Lab.
ENGINEERING 1D04 Tutorial 4. What are we doing today? Focus Functions Scope of Variables Returning Values Objects Graphics library Aliasing Events Mouse.
Topic: Functions – Part 2
Graphics Part I Taken from notes by Dr. Neil Moore
Graphics Part I Taken from notes by Dr. Neil Moore
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Functions Taken from notes by Dr. Neil Moore
Functions, Procedures, and Abstraction
CS 115 Lecture Graphics II – coordinate systems, Text, Entry, aliases
Intro to Programming Lecture 3
Graphics Part I Taken from notes by Dr. Neil Moore
Rocky K. C. Chang 15 November 2018 (Based on Dierbach)
Interfaces, Classes & Objects
Which best describes the relationship between classes and objects?
Functions Taken from notes by Dr. Neil Moore & Dr. Debby Keen
CMPT 120 Lecture 19 – Unit 3 – Graphics and Animation
Using Modules.
Presentation transcript:

Documenting a function

Documenting a function definition We have a template for information that we need you to put at the top of each function - if you do this as part of your design, you will be ready when you write the implementation The name of the function The purpose of the function The preconditions = the parameters – their meaning, not just their number! The postconditions = the return value and/or output The design

Example: ‘’’ function draw_circle purpose: draws the circle specified on the graphics window, using the Zelle graphics library preconditions: x and y of center of circle, radius of circle, color of line to draw with, and graphwin object to display circle on postconditions: nothing returned, circle as specified drawn on given window Design 1.Create circle object with point and radius provided 2.Set the color of the circle to given color 3.Draw the circle ‘’’

A docstring Some people and software companies have a standard requirement of putting all this information in a triply-quoted string at the very top of the function. It’s called a “docstring” in that case Some software that professionals use can actually pull out those comments to produce documentation for their company In this class it’s up to you whether you use the ‘’’ or the # to make these comments Of course, you put your implementation between the lines of design comments, as usual, when writing the Python code