Coding Standards, Tools for Debugging 1-Software Engineering-Lecture Slides, Slides of Software Engineering

Software Engineering one of core subject in Computer Science. This lecture was delived by Dr. Shrya Gopal at Bengal Engineering and Science University as one of lecture from lecture series on course. This lecture includes: Coding, Standards, Tools, Debugging, Bugs, Guidelines, Standards, Statements, Program, Design, Formatting, Conventions, Licensing, Documentation

Typology: Slides

2011/2012

Uploaded on 08/26/2012

parveen
parveen 🇮🇳

4.6

(9)

88 documents

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 20
Coding Standards
Tools for Debugging 1
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Coding Standards, Tools for Debugging 1-Software Engineering-Lecture Slides and more Slides Software Engineering in PDF only on Docsity!

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

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.

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

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 docsity.com

Examples of Coding Standards

  • http://www.ambysoft.com/javaCodingStandards.html
  • http://www.swtech.com/java/codestd/
  • http://ccs.hst.nasa.gov/ccspages/policies/standards/c oding_standards.html
  • http://www.scriptics.com/doc/styleGuide.pdf