Documentation de référence

Dans l’édition de novembre de MSDN Magazine, Peter Gruenbaum explique comment écrire une bonne documentation de référence pour les APIs dans sont article intitulé “A Coder’s Guide to Writing API Documentation”.

Mon attention s’est particulièrement portée sur la Figure 2 et 3, qui explique comment commenter tout en gardant une homogénéité au travers de tout l’API. Je vous les ai reproduit ici:

Figure 2 Reference Documentation Style

TypeGuidelineExamples
ClassStart with a word like “Represents”“Represents a user’s photo album.”
Methods and functionsStart with a verb“Returns the number of contacts for the specified area.”

“Pauses the video.”
PropertiesUse a noun or start with verbs such as “Gets” or “Gets and sets”“The user’s tasks.”

“Gets and sets a collection of the user’s tasks.”
EventsStart with a phrase such as “Raised when” or “Occurs when”“Raised when the response from server is received.”
XML elementsUse a noun-based phrase“The city’s postal code.”
Boolean valuesFor Boolean properties, start with “Indicates whether”; for Boolean return values on methods and functions, start with “Returns whether”“Indicates whether the control is visible.”

“Returns whether two regions intersect.”

Figure 3 Reference Documentation Example

[Lire]