Lecture 20 Coding Standards Tools for Debugging 1.

Slides:



Advertisements
Similar presentations
Using Commtap Communication Targets and Activities Project.
Advertisements

Configuration Management
Javascript Code Quality Check Tools Javascript Code Quality Check Tools JavaScript was originally intended to do small tasks in webpages, but now JavaScript.
Commenting and Naming Conventions
Intro to CIT 594
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Coding Standards for Java An Introduction. Why Coding Standards are Important? Coding Standards lead to greater consistency within your code and the code.
Documentation 1 Comprehending the present – Investing in the future.
Lisp. Versions of LISP Lisp is an old language with many variants –LISP is an acronym for List Processing language Lisp is alive and well today Most modern.
CSE1301 Computer Programming: Lecture 13 Documentation.
Computer Science 1620 Programming & Problem Solving.
Information Hiding and Encapsulation
Standards. CS351 - Software Engineering (AY2004)2 I think there is a bug in my code… func GreenEggsNHam(Not SamIAm, Green EggsNHam) foreach Green TryThem.
Introduction to a Programming Environment
Algorithm Programming Coding Advices Bar-Ilan University תשס " ו by Moshe Fresko.
CODING Research Data Management. Research Data Management Coding When writing software or analytical code it is important that others and your future.
Procedure specifications CSE 331. Outline Satisfying a specification; substitutability Stronger and weaker specifications - Comparing by hand - Comparing.
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Administrative Policy Writing Spring Administrative Policy Writing Spring 2011 Introduction This week we are discussing a type of public-policy.
Planning for the Solution
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
GCSE OCR 3 A451 Computing Professional standards
1 Welcome to CS 362 Applied Software Engineering What happens after (and during) design? Testing, debugging, maintaining programs Lessons for software.
Good Programming Practices. 2 home back first prev next last What Will I Learn? List examples of good programming practices Accurately insert comments.
CS Fall 2007 Dr. Barbara Boucher Owens. CS 2 Text –Main, Michael. Data Structures & Other Objects in Java Third Edition Objectives –Master building.
07 Coding Conventions. 2 Demonstrate Developing Local Variables Describe Separating Public and Private Members during Declaration Explore Using System.exit.
Using Commtap Communication Targets and Activities Project.
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.
Standards. CS351 - Software Engineering (AY2004)Slide 2 I think there is a bug in my code… func GreenEggsNHam(Not SamIAm, Green EggsNHam) foreach Green.
Programming Principles Chapter 1. Objectives Discuss the program design process. Introduce the Game of Life. Discuss object oriented design. – Information.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
P An important topic: preconditions and postconditions. p They are a method of specifying what a function accomplishes. Illinois State University Department.
Software Development p Data structure p A collection of data organized so that the data can be accessed using a set of specific techniques p Object-oriented.
CSC 212 – Data Structures Prof. Matthew Hertz WTC 207D /
Self-Documenting Code Chapter 32. Kinds of Comments  Repeat of code  Explanation of code  Marker in code  Summary of code  Description of code’s.
C++ Classes and Data Structures Jeffrey S. Childs
The Software Development Process
Program Style Chapter 22 IB103 Week 12 (part 2). Modularity: the ability to reuse code Encapsulation: hide data access directly but may use methods (the.
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
MNP1163 (Software Construction).  SDLC and Construction Models  Construction Planning  Construction Measurement.
An Overview of Software Testing By Kay E. Duchesne.
ITP © Ron Poet Lecture 6 1 More on if. ITP © Ron Poet Lecture 6 2 Remembering Tests  We often want to remember the result of a test, so that we can use.
11 Software Design CSCU 411 Software Engineering.
CSC 213 – Large Scale Programming. Today’s Goal  Understand why testing code is important  Result of poor or no testing & embarrassment caused  Learn.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
Software Maintenance1 Software Maintenance.
Dani Vainstein1 VBScript Session 8. Dani Vainstein2 What we learn last session? VBScript procedures. Sub procedures. Function Procedures. Getting data.
Implementation Topics Describe –Characteristics of good implementations –Best practices to achieve them Understand role of comments Learn debugging techniques.
Overview of c# Programming
Best Practices in Coding
Classes and Objects 2nd Lecture
Methods The real power of an object-oriented programming language takes place when you start to manipulate objects. A method defines an action that allows.
Introduction to javadoc
Design by Contract Fall 2016 Version.
Phil Tayco Slide version 1.0 Created Oct 2, 2017
Lesson 4 Best Practices.
Software Testing and Maintenance Modifying Code
slides created by Ethan Apter
slides created by Ethan Apter
Maintaining a Program In today’s lesson we will look at:
Coding Standards Or How to Pound all of your odd-shaped programmers into a one size fits all hole.
Introduction to javadoc
CMSC 345 Programming.
Assertions References: internet notes; Bertrand Meyer, Object-Oriented Software Construction; 4/25/2019.
ENERGY 211 / CME 211 Lecture 27 November 21, 2008.
slides created by Ethan Apter and Marty Stepp
Introduction Software maintenance:
Chapter 9: Implementation
Presentation transcript:

Lecture 20 Coding Standards Tools for Debugging 1

Coding Standards Or How to Pound all of your odd-shaped programmers into a one size fits all hole

I think there may be a bug in Joe’s Code - Please Fix func GreenEggsNHam(Not SamIAm, Green EggsNHam) foreach Green TryThem in SamIAm do EatThem(TryThem) = false NotInACarNotOnABus(EggsNHam) func NotInACarNotOnABus(Green EggsNHam) EatThem(EggsNHam) = true NotOnAPlane(EggsNHam) foreach NotLikeThem SamIAm of EggsNHam do if not EatThem(SamIAm) then NotInACarNotOnABus(SamIAm) IDoNotLikeThem(EggsNHam)

Joe’s Code Following a Sane Coding Standard... func DepthFirstSearch(graph G, vertex v) foreach vertex w in G do Encountered(w) = false RecursiveDFS(v) func RecursiveDFS(vertex v) Encountered(v) = true PreVisit(v) foreach neighbor w of v do if not Encountered(w) then RecursiveDFS(w) PostVisit(v)

What are Coding Standards Coding standards are guidelines for code style and documentation. The dream is that any developer familiar with the guidelines can work on any code that followed them. Standards range from a simple series of statements to involved documents.

Areas Typically Covered Program Design Naming Conventions Formatting Conventions Documentation Possibly Even Licensing

Why Have Coding Standards Greater consistency between developers Easier to develop and maintain Saves time and money

Prime Directive Document every time you violate a standard. No standard is perfect for every application, but failure to comply with your standards requires a comment

Ambler’s Law of Standards Industry Standards > organizational standards > project standards > no standards The more commonly accepted a standard the easier it is for team members to communicate Invent standards when necessary, but don’t waste time creating something that you won’t be able to use later. All languages have recommended coding standards available. It is well worth your effort to find and use industry standards Push for organizational standards whenever possible

Good Coding Style Names –Use full English descriptors –Use mixed case to make names readable –Use abbreviations sparingly and consistently –Avoid long names –Avoid leading/trailing underscores Documentation –Document the purpose of every variable –Document why something is done not just what

Accessors –use getVar() and setVar() functions on all class variable unless class is being used solely as a data structure (OOP) Member Functions Documentation –What and why member function does what it does –Parameters / return value –How function modifies object –Preconditions /Postconditions –Concurrency issues –Restrictions Internal Documentation –Control Structures –Why as well as what the code does –Difficult or complex code –Processing order

Three Rules Coding standards needn’t be onerous - find a standard that works for your team. Standardize early - the effort to bring your old work into the standard will be too great otherwise. Encourage a culture where standards are followed.

Examples of Coding Standards oding_standards.htmlhttp://ccs.hst.nasa.gov/ccspages/policies/standards/c oding_standards.html