Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Code Documentation

Code Documentation

Code documentation for team collaborating.

Raka Westu Mogandhi

April 01, 2015
Tweet

More Decks by Raka Westu Mogandhi

Other Decks in Programming

Transcript

  1. Why? • Code is hard to read and maintained. •

    Peoples need to know how to use that code. • Less time to learn and continuing the project.
  2. Good Documentation should: • Be easy to understand. • Provide

    valid and working examples. • Provide reference in all classes, method and variables.
  3. How to write code documentation? • Write the explanation of

    how your code works. • Write the example if necessary.
  4. Examples. • Java (using javadoc) more at http://www.oracle.com/technetwork/articles/java/index-137868.html – Class

    /** * Represents wobe product. * @author rakawm * @version 0.0.6 */ public class Product { – Method /** * Return formatted string of DateTime object in UTC timezone. * Format: dd-MM-yyyy HH:mm or dd-MM-yyyy HH:mm:ss. * @param dateTime DateTime object. * @return formatted string of time. */ public static String toServerUTC(DateTime dateTime) {
  5. Examples (Continued) • PHP /** * Summary. * * Description.

    * * @since x.x.x * @access (for functions: only use if private) * * @see Function/method/class relied on * @link URL * @global type $varname Description. * @global type $varname Description. * * @param type $var Description. * @param type $var Optional. Description. * @return type Description. */
  6. Examples (Continued) • PHP /** * Summary. * * Description.

    * * @since x.x.x * @access (for functions: only use if private) * * @see Function/method/class relied on * @link URL * @global type $varname Description. * @global type $varname Description. * * @param type $var Description. * @param type $var Optional. Description. * @return type Description. */
  7. Recap • Documentation is important for all team members, especially

    engineer. • Need to be documented: – All function, classes and variables.