This is not the document you are looking for? Use the search form below to find more!

Report home > Manual & Guide

Philips Healthcare C# Coding Standard

0.00 (0 votes)
Document Description
1.1. Objective This Coding Standard requires or recommends certain practices for developing programs in the C# language. The objective of this coding standard is to have a positive effect on Avoidance of errors/bugs, especially the hard-to-find ones. •Maintainability, by promoting some proven design principles. •Maintainability, by requiring or recommending a certain unity of style. •Performance, by dissuading wasteful practices. •1.2. Scope This standard pertains to the use of the C# language. With few exceptions, it does not discuss the use of the .NET class libraries. This standard does not include rules on how to layout brackets, braces, and code in general. 1.3. Rationale Reasons to have a coding standard and to comply with it are not given here, except the objectives listed in section 1.1. In this section the origins of the rules are given and some explanation why these were chosen.
File Details
  • Added: October, 03rd 2010
  • Reads: 319
  • Downloads: 11
  • File size: 233.30kb
  • Pages: 63
  • Tags: control fow, object oriented, object lifecycle
  • content preview
Submitter
  • Name: cinzia
Embed Code:

Add New Comment




Related Documents

C++ Programming Style Guidelines

by: dutcher, 22 pages

This document lists C++ coding recommendations common in the C++ development community. The recommendations are based on established standards collected from a number of sources, individual ...

Standard C++ Library Reference

by: manualzon, 439 pages

Standard C++ Library Reference.pdf, a useful reference and manual for the C++ programming language, this manual was issued by IBM thru its redbook

Medical Billing and Coding for Healthcare Providers

by: osimos, 3 pages

Medical billing and coding services help healthcare providers to secure maximum reimbursement, leaving no claims unpaid. It is essential for the smooth functioning of health care practices.

Content Preview
Philips Healthcare - C# Coding Standard
Version 2.0
(c) 2009, Philips Healthcare
issued by the CCB Coding Standards Philips Healthcare
External Use of this Document
The C# coding standard as defined by Philips Healthcare and published via the TIOBE website
(http://www.tiobe.com) may be used "as-is" by any interested party.
You may copy, adapt, and redistribute this document for non-commercial use or for your own internal use in a
commercial setting. However, you may not republish this document, nor may you publish or distribute any
adaptation of this document for other than non-commercial use or your own internal use, without first
obtaining express written approval from Philips Healthcare. Philips Healthcare will not be liable for any
direct, indirect, special or consequential damages arising out of any use of the document or the performance or
implementation of the contents thereof.
Please send questions and suggestions about the C# coding standard and/or its code checker ClockSharp to
info@tiobe.com.

Philips Healthcare C# Coding Standard
Table of Contents
Introduction.........................................................................................................................................................1
1.1. Objective...........................................................................................................................................1
1.2. Scope..........................................................................................................................................1
General rules (General)......................................................................................................................................3
Rule 2@105.............................................................................................................................................3
Description........................................................................................................................................3
Naming conventions (Naming)...........................................................................................................................4
Rule 3@101.............................................................................................................................................4
Description........................................................................................................................................5
Rule 3@102.............................................................................................................................................5
Description........................................................................................................................................5
Rule 3@103.............................................................................................................................................5
Description........................................................................................................................................6
Rule 3@104.............................................................................................................................................6
Description........................................................................................................................................6
Rule 3@105.............................................................................................................................................6
Description........................................................................................................................................6
Rule 3@106.............................................................................................................................................6
Description........................................................................................................................................7
Rule 3@107.............................................................................................................................................7
Rule 3@108.............................................................................................................................................7
Description........................................................................................................................................7
Rule 3@109.............................................................................................................................................8
Description........................................................................................................................................8
Rule 3@110.............................................................................................................................................8
Description........................................................................................................................................8
Rule 3@111.............................................................................................................................................8
Description........................................................................................................................................8
Rule 3@112.............................................................................................................................................9
Description........................................................................................................................................9
Rule 3@113.............................................................................................................................................9
Description........................................................................................................................................9
Rule 3@120.............................................................................................................................................9
Description........................................................................................................................................9
Rule 3@122...........................................................................................................................................10
Description......................................................................................................................................10
Rule 3@201...........................................................................................................................................10
Description......................................................................................................................................10
Rule 3@202...........................................................................................................................................10
Description......................................................................................................................................10
Rule 3@203...........................................................................................................................................11
Description......................................................................................................................................11
Rule 3@204...........................................................................................................................................11
Description......................................................................................................................................11
Rule 3@301...........................................................................................................................................11
Description......................................................................................................................................11
Rule 3@302...........................................................................................................................................12
Description......................................................................................................................................12
Rule 3@303...........................................................................................................................................12
Description......................................................................................................................................12
i

Philips Healthcare C# Coding Standard
Table of Contents
Naming conventions (Naming)
Rule 3@304...........................................................................................................................................12
Description......................................................................................................................................12
Rule 3@305...........................................................................................................................................12
Description......................................................................................................................................13
Rule 3@306...........................................................................................................................................13
Description......................................................................................................................................13
Rule 3@307...........................................................................................................................................13
Description......................................................................................................................................13
Rule 3@401...........................................................................................................................................13
Rule 3@402...........................................................................................................................................14
Description......................................................................................................................................14
Rule 3@501...........................................................................................................................................14
Description......................................................................................................................................14
Rule 3@503...........................................................................................................................................14
Description......................................................................................................................................14
Rule 3@504...........................................................................................................................................14
Description......................................................................................................................................15
Comments and embedded documentation (Comments)...............................................................................16
Rule 4@101...........................................................................................................................................16
Description......................................................................................................................................16
Rule 4@103...........................................................................................................................................16
Rule 4@105...........................................................................................................................................16
Description......................................................................................................................................17
Rule 4@106...........................................................................................................................................17
Description......................................................................................................................................17
Object lifecycle (Object lifecycle)....................................................................................................................19
Rule 5@101...........................................................................................................................................19
Rule 5@102...........................................................................................................................................19
Description......................................................................................................................................19
Rule 5@106...........................................................................................................................................19
Description......................................................................................................................................20
Rule 5@107...........................................................................................................................................20
Description......................................................................................................................................20
Rule 5@108...........................................................................................................................................20
Description......................................................................................................................................20
Rule 5@111...........................................................................................................................................21
Description......................................................................................................................................21
Rule 5@112...........................................................................................................................................21
Description......................................................................................................................................21
Rule 5@113...........................................................................................................................................22
Description......................................................................................................................................22
Rule 5@114...........................................................................................................................................23
Description......................................................................................................................................23
Rule 5@116...........................................................................................................................................23
Description......................................................................................................................................24
Control flow (Control flow)..............................................................................................................................25
Rule 6@101...........................................................................................................................................25
Description......................................................................................................................................25
ii

Philips Healthcare C# Coding Standard
Table of Contents
Control flow (Control flow)
Rule 6@102...........................................................................................................................................25
Description......................................................................................................................................25
Rule 6@103...........................................................................................................................................25
Description......................................................................................................................................26
Rule 6@105...........................................................................................................................................26
Description......................................................................................................................................26
Rule 6@106...........................................................................................................................................26
Description......................................................................................................................................27
Rule 6@109...........................................................................................................................................27
Description......................................................................................................................................27
Rule 6@112...........................................................................................................................................27
Description......................................................................................................................................27
Rule 6@115...........................................................................................................................................28
Description......................................................................................................................................28
Rule 6@118...........................................................................................................................................28
Description......................................................................................................................................28
Object oriented programming (Object oriented)...........................................................................................30
Rule 7@101...........................................................................................................................................30
Description......................................................................................................................................30
Rule 7@102...........................................................................................................................................31
Description......................................................................................................................................31
Rule 7@105...........................................................................................................................................31
Description......................................................................................................................................31
Rule 7@201...........................................................................................................................................31
Description......................................................................................................................................32
Rule 7@301...........................................................................................................................................32
Description......................................................................................................................................32
Rule 7@303...........................................................................................................................................32
Description......................................................................................................................................32
Rule 7@402...........................................................................................................................................33
Description......................................................................................................................................33
Rule 7@403...........................................................................................................................................33
Description......................................................................................................................................33
Rule 7@501...........................................................................................................................................34
Description......................................................................................................................................34
Rule 7@502...........................................................................................................................................34
Description......................................................................................................................................34
Rule 7@504...........................................................................................................................................35
Description......................................................................................................................................35
Rule 7@520...........................................................................................................................................35
Description......................................................................................................................................35
Rule 7@521...........................................................................................................................................35
Description......................................................................................................................................35
Rule 7@522...........................................................................................................................................36
Rule 7@525...........................................................................................................................................36
Description......................................................................................................................................36
Rule 7@526...........................................................................................................................................36
Description......................................................................................................................................36
Rule 7@530...........................................................................................................................................36
Rule 7@531...........................................................................................................................................36
iii

Philips Healthcare C# Coding Standard
Table of Contents
Object oriented programming (Object oriented)
Rule 7@532...........................................................................................................................................37
Rule 7@601...........................................................................................................................................37
Description......................................................................................................................................37
Rule 7@602...........................................................................................................................................37
Rule 7@603...........................................................................................................................................37
Description......................................................................................................................................37
Rule 7@604...........................................................................................................................................38
Description......................................................................................................................................38
Rule 7@608...........................................................................................................................................38
Description......................................................................................................................................38
Exceptions (Exceptions)....................................................................................................................................39
Rule 8@101...........................................................................................................................................39
Description......................................................................................................................................39
Rule 8@102...........................................................................................................................................39
Description......................................................................................................................................39
Rule 8@103...........................................................................................................................................40
Description......................................................................................................................................40
Rule 8@104...........................................................................................................................................40
Description......................................................................................................................................40
Rule 8@105...........................................................................................................................................41
Description......................................................................................................................................41
Rule 8@106...........................................................................................................................................41
Description......................................................................................................................................41
Rule 8@107...........................................................................................................................................41
Description......................................................................................................................................41
Rule 8@108...........................................................................................................................................42
Description......................................................................................................................................42
Rule 8@109...........................................................................................................................................42
Description......................................................................................................................................42
Rule 8@110...........................................................................................................................................42
Description......................................................................................................................................43
Rule 8@202...........................................................................................................................................43
Description......................................................................................................................................43
Rule 8@203...........................................................................................................................................43
Description......................................................................................................................................43
Rule 8@204...........................................................................................................................................44
Description......................................................................................................................................44
Delegates and events (Delegates and events)..................................................................................................45
Rule 9@101...........................................................................................................................................45
Description......................................................................................................................................45
Rule 9@102...........................................................................................................................................45
Description......................................................................................................................................45
Rule 9@103...........................................................................................................................................45
Description......................................................................................................................................46
Rule 9@104...........................................................................................................................................46
Description......................................................................................................................................47
Rule 9@105...........................................................................................................................................47
Description......................................................................................................................................47
Rule 9@106...........................................................................................................................................47
iv

Philips Healthcare C# Coding Standard
Table of Contents
Delegates and events (Delegates and events)
Description......................................................................................................................................47
Rule 9@107...........................................................................................................................................47
Description......................................................................................................................................48
Rule 9@108...........................................................................................................................................48
Description......................................................................................................................................48
Rule 9@110...........................................................................................................................................48
Description......................................................................................................................................48
Various data types (Data types).......................................................................................................................50
Rule 10@201.........................................................................................................................................50
Description......................................................................................................................................50
Rule 10@202.........................................................................................................................................50
Description......................................................................................................................................50
Rule 10@203.........................................................................................................................................51
Description......................................................................................................................................51
Rule 10@301.........................................................................................................................................51
Description......................................................................................................................................52
Rule 10@401.........................................................................................................................................52
Description......................................................................................................................................52
Rule 10@403.........................................................................................................................................53
Description......................................................................................................................................53
Rule 10@404.........................................................................................................................................53
Description......................................................................................................................................53
Rule 10@405.........................................................................................................................................53
Description......................................................................................................................................53
Rule 10@406.........................................................................................................................................53
Description......................................................................................................................................54
Rule 10@407.........................................................................................................................................54
Description......................................................................................................................................54
Coding style (Coding style)..............................................................................................................................55
Rule 11@101.........................................................................................................................................55
Description......................................................................................................................................55
Rule 11@403.........................................................................................................................................55
Description......................................................................................................................................55
Rule 11@407.........................................................................................................................................55
Description......................................................................................................................................56
Rule 11@409.........................................................................................................................................56
Description......................................................................................................................................56
Rule 11@411.........................................................................................................................................56
Description......................................................................................................................................56
Literature...........................................................................................................................................................57
v

Introduction
1.1. Objective
This Coding Standard requires or recommends certain practices for developing programs in the C# language.
The objective of this coding standard is to have a positive effect on
Avoidance of errors/bugs, especially the hard-to-find ones.

Maintainability, by promoting some proven design principles.

Maintainability, by requiring or recommending a certain unity of style.

Performance, by dissuading wasteful practices.

1.2. Scope
This standard pertains to the use of the C# language. With few exceptions, it does not discuss the use of the
.NET class libraries.
This standard does not include rules on how to layout brackets, braces, and code in general.
1.3. Rationale
Reasons to have a coding standard and to comply with it are not given here, except the objectives listed in
section 1.1. In this section the origins of the rules are given and some explanation why these were chosen.
1.3.1. Sources of inspiration
Many of the rules were taken from the MSDN C# Usage Guidelines ([MS Design]). The naming guidelines in
that document are identical to those found in Appendix C of the ECMA C# Language Specification ([C#
Lang]).
Many other recommendations and a few design patterns were also taken from [MS Design].
Some general good practices, most of them concerning Object-Oriented programming, were copied from the
Philips Healthcare C++ Coding Standard ([C++ Coding Standard]).
The numbering scheme and some of the structure have been copied from [C++ Coding Standard].
1.3.2. Contrast with C++
A considerable part of a coding standard for C or C++ could be condensed into a single rule, avoid undefined
behavior, and maybe shun implementation defined behavior. Officially C# does not exhibit any of these,
barring a few minor, well-defined exceptions. Most examples of undefined behavior in C++ will cause an
exception to be thrown in C#. Although this is an improvement on the ?anything might happen? of C++, it is
highly undesirable for post-release software.
1.4. Applicability
This coding standard applies to all C# code that is part of Philips Healthcare software products or directly
supportive to these products. Third party software is constrained by this standard if this software is developed
specifically for Philips Healthcare.
1

Philips Healthcare C# Coding Standard
1.5. Notational conventions
1.5.1. Rule
A rule should be broken only for compelling reasons where no reasonable alternative can be found. The
author of the violating code shall consult with at least one knowledgeable colleague and a senior designer to
review said necessity. A comment in the code explaining the reason for the violation is mandatory.
1.5.2. Checkable
Rules in this coding standard are marked checkable if automatic verification of compliance is enforced by
static analyzers.
1.5.3. Examples
Please note that the source code formatting in some examples has been chosen for compactness rather than for
demonstrating good practice. The use of a certain compact style in some of the examples is considered
suitable for tiny code fragments, but should not be emulated in ?real? code.
2

General rules (General)
Rules
2@105 Do not mix code from different providers in one file
Rule 2@105
Synopsis: Do not mix code from different providers in one file
Language: C#
Level:
6
Category: General
Description
In general, third party code will not comply with this coding standard, so do not put such code in the same file
as code written by Philips.
Also, avoid mixing code from different Philips departments in one file, e.g., do not mix MR code with PII
code. This coding standard does not specify layout rules, so code from both providers may look slightly
different.
3

Naming conventions (Naming)
Rules
3@101
Use US-English for naming identifiers
3@102
Use Pascal and Camel casing for naming identifiers
3@103
Do not use Hungarian notation or add any other type identification to identifiers
3@104
Do not prefix member fields
3@105
Do not use casing to differentiate identifiers
3@106
Use abbreviations with care
3@107
Do not use an underscore in identifiers
3@108
Name an identifier according to its meaning and not its type
3@109
Name namespaces according to a well-defined pattern
3@110
Do not add a suffix to a class or struct name
3@111
Use a noun or a noun phrase to name a class or struct
3@112
Abbreviations with more than two letters should be cased as words
3@113
Prefix interfaces with the letter I
3@120
Use similar names for the default implementation of an interface
3@122
Suffix names of attributes with Attribute
3@201
Do not add an enum suffix to an enumeration type
3@202
Use singular names for enumeration types
3@203
Use a plural name for enumerations representing bitfields
3@204
Do not use letters that can be mistaken for digits, and vice versa
3@301
Add EventHandler to delegates related to events
3@302
Add Callback to delegates related to callback methods
3@303
Do not add a Callback or similar suffix to callback methods
3@304
Use a verb (gerund) for naming an event
3@305
Do not add an Event suffix (or any other type-related suffix) to the name of an
event
3@306
Use an -ing and -ed form to express pre-events and post-events
3@307
Prefix an event handler with On
3@401
Suffix exception classes with Exception
3@402
Do not add code-archive related prefixes to identifiers
3@501
Name DLL assemblies after their containing namespace
3@503
Use Pascal casing for naming source files
3@504
Name the source file to the main class
Rule 3@101
Synopsis: Use US-English for naming identifiers
Language: C#
Level:
6
Category: Naming
4

Document Outline

  • Table of Contents
  • Introduction
    • 1.1. Objective
      • 1.2. Scope
  • General rules (General)
    • Rule 2@105
      • Description
  • Naming conventions (Naming)
    • Rule 3@101
      • Description
    • Rule 3@102
      • Description
    • Rule 3@103
      • Description
    • Rule 3@104
      • Description
    • Rule 3@105
      • Description
    • Rule 3@106
      • Description
    • Rule 3@107
    • Rule 3@108
      • Description
    • Rule 3@109
      • Description
    • Rule 3@110
      • Description
    • Rule 3@111
      • Description
    • Rule 3@112
      • Description
    • Rule 3@113
      • Description
    • Rule 3@120
      • Description
    • Rule 3@122
      • Description
    • Rule 3@201
      • Description
    • Rule 3@202
      • Description
    • Rule 3@203
      • Description
    • Rule 3@204
      • Description
    • Rule 3@301
      • Description
    • Rule 3@302
      • Description
    • Rule 3@303
      • Description
    • Rule 3@304
      • Description
    • Rule 3@305
      • Description
    • Rule 3@306
      • Description
    • Rule 3@307
      • Description
    • Rule 3@401
    • Rule 3@402
      • Description
    • Rule 3@501
      • Description
    • Rule 3@503
      • Description
    • Rule 3@504
      • Description
  • Comments and embedded documentation (Comments)
    • Rule 4@101
      • Description
    • Rule 4@103
    • Rule 4@105
      • Description
    • Rule 4@106
      • Description
  • Object lifecycle (Object lifecycle)
    • Rule 5@101
    • Rule 5@102
      • Description
    • Rule 5@106
      • Description
    • Rule 5@107
      • Description
    • Rule 5@108
      • Description
    • Rule 5@111
      • Description
    • Rule 5@112
      • Description
    • Rule 5@113
      • Description
    • Rule 5@114
      • Description
    • Rule 5@116
      • Description
  • Control flow (Control flow)
    • Rule 6@101
      • Description
    • Rule 6@102
      • Description
    • Rule 6@103
      • Description
    • Rule 6@105
      • Description
    • Rule 6@106
      • Description
    • Rule 6@109
      • Description
    • Rule 6@112
      • Description
    • Rule 6@115
      • Description
    • Rule 6@118
      • Description
  • Object oriented programming (Object oriented)
    • Rule 7@101
      • Description
    • Rule 7@102
      • Description
    • Rule 7@105
      • Description
    • Rule 7@201
      • Description
    • Rule 7@301
      • Description
    • Rule 7@303
      • Description
    • Rule 7@402
      • Description
    • Rule 7@403
      • Description
    • Rule 7@501
      • Description
    • Rule 7@502
      • Description
    • Rule 7@504
      • Description
    • Rule 7@520
      • Description
    • Rule 7@521
      • Description
    • Rule 7@522
    • Rule 7@525
      • Description
    • Rule 7@526
      • Description
    • Rule 7@530
    • Rule 7@531
    • Rule 7@532
    • Rule 7@601
      • Description
    • Rule 7@602
    • Rule 7@603
      • Description
    • Rule 7@604
      • Description
    • Rule 7@608
      • Description
  • Exceptions (Exceptions)
    • Rule 8@101
      • Description
    • Rule 8@102
      • Description
    • Rule 8@103
      • Description
    • Rule 8@104
      • Description
    • Rule 8@105
      • Description
    • Rule 8@106
      • Description
    • Rule 8@107
      • Description
    • Rule 8@108
      • Description
    • Rule 8@109
      • Description
    • Rule 8@110
      • Description
    • Rule 8@202
      • Description
    • Rule 8@203
      • Description
    • Rule 8@204
      • Description
  • Delegates and events (Delegates and events)
    • Rule 9@101
      • Description
    • Rule 9@102
      • Description
    • Rule 9@103
      • Description
    • Rule 9@104
      • Description
    • Rule 9@105
      • Description
    • Rule 9@106
      • Description
    • Rule 9@107
      • Description
    • Rule 9@108
      • Description
    • Rule 9@110
      • Description
  • Various data types (Data types)
    • Rule 10@201
      • Description
    • Rule 10@202
      • Description
    • Rule 10@203
      • Description
    • Rule 10@301
      • Description
    • Rule 10@401
      • Description
    • Rule 10@403
      • Description
    • Rule 10@404
      • Description
    • Rule 10@405
      • Description
    • Rule 10@406
      • Description
    • Rule 10@407
      • Description
  • Coding style (Coding style)
    • Rule 11@101
      • Description
    • Rule 11@403
      • Description
    • Rule 11@407
      • Description
    • Rule 11@409
      • Description
    • Rule 11@411
      • Description
  • Literature

Download
Philips Healthcare C# Coding Standard

 

 

Your download will begin in a moment.
If it doesn't, click here to try again.

Share Philips Healthcare C# Coding Standard to:

Insert your wordpress URL:

example:

http://myblog.wordpress.com/
or
http://myblog.com/

Share Philips Healthcare C# Coding Standard as:

From:

To:

Share Philips Healthcare C# Coding Standard.

Enter two words as shown below. If you cannot read the words, click the refresh icon.

loading

Share Philips Healthcare C# Coding Standard as:

Copy html code above and paste to your web page.

loading