Introduction to Programming Style
|
|
- Leslie Thomas
- 6 years ago
- Views:
Transcription
1 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 ignores, however that doesn t make it unimportant. Poorly written and confusing code can lead to errors and obfuscate bugs in the code. By implementing an easy to read and understand set of style standards at the beginning of your time learning how to program you can cut out many of the headaches that are normally associated with the programming learning curve. 1 Programming Style [Computer programs are] the most advanced things that humans make. - Douglas Crockford When I first started programming I was told to follow the K.I.S.S. (Keep It Simple Stupid) method and to write readable, understandable, and sharable code. I promptly disregarded that advice and produced a very clever program that didn t do anything and I couldn t figure out what I had done wrong. The first exercise I am going to recommend for style is to forget everything you know about style and write the cleverest code you can, using all the trickiest tricks you can think of and don t comment your code. Give it to a programming friend and see if they can understand it, then leave it for a week and see if you can still understand it. I hope that this will help to explain why good style is important, both so that anyone else that looks at your code can understand it, but also so that in the future you can understand it as well. Programming can be one of the most creative things that you can do, your imagination can allow to you do things that would have seemed impossible 50 years ago, but how you express that imagination is very important. Consider a novelist; a novelist creates imaginary worlds full of detail and adventure and then communicates that world of imagination to the reader. If the novelist cannot clearly communicate their ideas then that novelist isn t going to be 1
2 considered a good novelist. Novelists slavishly use the proper elements of style for the language they are using and the genre they are writing in as it make comprehension easier. Imagine if the next book you read has the period at the beginning of the sentence and replaced all commas with hash signs; that would make the book harder to understand. I feel it is the same for the programmer that uses non-standard notation. A programmer must be able to communicate their ideas clearly in their code. I feel that this clarity should be applied at all times; you never know when that code you have written quickly to solve a problem will be given to someone else to maintain. Think of it as a novelist s notebook being published after they have passed away. Your personal code should reflect what a good programmer you are, not that you were lazy and didn t want to take the time to complete your ideas. There is no one gold standard of programming style, just as there is no one way to write a good novel. Many methods have been used and different programming languages sometimes require different styles. So that is the first piece of advice I have: learn the conventions of your language. A quick Google search should provide multiple articles on the specifics of your language but I will cover some of the genetic considerations in this document. Second, don t get set in writing in just one style. When you work with different groups or different languages you will need to adapt your writing style to match the environment that you are working in, you don t want to try and match your working environment to your writing style. A novelist will use a slightly different writing style depending on what they are trying to convey and there is a stylistic difference between a romance and a thriller. Both can be written well but what works in one genre may not work in another; it is the same with programming. A novelist who writes jointly with a partner will make sure that the style used works for both of them so that the reader doesn t have to change mental space when shifting between authors. Coding style should be about avoiding errors and nothing else. At the end of the day how pretty your code looks doesn t matter to your compiler or interpreter; it will ignore all the work that you have put into your style, but that doesn t make style a waste of time. Style is what you put into your code to help you debug your code. That being said, I think that code that is well written and readable does have its own beauty and elegance. 2 White Space White space is your friend; it turns compact, inaccessible code into readable, maintainable code. A little extra time spent making the code look better can save you and your teammates time when looking for errors. Consider the following code: f u n c t i o n ( ) { i n t a ; i n t b ; a=5;b=6; return ( a+b ) ; 2
3 // p e r f e c t l y l e g a l code in some languages l i k e C While the previous code is functional and in this small sample you can understand it quickly, imagine having line after line of this compact confusing code in your program. It is much better to take that code and add some white space to make it more approachable. f u n c t i o n ( ) { i n t a ; i n t b ; a = 5 ; b = 6 ; r eturn ( a + b ) ; // much e a s i e r f o r people to read Adding indentation and empty lines allows for the program to be segmented into logical spaces which make it easy for the eye to look at different parts of the program. This can help to bring your attention to errors. My experience is that I spend more time debugging my code than writing it and all of the programmers I know do the same. So it makes sense to try and cut down as much time debugging as you can and if it costs a few extra keystrokes when you are writing your code you should think of that as an investment into saving on your total time spent debugging. 3 Curly Braces There have been many holy wars fought over where to put your curly braces in your code. I have never quite understood why it is such a major cause of discord in programming circles but it is and you should be prepared to work in several styles instead of wasting time trying to make everyone else conform to your preferred style of curly brace. The first style is: i f ( a==b ) { e l s e { d i f f e r e n t 3
4 This is the style I first learned when I started learning C, but when I started programming in Java I learned the second major style: i f ( a == b ) { e l s e { d i f f e r e n t It doesn t really matter which way you choose to implement your curly braces, just make sure that you are consistent in your usage through your program or it will get confusing and you may miss a bug and have to spend more time correcting the program. This is one of the areas that I feel you should be willing to change how you write your code to match your language or the group that you are programming with. I change which method I use depending on the language that I am using and the people that I am working with. I mildly prefer the second type, but not enough to make an issue over it. 4 Naming Identifiers You may have noticed that the variable names I have been using don t mean anything. You can t look at a and understand what I am using it for. This is confusing and should be avoided. It becomes obvious what the program is doing if you change your variable names such as: f u n c t i o n ( ) { i n t t e s t S c o r e 1 ; i n t t e s t S c o r e 2 ; t e s t S c o r e 1 = 5 ; t e s t S c o r e 2 = 6 ; r eturn t e s t S c o r e 1 + t e s t S c o r e 2 ; // i t i s obvious that I am summing a p a i r o f t e s t s c o r e s There are several trains of thought about naming variables. The name should be descriptive at the very least and you can add variable type and scope to the name as well to reduce confusion. Consider: i n t a ; i n t t e s t S c o r e ; i n t i n t t e s t S c o r e ; i n t g r a d e s i n t t e s t S c o r e ; 4
5 The longer names are more descriptive than the shorter names and will help to limit errors made while programming. Using an Integrated Development Environment (such as Eclipse) can really help in this regard; with IDEs you only need to type part of the name of your variable and then you can use the auto-complete feature to complete the name of your variable (or function). By tradition uppercase is limited in its use in programming. Words in all capitals are usually macros or constants and are replaced just before compilation by the compiler. In C it looks something like: #d e f i n e PI Variables use a lowercase first letter and can contain capitol letters to signify additional words as I have been using on my longer names. It is also possible to use an underscore to separate parts of the name of a variable: g r a d e s i n t A r r a y t e s t S c o r e s Class definitions in many languages have an initial capitol letter to differentiate them from the instantiated objects. Class TestScores (... ) {... // d e c l a r i n g a c l a s s TestScores t e s t S c o r e s ; // d e c l a r i n g an o b j e c t By limiting the use of capital letters you will know immediately what sort of identifier you are dealing with, from a macro to a Class to a variable or object. 5 Alignment Additional clarity can be achieved through the use of vertical alignment. It takes a bit more time but this allows you to simply look down a list to see if anything looks wrong. Compare: t e s t = 1 ; anothertest = 3 ; theclassaverage = 2 ; versus: t e s t = 1 ; anothertest = 3 ; theclassaverage = 2 ; 5
6 This style is very easy to break. If I copy and replace the name of theclassaverage to classmean then the alignment will be broken and would require fixing. So while this style can help to detect errors it can also add to your workload fixing the style itself. This style can also cause issues when different members of the team prefer different tab spacing. 6 Comments I want to end this introduction with a word on comments. You should use them as often as possible. If there is any chance that what you are doing isn t painfully obvious to someone else reading your code you should add a set of comments. I tend to use a self documenting style where I use identifiers that describe what the function is doing, but often this isn t enough to explain the details of the operation. Consider this program I wrote to harvest information from a data file: #!/ usr / bin / p e r l use s t r i c t ; use warnings ; open ( INFILE, <, chr2trees. txt ) or d i e cannot open < input. txt : $! ; open (OUTFILE, >, p o s i t i o n s. csv ) or d i e cannot open < output. txt : $! ; my $ l i n e ; while ( $ l i n e = <INFILE>){ = s p l i t (/ /, $ l i n e ) ; p r i n t OUTFILE $parts [ 0 ]. \n ; c l o s e ( INFILE ) ; c l o s e (OUTFILE ) ; p r i n t e n t e r a c h a r a c t e r to continue : ; my $junk = <STDIN>; For someone that understands Perl most of this program should make sense. Line by line read from the file chr2trees.txt and put the first word into positions.txt. However what is $junk and why is it there? This is a case where I failed to follow code styles and I have added a bit of confusion to the code. I had intended this just to be a pause at the end of the program so that I just have to hit enter and the program finishes. But coming back to it this can also 6
7 look like I wanted to do something else with the program. If I have just added a comment like: # pause program b e f o r e e x i t p r i n t e n t e r a c h a r a c t e r to continue : ; my $junk = <STDIN>; That would have removed the ambiguity from the program. 7 Conclusion I hope this introduction to programming style has helped to clarify some of the finer points of writing a good program and that you will continue to learn about programming style. I recommend you Google for a video called Programming Style and your Brain for an interesting look at why style matters. A good book to start with is a library copy of Code Complete by Steve McConnel. Good luck and I wish you a minimum of bugs. 8 Creative Commons licence This work is released under a Creative Commons licence: Attribution-NonCommercial- ShareAlike 2.0 UK: England Wales. 7
The 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 information10 Strategies for Effective Marketing Campaigns
10 Strategies for Effective Email Marketing Campaigns Most people do not send effective email messages. I know. I spend a lot of time analyzing email messages for our clients, and measuring and tracking
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 informationPerl Basics. Structure, Style, and Documentation
Perl Basics Structure, Style, and Documentation Copyright 2006 2009 Stewart Weiss Easy to read programs Your job as a programmer is to create programs that are: easy to read easy to understand, easy to
More informationCoding Style Handout #15 February 1, CS106A Winter
CS106A Winter 2011-2012 Handout #15 February 1, 2011 Coding Style Much of this handout was written by Nick Parlante and Eric Roberts, then edited for our own clandestine purposes. When writing a paper,
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 informationCSE 11 Style Guidelines
CSE 11 Style Guidelines These style guidelines are based off of Google s Java Style Guide and Oracle s Javadoc Guide. Overview: Your style will be graded on the following items: File Headers Class Headers
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 informationPromoting Component Architectures in a Dysfunctional Organization
Promoting Component Architectures in a Dysfunctional Organization by Raj Kesarapalli Product Manager Rational Software When I first began my career as a software developer, I didn't quite understand what
More informationVariables and. What Really Happens When You Run hello_world.py
2 Variables and Simple Data Types In this chapter you ll learn about the different kinds of data you can work with in your Python programs. You ll also learn how to use variables to represent data in your
More informationHow to approach a computational problem
How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to
More informationUsing Text in Photoshop
Using Text in Photoshop So, we re going to take a break for a while from talking about photographs and how to manipulate them, and instead focus on some design elements! We re going to spend a while talking
More information11 Coding Standards CERTIFICATION OBJECTIVES. Use Sun Java Coding Standards
11 Coding Standards CERTIFICATION OBJECTIVES Use Sun Java Coding Standards 2 Chapter 11: Coding Standards CERTIFICATION OBJECTIVE Use Sun Java Coding Standards Spacing Standards The Developer exam is challenging.
More informationProgramming in ROBOTC ROBOTC Rules
Programming in ROBOTC ROBOTC Rules In this lesson, you will learn the basic rules for writing ROBOTC programs. ROBOTC is a text-based programming language Commands to the robot are first written as text
More informationCode Convention and version control help us to success in Botball
Code Convention and version control help us to success in Botball Zebu Lan USTB Robot Society Team 1 Code Convention and version control help us to success in Botball 1 Introduction Clean and well-structured
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 informationRule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.
Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public
More informationFormatting: Cleaning Up Data
Formatting: Cleaning Up Data Hello and welcome to our lesson on cleaning up data, which is one of the final ones in this Formatting Module. What we re going to be doing in this lesson is using some of
More informationDetailed instructions for adding (or changing) your Avatar (profile picture next to your
Detailed instructions for adding (or changing) your Avatar (profile picture next to your name) on Ustream (disclaimer this is how it works for me using Internet Explorer it may look slightly different
More informationCS 1110, LAB 1: PYTHON EXPRESSIONS.
CS 1110, LAB 1: PYTHON EXPRESSIONS Name: Net-ID: There is an online version of these instructions at http://www.cs.cornell.edu/courses/cs1110/2012fa/labs/lab1 You may wish to use that version of the instructions.
More informationExcel Basics: Working with Spreadsheets
Excel Basics: Working with Spreadsheets E 890 / 1 Unravel the Mysteries of Cells, Rows, Ranges, Formulas and More Spreadsheets are all about numbers: they help us keep track of figures and make calculations.
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 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 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 informationthe NXT-G programming environment
2 the NXT-G programming environment This chapter takes a close look at the NXT-G programming environment and presents a few simple programs. The NXT-G programming environment is fairly complex, with lots
More informationSets. Sets. Examples. 5 2 {2, 3, 5} 2, 3 2 {2, 3, 5} 1 /2 {2, 3, 5}
Sets We won t spend much time on the material from this and the next two chapters, Functions and Inverse Functions. That s because these three chapters are mostly a review of some of the math that s a
More information3. Simple Types, Variables, and Constants
3. Simple Types, Variables, and Constants This section of the lectures will look at simple containers in which you can storing single values in the programming language C++. You might find it interesting
More informationHTML/CSS Lesson Plans
HTML/CSS Lesson Plans Course Outline 8 lessons x 1 hour Class size: 15-25 students Age: 10-12 years Requirements Computer for each student (or pair) and a classroom projector Pencil and paper Internet
More informationIf Statements, For Loops, Functions
Fundamentals of Programming If Statements, For Loops, Functions Table of Contents Hello World Types of Variables Integers and Floats String Boolean Relational Operators Lists Conditionals If and Else Statements
More informationRescuing Lost Files from CDs and DVDs
Rescuing Lost Files from CDs and DVDs R 200 / 1 Damaged CD? No Problem Let this Clever Software Recover Your Files! CDs and DVDs are among the most reliable types of computer disk to use for storing your
More information1.2 Adding Integers. Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line
1.2 Adding Integers Contents: Numbers on the Number Lines Adding Signed Numbers on the Number Line Finding Sums Mentally The Commutative Property Finding Sums using And Patterns and Rules of Adding Signed
More information6.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 informationTaskbar: Working with Several Windows at Once
Taskbar: Working with Several Windows at Once Your Best Friend at the Bottom of the Screen How to Make the Most of Your Taskbar The taskbar is the wide bar that stretches across the bottom of your screen,
More informationCREATING CONTENT WITH MICROSOFT POWERPOINT
CREATING CONTENT WITH MICROSOFT POWERPOINT Simple Tips And Tricks Presented by TABLE OF CONTENTS Introduction... 2 Design Tips... 3 Advanced Tips... 4 ShortCut Keys for Microsoft PowerPoint... 5 How-Tos...
More information9. MATHEMATICIANS ARE FOND OF COLLECTIONS
get the complete book: http://wwwonemathematicalcatorg/getfulltextfullbookhtm 9 MATHEMATICIANS ARE FOND OF COLLECTIONS collections Collections are extremely important in life: when we group together objects
More informationCS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style
CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming
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 informationLearning to Program with Haiku
Learning to Program with Haiku Lesson 4 Written by DarkWyrm All material 2010 DarkWyrm It would be incredibly hard to write anything useful if there weren't ways for our programs to make decisions or to
More informationCDs & DVDs: Different Types of Disk Explained
CDs & DVDs: Different Types of Disk Explained C 200 / 1 Don t Waste Money Buying the Wrong Type Find Out Which Disks Your PC Can Use! Your PC almost certainly has at least one CD/DVD drive. In its most
More informationYour . A setup guide. Last updated March 7, Kingsford Avenue, Glasgow G44 3EU
fuzzylime WE KNOW DESIGN WEB DESIGN AND CONTENT MANAGEMENT 19 Kingsford Avenue, Glasgow G44 3EU 0141 416 1040 hello@fuzzylime.co.uk www.fuzzylime.co.uk Your email A setup guide Last updated March 7, 2017
More information(Refer Slide Time 6:48)
Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about
More informationA practicalintroduction to embedded programming. Brian Plancher 10/17/2018
A practicalintroduction to embedded programming Brian Plancher Brian_Plancher@g.harvard.edu 10/17/2018 This week s task is simple: 1. Since the boards you made 2 weeks ago are perfect and are still in
More informationCS 351 Design of Large Programs Coding Standards
CS 351 Design of Large Programs Coding Standards Brooke Chenoweth University of New Mexico Spring 2018 CS-351 Coding Standards All projects and labs must follow the great and hallowed CS-351 coding standards.
More informationWeek - 01 Lecture - 04 Downloading and installing Python
Programming, Data Structures and Algorithms in Python Prof. Madhavan Mukund Department of Computer Science and Engineering Indian Institute of Technology, Madras Week - 01 Lecture - 04 Downloading and
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 informationCOPYRIGHTED MATERIAL. Dipping Your Toe into Python. Part I. Chapter 1: Programming Basics and Strings. Chapter 2: Numbers and Operators
Part I Dipping Your Toe into Python Chapter 1: Programming Basics and Strings Chapter 2: Numbers and Operators Chapter 3: Variables Names for Values COPYRIGHTED MATERIAL 1 Programming Basics and Strings
More informationSOEE1160: Computers and Programming in Geosciences Semester /08. Dr. Sebastian Rost
SOEE1160 L3-1 Structured Programming SOEE1160: Computers and Programming in Geosciences Semester 2 2007/08 Dr. Sebastian Rost In a sense one could see a computer program as a recipe (this is pretty much
More informationTypographic hierarchy: How to prioritize information
New York City College of Technology, CUNY Department of Communication Design Typographic Design III Instructor: Professor Childers pchilders1@mac.com Typographic hierarchy: How to prioritize information
More information2 Sets. 2.1 Notation. last edited January 26, 2016
2 Sets Sets show up in virtually every topic in mathematics, and so understanding their basics is a necessity for understanding advanced mathematics. As far as we re concerned, the word set means what
More information2. You are required to enter a password of up to 100 characters. The characters must be lower ASCII, printing characters.
BLACK BOX SOFTWARE TESTING SPRING 2005 DOMAIN TESTING LAB PROJECT -- GRADING NOTES For all of the cases below, do the traditional equivalence class and boundary analysis. Draw one table and use a new line
More informationChapter 1 Introduction
Chapter 1 Introduction Why I Am Writing This: Why I am I writing a set of tutorials on compilers and how to build them? Well, the idea goes back several years ago when Rapid-Q, one of the best free BASIC
More informationDocumentation Requirements Computer Science 2334 Spring 2016
Overview: Documentation Requirements Computer Science 2334 Spring 2016 These requirements are based on official Java coding conventions but have been adapted to be more appropriate to an academic environment.
More informationQUICK EXCEL TUTORIAL. The Very Basics
QUICK EXCEL TUTORIAL The Very Basics You Are Here. Titles & Column Headers Merging Cells Text Alignment When we work on spread sheets we often need to have a title and/or header clearly visible. Merge
More informationLecture 5 8/24/18. Writing larger programs. Comments. What are we going to cover today? Using Comments. Comments in Python. Writing larger programs
What are we going to cover today? Lecture 5 Writing and Testing Programs Writing larger programs Commenting Design Testing Writing larger programs As programs become larger and more complex, it becomes
More informationAssignment 2: Welcome to Java!
CS106A Winter 2011-2012 Handout #12 January 23, 2011 Assignment 2: Welcome to Java! Based on a handout by Eric Roberts and Mehran Sahami Having helped Karel the Robot through the challenges of Assignment
More informationCS 177 Recitation. Week 1 Intro to Java
CS 177 Recitation Week 1 Intro to Java Questions? Computers Computers can do really complex stuff. How? By manipulating data according to lists of instructions. Fundamentally, this is all that a computer
More informationPublic Meeting Agenda Formatting Best Practices
DEFINITIVE GUIDE Public Meeting Agenda Formatting Best Practices In this guide, we will first walk you through some best practices with text and images. Then, we will show you how to execute the best practices
More informationGame keystrokes or Calculates how fast and moves a cartoon Joystick movements how far to move a cartoon figure on screen figure on screen
Computer Programming Computers can t do anything without being told what to do. To make the computer do something useful, you must give it instructions. You can give a computer instructions in two ways:
More informationIntroduction to Programming
CHAPTER 1 Introduction to Programming Begin at the beginning, and go on till you come to the end: then stop. This method of telling a story is as good today as it was when the King of Hearts prescribed
More informationStudent Outcomes. Lesson Notes. Classwork. Discussion (4 minutes)
Student Outcomes Students write mathematical statements using symbols to represent numbers. Students know that written statements can be written as more than one correct mathematical sentence. Lesson Notes
More information3. Introduction to Algorithm and Flowchart
3. Introduction to Algorithm and Flowchart 3.1 Algorithm An algorithm is a set of instructions, sometimes called a procedure or a function that is used to perform a certain task. This can be a simple process,
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 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 informationCS159 - Assignment 2b
CS159 - Assignment 2b Due: Tuesday, Sept. 23 at 2:45pm For the main part of this assignment we will be constructing a number of smoothed versions of a bigram language model and we will be evaluating its
More informationChapter 2.5 Writing maintainable programs
Chapter 2.5 Writing maintainable programs Good program writing techniques Maintenance is the updating of a program after it has been released. Maintenance will be helped when the programmer uses good programming
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 informationCyber Smarts Using Social Media Wisely
Cyber Smarts Using Social Media Wisely Posted on March 24, 2016 by Shridevi Stock Photo You have access to the world s largest museum, art gallery, library and social group ever created. You also have
More informationMakefiles Makefiles should begin with a comment section of the following form and with the following information filled in:
CS 215 Fundamentals of Programming II C++ Programming Style Guideline Most of a programmer's efforts are aimed at the development of correct and efficient programs. But the readability of programs is also
More informationPart II Composition of Functions
Part II Composition of Functions The big idea in this part of the book is deceptively simple. It s that we can take the value returned by one function and use it as an argument to another function. By
More informationCONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction
CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want
More informationCS Problem Solving and Object-Oriented Programming
CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction
More informationImplementing an Algorithm for Boomerang Fraction Sequences in Python
Introduction Implementing an Algorithm for Boomerang Fraction Sequences in Python We ve all encountered maze problems, where the challenge is to find a path through a labyrinth from a starting point to
More informationAn Introduction to Python (TEJ3M & TEJ4M)
An Introduction to Python (TEJ3M & TEJ4M) What is a Programming Language? A high-level language is a programming language that enables a programmer to write programs that are more or less independent of
More informationS206E Lecture 19, 5/24/2016, Python an overview
S206E057 Spring 2016 Copyright 2016, Chiu-Shui Chan. All Rights Reserved. Global and local variables: differences between the two Global variable is usually declared at the start of the program, their
More information1 SEO Synergy. Mark Bishop 2014
1 SEO Synergy 2 SEO Synergy Table of Contents Disclaimer... 3 Introduction... 3 Keywords:... 3 Google Keyword Planner:... 3 Do This First... 4 Step 1... 5 Step 2... 5 Step 3... 6 Finding Great Keywords...
More information1 Getting used to Python
1 Getting used to Python We assume you know how to program in some language, but are new to Python. We'll use Java as an informal running comparative example. Here are what we think are the most important
More information» How do I Integrate Excel information and objects in Word documents? How Do I... Page 2 of 10 How do I Integrate Excel information and objects in Word documents? Date: July 16th, 2007 Blogger: Scott Lowe
More informationPython for Analytics. Python Fundamentals RSI Chapters 1 and 2
Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,
More informationIt s possible to get your inbox to zero and keep it there, even if you get hundreds of s a day.
It s possible to get your email inbox to zero and keep it there, even if you get hundreds of emails a day. It s not super complicated, though it does take effort and discipline. Many people simply need
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 informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
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 informationRelationship of class to object
Relationship of class to object Writing and programming Writing a program is similar to many other kinds of writing. The purpose of any kind of writing is to take your thoughts and let other people see
More informationIn this lesson: Line height, type size and line width are the three aspects of shaping a perfect paragraph. Lesson 2
In this lesson: Line height, type size and line width are the three aspects of shaping a perfect paragraph. Lesson 2 The reader should be able to read the message of a text easily and comfortably. This
More informationBinary, Hexadecimal and Octal number system
Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of
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 informationTeacher Activity: page 1/9 Mathematical Expressions in Microsoft Word
Teacher Activity: page 1/9 Mathematical Expressions in Microsoft Word These instructions assume that you are familiar with using MS Word for ordinary word processing *. If you are not comfortable entering
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 informationIdentifiers. Identifiers are the words a programmer uses in a program Some identifiers are already defined. Some are made up by the programmer:
C1 D6 Obj: cont. 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 1.9 (Short Answers) Chapter 1 Test in two class days!! Do Now: How is the
More informationStat 582 Writing Rubric (First six items from Kansas State Dept of Education rubric)
Stat 582 Writing Rubric (First six items from Kansas State Dept of Education rubric) 1. Ideas/Content (Development) The writing is clearly focused which leads to achieving a well-defined goal. The purpose
More informationIT Web and Software Developer Software Development Standards
IT Web and Software Developer Software Development Standards Definition of terms Identifier An identifier is the name you give variables, methods, classes, packages, interfaces and named constants. Pascal
More informationYup, left blank on purpose. You can use it to draw whatever you want :-)
Yup, left blank on purpose. You can use it to draw whatever you want :-) Chapter 1 The task I have assigned myself is not an easy one; teach C.O.F.F.E.E. Not the beverage of course, but the scripting language
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 informationReal Wireframes Get Real Results
Page 1 of 7 Real Wireframes Get Real Results by Stephen Turbek Published on 09/19/2006 19 Comments 8,935 Views How many times have you been asked, So, is the new website going to be black Just because
More informationTopic C. Communicating the Precision of Measured Numbers
Topic C. Communicating the Precision of Measured Numbers C. page 1 of 14 Topic C. Communicating the Precision of Measured Numbers This topic includes Section 1. Reporting measurements Section 2. Rounding
More informationThe MailNinja 7-Step Success Formula For Sending Lead Generating Campaigns
The MailNinja 7-Step Success Formula For Sending Lead Generating Email Campaigns The MailNinja 7-Step Success Formula For Sending Lead Generating Email Campaigns Over the past 10 years we ve perfected
More informationGraphing on Excel. Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version):
Graphing on Excel Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version): The first step is to organize your data in columns. Suppose you obtain
More informationHeuristic Evaluation of [ Quest ]
Heuristic Evaluation of [ Quest ] 1. Problem Quest is an app that allows you to stay involved in, participate in, and create local clubs and events happening in your community 2. Violations Found 1. [H10.
More informationCSCI 2101 Java Style Guide
CSCI 2101 Java Style Guide Fall 2017 This document describes the required style guidelines for writing Java code in CSCI 2101. Guidelines are provided for four areas of style: identifiers, indentation,
More informationMr G s Java Jive. #11: Formatting Numbers
Mr G s Java Jive #11: Formatting Numbers Now that we ve started using double values, we re bound to run into the question of just how many decimal places we want to show. This where we get to deal with
More information