Documentation and Functional Specification. February 20, 2008

Similar documents
Programming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions

Computing Concepts with Java Essentials

Code Contracts User Manual

Coding Standard for Java

User Guide Thank you for purchasing the DX90

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

DEFINING CONTRACTS WITH DIFFERENT TOOLS IN SOFTWARE DEVELOPMENT

Case studies: Outline. Requirement Engineering. Case Study: Automated Banking System. UML and Case Studies ITNP090 - Object Oriented Software Design

Inline Variables. Document Number: N4424 Date: Hal Finkel and Richard Smith

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

New York State Student Learning Objective: Regents Geometry

Week 13 Trigonometric Form of Complex Numbers

Some Comments on the Derivative of a Vector with applications to angular momentum and curvature. E. L. Lady (October 18, 2000)

Aspect Oriented Programming. with. Spring

Ch 7-1. Object-Oriented Programming and Classes

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Objectif. Participant. Prérequis. Remarque. Programme. C# 3.0 Programming in the.net Framework. 1. Introduction to the.

C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents

Yarmouk University Faculty of Science and Information Technology Department of Computer Information Systems CIS 282 Developing Web Applications

Problems and Measures Regarding Waste 1 Management and 3R Era of public health improvement Situation subsequent to the Meiji Restoration

Statically Checking API Protocol Conformance with Mined Multi-Object Specifications Companion Report

Java CPD (I) Frans Coenen Department of Computer Science

UML for C# Modeling Basics

Getting Started with the Internet Communications Engine

Programming in C# with Microsoft Visual Studio 2010

Windows Presentation Foundation (WPF) User Interfaces

Praktikum im Bereich Praktische Informatik Entwicklung eines Ray-Tracing Systems. computer graphics & visualization

C++ INTERVIEW QUESTIONS

CIS 544 Advanced Software Design and Development. Project Management System. Oreoluwa Alebiosu

Visual Basic. murach's TRAINING & REFERENCE

Software Development Phases

Geometry Solve real life and mathematical problems involving angle measure, area, surface area and volume.

FDOTSS3/SS4 DESIGN SURVEY WORKFLOW Part 2 of 3

This section provides a 'Quickstart' guide to using TestDriven.NET any version of Microsoft Visual Studio.NET

C#5.0 IN A NUTSHELL. Joseph O'REILLY. Albahari and Ben Albahari. Fifth Edition. Tokyo. Sebastopol. Beijing. Cambridge. Koln.

An Incomplete C++ Primer. University of Wyoming MA 5310

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

13 Classes & Objects with Constructors/Destructors

Exhibit memory of previously-learned materials by recalling facts, terms, basic concepts, and answers. Key Words

How To Write A Test Engine For A Microsoft Microsoft Web Browser (Php) For A Web Browser For A Non-Procedural Reason)

Glossary of Object Oriented Terms

AP CALCULUS AB 2009 SCORING GUIDELINES

AP Computer Science A 2011 Free-Response Questions

Software Development (CS2500)

THE COMPLEX EXPONENTIAL FUNCTION

G C.3 Construct the inscribed and circumscribed circles of a triangle, and prove properties of angles for a quadrilateral inscribed in a circle.

Object-Oriented Programming in Java

VIDEO SCRIPT: Data Management

Software Engineering Techniques

7.1 Our Current Model

Automaton Programming and Inheritance of Automata

LINQ & SharePoint Development. Mirjam van Olst May 29 th 2009

Arrangements And Duality

Programming with the Microsoft.NET Framework Using Microsoft Visual Studio 2005 (VB)

Philips Healthcare - C# Coding Standard

Software Construction

Course Title: Software Development

UML TUTORIALS THE USE CASE MODEL

GContracts Programming by Contract with Groovy. Andre Steingress

There are 2 approaches to starting a session: the mutation scope can contain a whole codebase or in a single chosen method.

VB.NET INTERVIEW QUESTIONS

Localizing your.net Application Venkat Subramaniam

Chapter 5 Functions. Introducing Functions

ASP.NET Programming with C# and SQL Server

An Overview of Java. overview-1

Adapting C++ Exception Handling to an Extended COM Exception Model

Verifying Spec# Delegates. Samuele Gantner

BarTender s.net SDKs

Object Oriented Software Design II

Specialized Programme on Web Application Development using Open Source Tools

vector vec double # in # cl in ude <s ude tdexcept> tdexcept> // std::ou std t_of ::ou _range t_of class class V Vector { ector {

Coding conventions and C++-style

PROBLEM SET. Practice Problems for Exam #1. Math 1352, Fall Oct. 1, 2004 ANSWERS

XLIFF 2.0. David Filip Secretary & Editor OASIS XLIFF TC

EXAM PRO:Design & Develop Windows Apps Using MS.NET Frmwk 4. Buy Full Product.

Programming by Contract vs. Defensive Programming: A Comparison of Run-time Performance and Complexity

Vectors Math 122 Calculus III D Joyce, Fall 2012

Rigorous Software Development CSCI-GA

Microsoft Dynamics AX 2012 MorphX Enhancements

Generating Aspect Code from UML Models

Circles in Triangles. This problem gives you the chance to: use algebra to explore a geometric situation

Designing with Exceptions. CSE219, Computer Science III Stony Brook University

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Title Release Notes PC SDK Date Dealt with by, telephone. Table of Content GENERAL... 2

Systems Integration: Co C mp m onent- t bas a e s d s o s ftw ft a w r a e r e ngin i eeri r n i g

Developing Microsoft SQL Server Databases MOC 20464

CS 101 Computer Programming and Utilization

Exploring Geometric Transformations in a Dynamic Environment Cheryll E. Crowe, Ph.D. Eastern Kentucky University

Changes to credit card processing in Microsoft Dynamics AX 2012 R2

TypeScript for C# developers. Making JavaScript manageable

Guile Present. version 0.3.0, updated 21 September Andy Wingo

Applied Informatics C++ Coding Style Guide

My IC Customizer: Descriptors of Skins and Webapps for third party User Guide

Quotes from Object-Oriented Software Construction

Binary compatibility for library developers. Thiago Macieira, Qt Core Maintainer LinuxCon North America, New Orleans, Sept. 2013

RADIUS OF CURVATURE AND EVOLUTE OF THE FUNCTION y=f(x)

Pro/ENGINEER Wildfire 4.0 Basic Design

Title Release Notes PC SDK Date Dealt with by, telephone. Table of Content GENERAL Corrected Issues PDD...

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

Interface Definition. Guidelines and Recommendations. Author: Radovan Semančík. Date: January Version: 1.0

Transcription:

Documentation and Functional Specification February 20, 2008

1 XML Documentation in C# 2 Functional Specification 1/18

Inline XML Documentation Visual Studio/Mono can generate XML documentation from comments in source files. Generated XML can be turned into web pages, or used by other tools Support for custom tags is potentially useful for third party tools. 2/18

Example: Inline XML Documentation namespace Geometry { / / / <summary> / / / This t e x t e x p l a i n s the <c>point </ c> class. / / / </summary> class Point { p u b l i c i n t x ; p u b l i c i n t y ; / / / <summary> / / / Moves the p o i n t / / / </summary> / / / <param name=" dx" >Amount to move</ param> p u b l i c void movex( i n t dx ) { x+=dx ; } } } 3/18

Example: Generated XML <?xml version=" 1.0 "?> <doc> <assembly> <name> p o i n t F i l e < / name> < / assembly> <members> <member name= " T:Geometry. Point " > <summary> This t e x t e x p l a i n s the <c> Point< / c> class. < / summary> < / member> <member name= " M:Geometry. Point. movex( System. I n t 3 2 ) " > <summary> Moves the p o i n t < / summary> <param name= " dx " >Amount t o move< / param> < / member> < / members> < / doc> 4/18

Basics of XML Comments All XML comments must be on /// lines XML comments must proceed either Type declarations: classes, delegates, interfaces Member declarations: fields, events, properties, and methods Members without xml comments are omitted from the documentation XML comments can t be used in method bodies on namespaces... 5/18

Standard Tags <summary> General information about a member</summary> <value> Describes property value</summary> <param name="x">description of method parameter x</param> <returns>description of method results</param> <exception cref="name">describes an exception that may be thrown</exception> <seealso cref="name">a cross reference</seealso>... 6/18

Visual studio has special support for some tags. <summary> text shown by Intellisense <param> compiler checks parameter names are correct <exception> compiler checks that the exception type exists 7/18

Member name decoration All members names are decorated with their full names, types of their arguments, and a one-character label. Recall: p u b l i c void movex( i n t dx ) { x+=dx ; } <member name= " M:Geometry. Point. movex( System. I n t 3 2 ) " > 8/18

XML Documentation Character Labels Label Meaning T Type: class, interface, struct, enum, delegate F Field P Property M Method E Event N Namespace (C# can t document namespaces, but can reference them.)! Error 9/18

Summary: Inline XML Documentation Benefits: Drawbacks: 10/18

Summary: Inline XML Documentation Benefits: Code and documentation in one place kept is sync Standard tags facilitate tool use Drawbacks: 10/18

Summary: Inline XML Documentation Benefits: Code and documentation in one place kept is sync Standard tags facilitate tool use Drawbacks: Documentation can overwhelm code in source files Hard to internationalize documentation should translation team need to edit source files? 10/18

Summary: Inline XML Documentation Benefits: Code and documentation in one place kept is sync Standard tags facilitate tool use Drawbacks: Documentation can overwhelm code in source files Hard to internationalize documentation should translation team need to edit source files? Alternative programs (e.g. monodoc) try to provide the best of both worlds. 10/18

Summary: Inline XML Documentation Benefits: Code and documentation in one place kept is sync Standard tags facilitate tool use Drawbacks: Documentation can overwhelm code in source files Hard to internationalize documentation should translation team need to edit source files? Alternative programs (e.g. monodoc) try to provide the best of both worlds. No required documentation system in this class. 10/18

1 XML Documentation in C# 2 Functional Specification 11/18

Useful documentation Documentation should fully specify what code does. Questions documentation should answer: What state does an object model? What are method pre- and post-conditions? What can cause exceptions, and which exceptions? What assumptions and invariants are used by the implementation? Our approach: Document a program s behavior using well-defined clauses that discuss different aspects of specification. 12/18

Functional specification and abstraction. Implementation should be hidden from clients. Maintainers need all the details. Principle: Document public things using an abstract specification state to describe program behavior. Principle: Document private things using both the specification and concrete state of program. 13/18

Documenting classes and interfaces. Classes and interfaces should be described generally, and define the associate specification state. Example / / Instances of Point represent / / the geometric o b j e c t. / / State : A p o i n t p i n R^2 class Point {... } 14/18

Documenting private fields Private members define the concrete state of a class. Document their invariants, and define an abstraction function defining how concrete and abstract states are related. / / Polar radius of the p o i n t. / / I n v a r i a n t : r >= 0. p r i v a t e double r ; / / Polar angle of the p o i n t. / / I n v a r i a n t : 0 <= t h e t a < 0 p r i v a t e double t h e t a ; / / A b s t r a c t i o n Function : / / State p = ( r cos ( t h e t a ), r s i n ( t h e t a ) ) 15/18

Documenting public members Public members should be described in terms of the abstract state. / / t h i s. X i s p s X component p u b l i c double X{ get { r s i n ( t h e t a ) ; } set {... } } 16/18

Documenting methods Write method specifications that describe the pre- and post-conditions of the method, including possible side-effects and exceptions. / / distance ( q ) r e t u r n s the distance / / between p and q. double distance ( Point q ) / / r o t a t e ( d ) e f f e c t s t h i s by r o t a t i n g p about / / the o r i g i n by d radians / / Requires : p i < d <= p i void r o t a t e ( double d ). 17/18

Specification clauses State Abstract state of a class. Abstraction Function Relates abstract and concrete states. Invariants Constraints on public or private fields or members. Invariants must hold after any constructors executes. Checks Method pre-condition. Method promises to throw an exception when violated. Requires Method pre-condition. Method may or may not throw an exception when violated. Throws Method post-condition. Explains a possible thrown exception. Returns Method post-condition describing ordinary return values. 18/18