SlideShare une entreprise Scribd logo
1  sur  113
Creating Beautiful Documentation with
                      YUI Doc
                     Stephen Woods
YUICONF 2009
/**
    * Frontend Engineer in Yahoo! Internal
    * Platform group. I write apis all day
    *
    * @module YUI Doc
    * @author Stephen Woods
    */




YUICONF 2009
I hate writing
   Documentation




YUICONF 2009
I hate writing
   Documentation



               Undocumented
               code is worse.

YUICONF 2009
But.myCodeIsSelfDocumenting();
  //and well commented




YUICONF 2009
If you are writing APIs
   good documentation
   is a requirement




YUICONF 2009
True Stories of Bad Documentation




YUICONF 2009
True Stories of Bad Documentation




YUICONF 2009
True Stories of Bad Documentation




YUICONF 2009
WRITING DOCS



YUICONF 2009
YUICONF 2009
How do they make those wonderful
Docs?




YUICONF 2009
How do they make those wonderful
Docs?




YUICONF 2009
How do they make those wonderful
Docs?




YUICONF 2009
How do they make those wonderful
Docs?




YUICONF 2009
YUICONF 2009
Write Code       Start to Docs       Change Code




                     Tell People to     Explain Why the
      Fix Bugs
                     Read the Docs      Docs are Wrong




                                      Realize you forgot to
  Start to fix Docs   Fix More Bugs
                                        Update the docs



YUICONF 2009
YUICONF 2009
Write Code




YUICONF 2009
Write Code



               Have Docs



YUICONF 2009
Write Code

                (MAGIC)

               Have Docs



YUICONF 2009
(MAGIC)




YUICONF 2009
(MAGIC)



YUICONF 2009
YUICONF 2009
CppDoc
          Doxygen
           JavaDoc
    PhpDocumentor
             JSDoc
           YUI Doc
             YARD




YUICONF 2009
CppDoc
          Doxygen
           JavaDocDoc Generators
    PhpDocumentor Better Living
             JSDoc Through Automation
           YUI Doc
             YARD




YUICONF 2009
Doc Generators
 Automatically create documentation from code




      js

YUICONF 2009
What is YUI Doc?

 /**
  * Encodes the string as an LZW
  * compressed binary stream
  *
  * @method encode
  * @static
  * @param {String} str The string to encode
  * @return {String} The encoded string
  */
 encode:function(str){



YUICONF 2009
What is YUI Doc?




YUICONF 2009
YUI Doc




YUICONF 2009
YUI Doc
A language-neutral way to
automagically generate beautiful
documentation



YUICONF 2009
language-neutral




YUICONF 2009
using System;
    /**
    * C# Module Description
    * @module lang.csharp
    */

    /**
    * C# Class Description
    * @class ReadAll




                                C#
    * @namespace PlayingAround
    */
    namespace PlayingAround {
        class ReadAll {
            /**
            * Main Method
            * @method Main
            * @static
            */
            public static void Main(string[] args) {
                string contents = System.IO.File.ReadAllText(@"C:t1");
                Console.Out.WriteLine("contents = " + contents);
            }
        }
    }




YUICONF 2009
/**
    * Test Java Module Description
    * @module lang.javatest
    */
    import java.util.*;

    /**
    * This is the class description for this Java Class
    * @class Test
    * @namespace Java




                           Java
    * @constructor
    */
    public class Test {
        /**
        * x property
        * @property x
        * @type {Double}
        */
        private double x;
        /**
        * y property
        * @property y
        * @type {Double}
        */
        private double y;
    }




YUICONF 2009
#!/usr/bin/env python
    '''
    /**
    * Test Python File
    * @module testpy
    */
    '''
    import os, sys, string, shutil, urllib2, urllib, pprint, simplejson, datetime
    from cStringIO import StringIO
    from subprocess import call, PIPE, Popen




                     Python
    '''
    /**
    * This is a test class
    * @class TestPy
    * @namespace Python
    */
    '''

    '''
    /**
    * Test Method
    * @method test
    */
    '''
    def test():
        pass


YUICONF 2009
=begin
   /**
   * Module Info for test Ruby File
   * @module lang.rubytest
   */
   =end
   require 'rubygems'
   require 'grit'
   require 'optparse'
   require 'logger'
   require 'fileutils'




                         Ruby
   module RubyTest
   =begin
   /**
   * Class Information
   * @class test
   * @namespace Ruby
   */
   =end
        class Test
   =begin
   /**
   * Execute desc
   * @method execute
   */
   =end
            def self.execute
                #foo
            end

YUICONF 2009
/**
                  * This method syncs the value of time object,
                  * including building the strings for 12hr and 24hr
                  * also fires a 'timechange' event
                  * @method _syncTime
                  * @protected
                  *
                  */
                 _syncTime:function(){




           JavaScript
                     var time = this.get('time'),

                     ampm = time.ampm,
                     strings = this.get('strings'),
                     seperator = this.get('strings.seperator'),
                     minute    = pad(time.minute);

                     //build the string for ampm based on the strings
                     ampmString = (ampm == AM) ? this.get(AMSTR_KEY) :
   this.get(PMSTR_KEY);

                     //store the string representation of the 12 hour time

                     this.set('time.s12hour',
                             ((time.hour == 0) ? 12 : time.hour) +
                             seperator + minute + ampmString);


YUICONF 2009
language-neutral




YUICONF 2009
language-neutral
‣   Primarily generated from special comment blocks




YUICONF 2009
language-neutral
‣   Primarily generated from special comment blocks
‣   Can work with any language




YUICONF 2009
language-neutral
‣   Primarily generated from special comment blocks
‣   Can work with any language
‣   Lets you describe code however makes sense




YUICONF 2009
language-neutral




YUICONF 2009
language-neutral
‣   Will fall out of sync




YUICONF 2009
language-neutral
‣   Will fall out of sync
‣   There will be copy/paste errors




YUICONF 2009
language-neutral
‣   Will fall out of sync
‣   There will be copy/paste errors
‣   Type mismatches will happen




YUICONF 2009
YUI Doc
A language-neutral way to
automagically generate
Beautiful Documentation



YUICONF 2009
Beautiful Documentation




YUICONF 2009
Beautiful Documentation



               ‣ Accurate




YUICONF 2009
Beautiful Documentation



               ‣ Accurate
               ‣ Complete




YUICONF 2009
Beautiful Documentation



               ‣ Accurate
               ‣ Complete
               ‣ Useable




YUICONF 2009
Beautiful Documentation



               ‣ Accurate
               ‣ Complete
               ‣ Useable
               ‣ Understandable



YUICONF 2009
USING
   YUI DOC



YUICONF 2009
Sample Project
      My Project

          compression

         lzw.js

         lzw-lite.js

         widgets

         timepickerwidget.js

                   http://bit.ly/samplebuild

YUICONF 2009
Project Structure




YUICONF 2009
Project Structure


                                  Project



                   Module                      Module
                   ~/LZW                    ~/Timepicker


               Class     Class                 Class
               LZW     LZW-Lite             Timepicker




YUICONF 2009
Comment Blocks




YUICONF 2009
Comment Blocks


    /**
      * Description
      * @tag tagValue
      * @secondaryTag secondaryValue
      */




YUICONF 2009
Primary Tags
    ‣ @module
    ‣ @class
    ‣ @property
    ‣ @event
    ‣ @method




YUICONF 2009
Secondary Tags
    ‣ @submodule   ‣ @extends
    ‣ @namespace   ‣ @config




                        *YUI Specific
YUICONF 2009
@param & @return
Datatypes!

    @param {type} name description
    @return {type} description




YUICONF 2009
Object



        {}
                 Array
                String
@param         Boolean   Name Description
                Number
                 Mixed
                MyType


YUICONF 2009
@module




YUICONF 2009
@module
  /**
   * A javascript file compression library
   * @module Compression
   * @requires node, event
   */

  /**
    * Provides LZW compression
    * @module Compression
    * @submodule Compression-LZW
    */



YUICONF 2009
@module




YUICONF 2009
@class
 /**
  * A YUI timepicker widget
  *
  * @class Timepicker
  * @constructor
  * @namespace Y.Saw
  * @extends Widget
  */
YUI.add('timepicker', function(Y){




YUICONF 2009
@class




YUICONF 2009
@event

     /**
      * Fires when a new day begins
      *
      * @event dawn
      * @param {String} color
      * @param {Number} duration
      */




YUICONF 2009
@event




YUICONF 2009
@property


 /**
   * Symbol for AM
   * @property AM
   * @type String
   */




YUICONF 2009
@property




YUICONF 2009
@property + @attribute

      /**
       * @property Timepicker.ATTRS
       * @type Object
       * @protected
       * @static
       */
      Timepicker.ATTRS = {

           /**
            * The selected time
            * @attribute time
            * @type Object
            * @default {hour:0, minute:0, ampm:'AM'}
            */




YUICONF 2009
@property + @attribute




YUICONF 2009
@method
/**
 * Utility method that returns the size
 * of a unicode string in bytes
 * @method strSize
 * @param {String}str The string to evaluate
 * @return {Number} the length of the
 * string in bytes
 */
strSize:function(str){




YUICONF 2009
@method




YUICONF 2009
BUILDING
   DOCS



YUICONF 2009
http://bit.ly/yuidoc




YUICONF 2009
YUICONF 2009
> yuidoc.py myLib -p doctmp/parsertmp -o
  doctmp/tocs -t template -m 'YUI Doc Demo' -Y
  "3.0.0b1" -v "0.0.1"




YUICONF 2009
example.sh
          parser_in="$HOME/src"
          parser_out=~/www/docs/parser
          generator_out=~/www/docs/generator
          template=$yuidoc_home/template




YUICONF 2009
yourbuild.sh
          parser_in="$HOME/src"
          parser_out=~/www/docs/parser
          generator_out=~/www/docs/generator
          template=yourtemplate
          projectname='YUI Doc Demo'
          version='1.0.0'
          yuiversion='3.0.0'
          url='http://your.project.url

   -t $template -m $projectname -Y
   $yuiversion -v $version -u $url
YUICONF 2009
Slide Title
Slide Content

       <target name="doc">
           <mkdir dir="${tmp_dir}" />
           <mkdir dir="${tmp_dir}/parsertmp" />
           
           
           <property name="parser_out" location="${tmp_dir}/parsertmp" />
           <property name="generator_out" location="${doc_dir}" />
           <property name="template" location="template" />
           <property name="yuiversion" location="3.0.0" />
       
           <echo>generating documentation</echo>
           
           <exec executable="${yuidoc_exec}">
             <arg value="${parser_in}"/>
             <arg value="-p"/>
             <arg value="${parser_out}"/>
             <arg value="-o" />
             <arg value="${generator_out}" />
             <arg value="-t" />
             <arg value="${template}" />



YUICONF 2009
Watch out for:




YUICONF 2009
.git
               Watch out for: .cvs
                              .svn




YUICONF 2009
KEEPING
   DOCS
   RELEVANT


YUICONF 2009
Simple Rules




YUICONF 2009
Simple Rules



       ‣ Generate  documentation as
         part of the build




YUICONF 2009
Simple Rules



       ‣ Generate  documentation as
         part of the build
       ‣ Don't manually check
         documentation in to VCS




YUICONF 2009
Simple Rules



       ‣ Generate  documentation as
         part of the build
       ‣ Don't manually check
         documentation in to VCS
       ‣ Treat documentation
         comments like code

YUICONF 2009
‣ Treat documentation comments
 like code




YUICONF 2009
‣ Treat documentation comments
 like code


       ‣ Include   as part of reviews




YUICONF 2009
‣ Treat documentation comments
 like code


       ‣ Includeas part of reviews
       ‣ Comments are source, docs
         are compiled code




YUICONF 2009
‣ Treat documentation comments
 like code


       ‣ Include as part of reviews
       ‣ Comments are source, docs
         are compiled code
       ‣ File documentation bugs if
         docs and code are out of sync.



YUICONF 2009
TRY IT OUT




YUICONF 2009
git://github.com/saw/YUI-Doc-Example.git




YUICONF 2009
./build.sh
ant build




YUICONF 2009
./build.sh
  ant build
#!/bin/sh
 
#first do the build (just copying files)
mkdir build;
cp -r myLib/* build/;
 
# The location of your yuidoc install
yuidoc_home=/Applications/yuidoc;
 
mkdir -p doctmp/{parsertmp,docs};
mkdir myDocs;

# The location of the files to parse.   Parses
subdirectories,
parser_in="myLib";

parser_out=doctmp/parsertmp;
 
# The directory to put the html file outputted by the
generator
generator_out=doctmp/docs;
template=template
projectname='YUI Doc Demo'
version="0.0.1"
yuiversion="3.0.0" 
$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out
-o $generator_out -t $template -m 'YUI Doc Demo' -Y




 YUICONF 2009
./build.sh
  ant build
#!/bin/sh
                                                        <?xml version="1.0"?>
#first do the build (just copying files)                 
mkdir build;                                            <project name="SawLib">
cp -r myLib/* build/;                                       <property name="build_dir" location="build" /
                                                        >
# The location of your yuidoc install                       <property name="src" location="myLib" />
yuidoc_home=/Applications/yuidoc;                           <property name="projectname" value="YUI Doc
                                                        Demo" />
mkdir -p doctmp/{parsertmp,docs};                           <property name="version" value="1.0" />
mkdir myDocs;                                               <property name="project_url" value="http://
                                                        developer.yahoo.com/yui/yuidoc" />
# The location of the files to parse.   Parses              <property name="doc_dir" location="myDocs" />
subdirectories,                                             <property name="yuidoc_home" location="/
parser_in="myLib";                                      Applications/yuidoc" />
                                                            <property name="yuidoc_exec" location="$
parser_out=doctmp/parsertmp;                            {yuidoc_home}/bin/yuidoc.py" />
                                                            <property name="tmp_dir" location="doctmp" />
# The directory to put the html file outputted by the       <property name="parser_in" location="myLib" /
generator                                               >
generator_out=doctmp/docs;                                  <target name="init">
template=template                                               <echo>Making sure build dir is there</
projectname='YUI Doc Demo'                              echo>
version="0.0.1"                                                 <mkdir dir="${build_dir}" />
yuiversion="3.0.0"                                          </target>
$yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out        
-o $generator_out -t $template -m 'YUI Doc Demo' -Y




 YUICONF 2009
ant build




YUICONF 2009
CUSTOM
   TEMPLATES



YUICONF 2009
Edit the stylesheet:
 templates/assets/api.css




YUICONF 2009
Create a Custom Template
 template/main.tmpl


                      YUI Doc Demo
                      Modules
                       •   Compression                 Files
                       •   widget                       •      lzw-lite.js
                      Classes                           •      lzw.js
                       •   saw.lzw                      •      timepickerwidget.js
                       •   saw.lzw-binary              Methods

                       Class saw.lzw
                       Implements the LZW compression algoritm, outputting binary
                       using the Unicode character equivilant of the decimal codes

                       Methods
cheetahtemplate.org    encode
                       static String encode ( str )
                       Encodes the string as an LZW compressed binary stream...except
                       because we can't really use binary in javascript we are using the
                       unicode character specified by the decimal code output by the
                       algorithm in each place
                       Parameters:
                       str <String> The string to encode
                       Returns: String
                       str The encoded string



 YUICONF 2009
CUSTOM
   EVERYTHING


YUICONF 2009
Parser can be used for any Front end




               http://bit.ly/airdoc
YUICONF 2009
The YUI Doc Parser Works Alone

          parser_in="$HOME/src"
          parser_out= ~/www/docs/parser
          generator_out=~/www/docs/generator
          template=$yuidoc_home/template




YUICONF 2009
The YUI Doc Parser Works Alone

          parser_in="$HOME/src"
          parser_out= ~/www/docs/parser
          generator_out=~/www/docs/generator
          template=$yuidoc_home/template




YUICONF 2009
}
                      },


The YUI Doc Parser Works Alone
                      "file": "lzw.js",
                      "shortname": "lzw",
                      "description": "Implements the LZW compression algoritm, outputting
          nbinary using the Unicode character equivilant of thendecimal codes"

 ~/www/docs/parser/parsed.json
              },
                  }

              "version": "0.0.1",
              "namespaces": ["saw", "Y.Saw"]
          }




YUICONF 2009
The YUI Doc Parser Works Alone
 ~/www/docs/parser/parsed.json
 Complete JSON Representation of Documentation
               {
                   "majorversion": 3,
                   "filemap": {
                       "lzw-lite.js": {
                           "classlist": ["saw.lzw-binary"],
                           "name": "lzw-lite.js",
                           "module": "Compression"
                       },
                       "lzw.js": {
                           "classlist": ["saw.lzw"],
                           "name": "lzw.js",
                           "module": "Compression"
                       },
                       "timepickerwidget.js": {
                           "classlist": ["Y.Saw.Timepicker"],
                           "name": "timepickerwidget.js",
                           "module": "Compression"
                       }
                   },
                   "modules": {
                       "widget": {
                           "description": "Great widgets from saw",
                           "submodules": [],
                           "classlist": ["Y.Saw.Timepicker"],
                           "filelist": [],
                           "subdata": {},
                           "requires": "oop, event-custom, attribute, base, dom,
               classnamemanager, widget, event",
                           "name": "widget"
                       },
                       "Compression": {
                           "name": "Compression",
                           "submodules": ["lzw-binary"],
YUICONF 2009               "classlist": ["saw.lzw-binary", "saw.lzw"],
                           "filelist": ["lzw-lite.js", "lzw.js", "timepickerwidget.js"],
                           "subdata": {
And Code Highlighting too!
 ~/www/docs/parser /lzw.js.highlighted

     (function(){

         var STARTPOINT = 256;

         //create "saw" global if not there
         if(window.saw === undefined){
              window.saw = {};
         }
         /**
           * Returns a pre-popuated dictionary to begin encoding
           * @private
           * @method getDic
           * @return {Object} a hash table with ascii letters as keys
           */
         function getDic(){
              var result = {};
              for (var i=0; i < STARTPOINT; i++) {
                  var ch = String.fromCharCode(i);
                  result[ch] = i;




YUICONF 2009
Parting Tips




YUICONF 2009
Parting Tips
    ‣   Documentation is part of the build




YUICONF 2009
Parting Tips
    ‣   Documentation is part of the build
    ‣   Use ant/phing/whatever tasks to run docs




YUICONF 2009
Parting Tips
    ‣   Documentation is part of the build
    ‣   Use ant/phing/whatever tasks to run docs
    ‣   Use a documentation server




YUICONF 2009
Stephen Woods
               @ysaw
               Y!IM: stephenwoods_corp




YUICONF 2009

Contenu connexe

Tendances

"Node.js threads for I/O-bound tasks", Timur Shemsedinov
"Node.js threads for I/O-bound tasks", Timur Shemsedinov"Node.js threads for I/O-bound tasks", Timur Shemsedinov
"Node.js threads for I/O-bound tasks", Timur ShemsedinovFwdays
 
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0준비하세요 Angular js 2.0
준비하세요 Angular js 2.0Jeado Ko
 
Building High Performance Web Applications and Sites
Building High Performance Web Applications and SitesBuilding High Performance Web Applications and Sites
Building High Performance Web Applications and Sitesgoodfriday
 
Introduction to Grails Framework
Introduction to Grails FrameworkIntroduction to Grails Framework
Introduction to Grails FrameworkPT.JUG
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Jeado Ko
 
Reverse Engineering 안드로이드 학습
Reverse Engineering 안드로이드 학습Reverse Engineering 안드로이드 학습
Reverse Engineering 안드로이드 학습Sungju Jin
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & ExpressChristian Joudrey
 
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...andreaslubbe
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to NodejsGabriele Lana
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGuillaume Laforge
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101ygv2000
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node jsfakedarren
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.jsJosh Staples
 
Java script tutorial
Java script tutorialJava script tutorial
Java script tutorialDoeun KOCH
 

Tendances (20)

"Node.js threads for I/O-bound tasks", Timur Shemsedinov
"Node.js threads for I/O-bound tasks", Timur Shemsedinov"Node.js threads for I/O-bound tasks", Timur Shemsedinov
"Node.js threads for I/O-bound tasks", Timur Shemsedinov
 
준비하세요 Angular js 2.0
준비하세요 Angular js 2.0준비하세요 Angular js 2.0
준비하세요 Angular js 2.0
 
Building High Performance Web Applications and Sites
Building High Performance Web Applications and SitesBuilding High Performance Web Applications and Sites
Building High Performance Web Applications and Sites
 
Introduction to Grails Framework
Introduction to Grails FrameworkIntroduction to Grails Framework
Introduction to Grails Framework
 
JavaScript Core
JavaScript CoreJavaScript Core
JavaScript Core
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
Reverse Engineering 안드로이드 학습
Reverse Engineering 안드로이드 학습Reverse Engineering 안드로이드 학습
Reverse Engineering 안드로이드 학습
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
 
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
Beautiful code instead of callback hell using ES6 Generators, Koa, Bluebird (...
 
Introduction to Nodejs
Introduction to NodejsIntroduction to Nodejs
Introduction to Nodejs
 
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume LaforgeGroovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
Groovy and Grails in Action - Devoxx 2008 - University - Guillaume Laforge
 
JavaScript 101
JavaScript 101JavaScript 101
JavaScript 101
 
Node.js
Node.jsNode.js
Node.js
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node js
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.js
 
New Design of OneRing
New Design of OneRingNew Design of OneRing
New Design of OneRing
 
Java script tutorial
Java script tutorialJava script tutorial
Java script tutorial
 
Express node js
Express node jsExpress node js
Express node js
 

En vedette

Designer-Friendly EE
Designer-Friendly EEDesigner-Friendly EE
Designer-Friendly EEEmily Lewis
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem UnsolvedSchalk Cronjé
 
Fundamentals of Engineering Design
Fundamentals of Engineering DesignFundamentals of Engineering Design
Fundamentals of Engineering Designasuarea48
 
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...Shyamal Biswas
 
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)Sunrator Technologies LLP
 
Good documentation practice
Good documentation practiceGood documentation practice
Good documentation practicePharmaceutical
 
Power Plants & Industrial Equipment Procurement Engineering Services
Power Plants & Industrial Equipment Procurement Engineering ServicesPower Plants & Industrial Equipment Procurement Engineering Services
Power Plants & Industrial Equipment Procurement Engineering ServicesBerr Industry
 
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATION
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATIONA PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATION
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATIONSagar Anand
 

En vedette (9)

Designer-Friendly EE
Designer-Friendly EEDesigner-Friendly EE
Designer-Friendly EE
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
 
Fundamentals of Engineering Design
Fundamentals of Engineering DesignFundamentals of Engineering Design
Fundamentals of Engineering Design
 
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...
CV-1 Senior Professional - MEP Engineering, Procurement & Contracts- PM-CM Se...
 
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)
DPR (Detailed Project Report) & EPC (Engineering Procurement Construction)
 
Good documentation practice
Good documentation practiceGood documentation practice
Good documentation practice
 
dc Generator Ppt
dc Generator Pptdc Generator Ppt
dc Generator Ppt
 
Power Plants & Industrial Equipment Procurement Engineering Services
Power Plants & Industrial Equipment Procurement Engineering ServicesPower Plants & Industrial Equipment Procurement Engineering Services
Power Plants & Industrial Equipment Procurement Engineering Services
 
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATION
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATIONA PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATION
A PROJECT REPORT ON EXPORT PROCESS AND DOCUMENTATION
 

Similaire à Beautiful Documentation with YUI Doc

Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Robert Lemke
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile DevelopmentJan Rybák Benetka
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScriptMichael Girouard
 
The Beauty and the Beast
The Beauty and the BeastThe Beauty and the Beast
The Beauty and the BeastBastian Feder
 
KKBOX WWDC17 Xcode debug - Oliver
KKBOX WWDC17  Xcode debug - OliverKKBOX WWDC17  Xcode debug - Oliver
KKBOX WWDC17 Xcode debug - OliverLiyao Chen
 
Fitc whats new in es6 for web devs
Fitc   whats new in es6 for web devsFitc   whats new in es6 for web devs
Fitc whats new in es6 for web devsFITC
 
IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3Robert Lemke
 
Node.js basics
Node.js basicsNode.js basics
Node.js basicsBen Lin
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09Bastian Feder
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extremeyinonavraham
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.orgTed Husted
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe MassesHolger Schill
 
What's New in ES6 for Web Devs
What's New in ES6 for Web DevsWhat's New in ES6 for Web Devs
What's New in ES6 for Web DevsRami Sayar
 
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVMJavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVMDanHeidinga
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumMatthias Noback
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmJameel Nabbo
 
Compiler Design and Construction COSC 5353Project Instructions -
Compiler Design and Construction COSC 5353Project Instructions -Compiler Design and Construction COSC 5353Project Instructions -
Compiler Design and Construction COSC 5353Project Instructions -LynellBull52
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Christos Manios
 

Similaire à Beautiful Documentation with YUI Doc (20)

Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0Fluent Development with FLOW3 1.0
Fluent Development with FLOW3 1.0
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
Object Oriented JavaScript
Object Oriented JavaScriptObject Oriented JavaScript
Object Oriented JavaScript
 
The Beauty and the Beast
The Beauty and the BeastThe Beauty and the Beast
The Beauty and the Beast
 
KKBOX WWDC17 Xcode debug - Oliver
KKBOX WWDC17  Xcode debug - OliverKKBOX WWDC17  Xcode debug - Oliver
KKBOX WWDC17 Xcode debug - Oliver
 
appledoc_style
appledoc_styleappledoc_style
appledoc_style
 
Fitc whats new in es6 for web devs
Fitc   whats new in es6 for web devsFitc   whats new in es6 for web devs
Fitc whats new in es6 for web devs
 
IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3IPCSE12: Hands on FLOW3
IPCSE12: Hands on FLOW3
 
Node.js basics
Node.js basicsNode.js basics
Node.js basics
 
The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09The Beauty And The Beast Php N W09
The Beauty And The Beast Php N W09
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
.NET @ apache.org
 .NET @ apache.org .NET @ apache.org
.NET @ apache.org
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 
What's New in ES6 for Web Devs
What's New in ES6 for Web DevsWhat's New in ES6 for Web Devs
What's New in ES6 for Web Devs
 
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVMJavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM
JavaOne 2017: Eclipse OpenJ9: Under the hood of the JVM
 
The Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup BelgiumThe Naked Bundle - Symfony Usergroup Belgium
The Naked Bundle - Symfony Usergroup Belgium
 
Browser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholmBrowser exploitation SEC-T 2019 stockholm
Browser exploitation SEC-T 2019 stockholm
 
Python introduction
Python introductionPython introduction
Python introduction
 
Compiler Design and Construction COSC 5353Project Instructions -
Compiler Design and Construction COSC 5353Project Instructions -Compiler Design and Construction COSC 5353Project Instructions -
Compiler Design and Construction COSC 5353Project Instructions -
 
Code Documentation. That ugly thing...
Code Documentation. That ugly thing...Code Documentation. That ugly thing...
Code Documentation. That ugly thing...
 

Dernier

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Dernier (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Beautiful Documentation with YUI Doc

  • 1. Creating Beautiful Documentation with YUI Doc Stephen Woods YUICONF 2009
  • 2. /** * Frontend Engineer in Yahoo! Internal * Platform group. I write apis all day * * @module YUI Doc * @author Stephen Woods */ YUICONF 2009
  • 3. I hate writing Documentation YUICONF 2009
  • 4. I hate writing Documentation Undocumented code is worse. YUICONF 2009
  • 5. But.myCodeIsSelfDocumenting(); //and well commented YUICONF 2009
  • 6. If you are writing APIs good documentation is a requirement YUICONF 2009
  • 7. True Stories of Bad Documentation YUICONF 2009
  • 8. True Stories of Bad Documentation YUICONF 2009
  • 9. True Stories of Bad Documentation YUICONF 2009
  • 12. How do they make those wonderful Docs? YUICONF 2009
  • 13. How do they make those wonderful Docs? YUICONF 2009
  • 14. How do they make those wonderful Docs? YUICONF 2009
  • 15. How do they make those wonderful Docs? YUICONF 2009
  • 17. Write Code Start to Docs Change Code Tell People to Explain Why the Fix Bugs Read the Docs Docs are Wrong Realize you forgot to Start to fix Docs Fix More Bugs Update the docs YUICONF 2009
  • 20. Write Code Have Docs YUICONF 2009
  • 21. Write Code (MAGIC) Have Docs YUICONF 2009
  • 25. CppDoc Doxygen JavaDoc PhpDocumentor JSDoc YUI Doc YARD YUICONF 2009
  • 26. CppDoc Doxygen JavaDocDoc Generators PhpDocumentor Better Living JSDoc Through Automation YUI Doc YARD YUICONF 2009
  • 27. Doc Generators Automatically create documentation from code js YUICONF 2009
  • 28. What is YUI Doc? /** * Encodes the string as an LZW * compressed binary stream * * @method encode * @static * @param {String} str The string to encode * @return {String} The encoded string */ encode:function(str){ YUICONF 2009
  • 29. What is YUI Doc? YUICONF 2009
  • 31. YUI Doc A language-neutral way to automagically generate beautiful documentation YUICONF 2009
  • 33. using System; /** * C# Module Description * @module lang.csharp */ /** * C# Class Description * @class ReadAll C# * @namespace PlayingAround */ namespace PlayingAround { class ReadAll { /** * Main Method * @method Main * @static */ public static void Main(string[] args) { string contents = System.IO.File.ReadAllText(@"C:t1"); Console.Out.WriteLine("contents = " + contents); } } } YUICONF 2009
  • 34. /** * Test Java Module Description * @module lang.javatest */ import java.util.*; /** * This is the class description for this Java Class * @class Test * @namespace Java Java * @constructor */ public class Test { /** * x property * @property x * @type {Double} */ private double x; /** * y property * @property y * @type {Double} */ private double y; } YUICONF 2009
  • 35. #!/usr/bin/env python ''' /** * Test Python File * @module testpy */ ''' import os, sys, string, shutil, urllib2, urllib, pprint, simplejson, datetime from cStringIO import StringIO from subprocess import call, PIPE, Popen Python ''' /** * This is a test class * @class TestPy * @namespace Python */ ''' ''' /** * Test Method * @method test */ ''' def test(): pass YUICONF 2009
  • 36. =begin /** * Module Info for test Ruby File * @module lang.rubytest */ =end require 'rubygems' require 'grit' require 'optparse' require 'logger' require 'fileutils' Ruby module RubyTest =begin /** * Class Information * @class test * @namespace Ruby */ =end class Test =begin /** * Execute desc * @method execute */ =end def self.execute #foo end YUICONF 2009
  • 37. /** * This method syncs the value of time object, * including building the strings for 12hr and 24hr * also fires a 'timechange' event * @method _syncTime * @protected * */ _syncTime:function(){ JavaScript var time = this.get('time'), ampm = time.ampm, strings = this.get('strings'), seperator = this.get('strings.seperator'), minute = pad(time.minute); //build the string for ampm based on the strings ampmString = (ampm == AM) ? this.get(AMSTR_KEY) : this.get(PMSTR_KEY); //store the string representation of the 12 hour time this.set('time.s12hour', ((time.hour == 0) ? 12 : time.hour) + seperator + minute + ampmString); YUICONF 2009
  • 39. language-neutral ‣ Primarily generated from special comment blocks YUICONF 2009
  • 40. language-neutral ‣ Primarily generated from special comment blocks ‣ Can work with any language YUICONF 2009
  • 41. language-neutral ‣ Primarily generated from special comment blocks ‣ Can work with any language ‣ Lets you describe code however makes sense YUICONF 2009
  • 43. language-neutral ‣ Will fall out of sync YUICONF 2009
  • 44. language-neutral ‣ Will fall out of sync ‣ There will be copy/paste errors YUICONF 2009
  • 45. language-neutral ‣ Will fall out of sync ‣ There will be copy/paste errors ‣ Type mismatches will happen YUICONF 2009
  • 46. YUI Doc A language-neutral way to automagically generate Beautiful Documentation YUICONF 2009
  • 48. Beautiful Documentation ‣ Accurate YUICONF 2009
  • 49. Beautiful Documentation ‣ Accurate ‣ Complete YUICONF 2009
  • 50. Beautiful Documentation ‣ Accurate ‣ Complete ‣ Useable YUICONF 2009
  • 51. Beautiful Documentation ‣ Accurate ‣ Complete ‣ Useable ‣ Understandable YUICONF 2009
  • 52. USING YUI DOC YUICONF 2009
  • 53. Sample Project My Project compression lzw.js lzw-lite.js widgets timepickerwidget.js http://bit.ly/samplebuild YUICONF 2009
  • 55. Project Structure Project Module Module ~/LZW ~/Timepicker Class Class Class LZW LZW-Lite Timepicker YUICONF 2009
  • 57. Comment Blocks /** * Description * @tag tagValue * @secondaryTag secondaryValue */ YUICONF 2009
  • 58. Primary Tags ‣ @module ‣ @class ‣ @property ‣ @event ‣ @method YUICONF 2009
  • 59. Secondary Tags ‣ @submodule ‣ @extends ‣ @namespace ‣ @config *YUI Specific YUICONF 2009
  • 60. @param & @return Datatypes! @param {type} name description @return {type} description YUICONF 2009
  • 61. Object {} Array String @param Boolean Name Description Number Mixed MyType YUICONF 2009
  • 63. @module /** * A javascript file compression library * @module Compression * @requires node, event */ /** * Provides LZW compression * @module Compression * @submodule Compression-LZW */ YUICONF 2009
  • 65. @class /** * A YUI timepicker widget * * @class Timepicker * @constructor * @namespace Y.Saw * @extends Widget */ YUI.add('timepicker', function(Y){ YUICONF 2009
  • 67. @event /** * Fires when a new day begins * * @event dawn * @param {String} color * @param {Number} duration */ YUICONF 2009
  • 69. @property /** * Symbol for AM * @property AM * @type String */ YUICONF 2009
  • 71. @property + @attribute /** * @property Timepicker.ATTRS * @type Object * @protected * @static */ Timepicker.ATTRS = { /** * The selected time * @attribute time * @type Object * @default {hour:0, minute:0, ampm:'AM'} */ YUICONF 2009
  • 73. @method /** * Utility method that returns the size * of a unicode string in bytes * @method strSize * @param {String}str The string to evaluate * @return {Number} the length of the * string in bytes */ strSize:function(str){ YUICONF 2009
  • 75. BUILDING DOCS YUICONF 2009
  • 78. > yuidoc.py myLib -p doctmp/parsertmp -o doctmp/tocs -t template -m 'YUI Doc Demo' -Y "3.0.0b1" -v "0.0.1" YUICONF 2009
  • 79. example.sh parser_in="$HOME/src" parser_out=~/www/docs/parser generator_out=~/www/docs/generator template=$yuidoc_home/template YUICONF 2009
  • 80. yourbuild.sh parser_in="$HOME/src" parser_out=~/www/docs/parser generator_out=~/www/docs/generator template=yourtemplate projectname='YUI Doc Demo' version='1.0.0' yuiversion='3.0.0' url='http://your.project.url -t $template -m $projectname -Y $yuiversion -v $version -u $url YUICONF 2009
  • 81. Slide Title Slide Content     <target name="doc">         <mkdir dir="${tmp_dir}" />         <mkdir dir="${tmp_dir}/parsertmp" />                           <property name="parser_out" location="${tmp_dir}/parsertmp" />         <property name="generator_out" location="${doc_dir}" />         <property name="template" location="template" />         <property name="yuiversion" location="3.0.0" />              <echo>generating documentation</echo>                  <exec executable="${yuidoc_exec}">           <arg value="${parser_in}"/>           <arg value="-p"/>           <arg value="${parser_out}"/>           <arg value="-o" />           <arg value="${generator_out}" />           <arg value="-t" />           <arg value="${template}" /> YUICONF 2009
  • 83. .git Watch out for: .cvs .svn YUICONF 2009
  • 84. KEEPING DOCS RELEVANT YUICONF 2009
  • 86. Simple Rules ‣ Generate documentation as part of the build YUICONF 2009
  • 87. Simple Rules ‣ Generate documentation as part of the build ‣ Don't manually check documentation in to VCS YUICONF 2009
  • 88. Simple Rules ‣ Generate documentation as part of the build ‣ Don't manually check documentation in to VCS ‣ Treat documentation comments like code YUICONF 2009
  • 89. ‣ Treat documentation comments like code YUICONF 2009
  • 90. ‣ Treat documentation comments like code ‣ Include as part of reviews YUICONF 2009
  • 91. ‣ Treat documentation comments like code ‣ Includeas part of reviews ‣ Comments are source, docs are compiled code YUICONF 2009
  • 92. ‣ Treat documentation comments like code ‣ Include as part of reviews ‣ Comments are source, docs are compiled code ‣ File documentation bugs if docs and code are out of sync. YUICONF 2009
  • 96. ./build.sh ant build #!/bin/sh   #first do the build (just copying files) mkdir build; cp -r myLib/* build/;   # The location of your yuidoc install yuidoc_home=/Applications/yuidoc;   mkdir -p doctmp/{parsertmp,docs}; mkdir myDocs; # The location of the files to parse. Parses subdirectories, parser_in="myLib"; parser_out=doctmp/parsertmp;   # The directory to put the html file outputted by the generator generator_out=doctmp/docs; template=template projectname='YUI Doc Demo' version="0.0.1" yuiversion="3.0.0"  $yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out -o $generator_out -t $template -m 'YUI Doc Demo' -Y YUICONF 2009
  • 97. ./build.sh ant build #!/bin/sh   <?xml version="1.0"?> #first do the build (just copying files)   mkdir build; <project name="SawLib"> cp -r myLib/* build/;     <property name="build_dir" location="build" /   > # The location of your yuidoc install     <property name="src" location="myLib" /> yuidoc_home=/Applications/yuidoc;     <property name="projectname" value="YUI Doc   Demo" /> mkdir -p doctmp/{parsertmp,docs};     <property name="version" value="1.0" /> mkdir myDocs;     <property name="project_url" value="http:// developer.yahoo.com/yui/yuidoc" /> # The location of the files to parse. Parses     <property name="doc_dir" location="myDocs" /> subdirectories,     <property name="yuidoc_home" location="/ parser_in="myLib"; Applications/yuidoc" />     <property name="yuidoc_exec" location="$ parser_out=doctmp/parsertmp; {yuidoc_home}/bin/yuidoc.py" />       <property name="tmp_dir" location="doctmp" /> # The directory to put the html file outputted by the     <property name="parser_in" location="myLib" / generator > generator_out=doctmp/docs;     <target name="init"> template=template         <echo>Making sure build dir is there</ projectname='YUI Doc Demo' echo> version="0.0.1"         <mkdir dir="${build_dir}" /> yuiversion="3.0.0"      </target> $yuidoc_home/bin/yuidoc.py $parser_in -p $parser_out      -o $generator_out -t $template -m 'YUI Doc Demo' -Y YUICONF 2009
  • 99. CUSTOM TEMPLATES YUICONF 2009
  • 100. Edit the stylesheet: templates/assets/api.css YUICONF 2009
  • 101. Create a Custom Template template/main.tmpl YUI Doc Demo Modules • Compression Files • widget • lzw-lite.js Classes • lzw.js • saw.lzw • timepickerwidget.js • saw.lzw-binary Methods Class saw.lzw Implements the LZW compression algoritm, outputting binary using the Unicode character equivilant of the decimal codes Methods cheetahtemplate.org encode static String encode ( str ) Encodes the string as an LZW compressed binary stream...except because we can't really use binary in javascript we are using the unicode character specified by the decimal code output by the algorithm in each place Parameters: str <String> The string to encode Returns: String str The encoded string YUICONF 2009
  • 102. CUSTOM EVERYTHING YUICONF 2009
  • 103. Parser can be used for any Front end http://bit.ly/airdoc YUICONF 2009
  • 104. The YUI Doc Parser Works Alone parser_in="$HOME/src" parser_out= ~/www/docs/parser generator_out=~/www/docs/generator template=$yuidoc_home/template YUICONF 2009
  • 105. The YUI Doc Parser Works Alone parser_in="$HOME/src" parser_out= ~/www/docs/parser generator_out=~/www/docs/generator template=$yuidoc_home/template YUICONF 2009
  • 106. } }, The YUI Doc Parser Works Alone "file": "lzw.js", "shortname": "lzw", "description": "Implements the LZW compression algoritm, outputting nbinary using the Unicode character equivilant of thendecimal codes" ~/www/docs/parser/parsed.json }, } "version": "0.0.1", "namespaces": ["saw", "Y.Saw"] } YUICONF 2009
  • 107. The YUI Doc Parser Works Alone ~/www/docs/parser/parsed.json Complete JSON Representation of Documentation { "majorversion": 3, "filemap": { "lzw-lite.js": { "classlist": ["saw.lzw-binary"], "name": "lzw-lite.js", "module": "Compression" }, "lzw.js": { "classlist": ["saw.lzw"], "name": "lzw.js", "module": "Compression" }, "timepickerwidget.js": { "classlist": ["Y.Saw.Timepicker"], "name": "timepickerwidget.js", "module": "Compression" } }, "modules": { "widget": { "description": "Great widgets from saw", "submodules": [], "classlist": ["Y.Saw.Timepicker"], "filelist": [], "subdata": {}, "requires": "oop, event-custom, attribute, base, dom, classnamemanager, widget, event", "name": "widget" }, "Compression": { "name": "Compression", "submodules": ["lzw-binary"], YUICONF 2009 "classlist": ["saw.lzw-binary", "saw.lzw"], "filelist": ["lzw-lite.js", "lzw.js", "timepickerwidget.js"], "subdata": {
  • 108. And Code Highlighting too! ~/www/docs/parser /lzw.js.highlighted (function(){ var STARTPOINT = 256; //create "saw" global if not there if(window.saw === undefined){ window.saw = {}; } /** * Returns a pre-popuated dictionary to begin encoding * @private * @method getDic * @return {Object} a hash table with ascii letters as keys */ function getDic(){ var result = {}; for (var i=0; i < STARTPOINT; i++) { var ch = String.fromCharCode(i); result[ch] = i; YUICONF 2009
  • 110. Parting Tips ‣ Documentation is part of the build YUICONF 2009
  • 111. Parting Tips ‣ Documentation is part of the build ‣ Use ant/phing/whatever tasks to run docs YUICONF 2009
  • 112. Parting Tips ‣ Documentation is part of the build ‣ Use ant/phing/whatever tasks to run docs ‣ Use a documentation server YUICONF 2009
  • 113. Stephen Woods @ysaw Y!IM: stephenwoods_corp YUICONF 2009

Notes de l'éditeur

  1. This talk is for anyone that writes apis other developers need to rely on YOU might be that other developer there is a lot to cover, this is an overview, check the website for examples
  2. most people do but I hate undocumented code! most people do
  3. That&apos;s fine if is regular code but if its an api..
  4. No one will read your code if you provide an api, thats the point of an api
  5. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  6. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  7. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  8. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  9. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  10. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  11. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  12. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  13. These are from real im conversations I found in my archive If &quot;goodness&quot; doesn&apos;t work why not self preservation? Good docs save you time
  14. Almost every api you encounter has amazingly complete api documentation. Like Ruby on Rails
  15. Almost every api you encounter has amazingly complete api documentation. Like Ruby on Rails
  16. Like windows
  17. and of course YUI How do they do that?
  18. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  19. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  20. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  21. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  22. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  23. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  24. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  25. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  26. Documentation writing usually goes something like this People try all types of solutions to this issue, policy, templates, rules
  27. But Ideally the process goes like this
  28. But Ideally the process goes like this
  29. But Ideally the process goes like this
  30. But Ideally the process goes like this
  31. but the only way to make sure that you have docs is to automate it
  32. but the only way to make sure that you have docs is to automate it
  33. but the only way to make sure that you have docs is to automate it
  34. but the only way to make sure that you have docs is to automate it
  35. There are varying degrees of smartness Some really read the code (doxygen, phpdocumentor) and will kind of work with no comments
  36. YUI doesn&apos;t read the code takes comment blocks turns it into pretty documentation
  37. YUI doesn&apos;t read the code takes comment blocks turns it into pretty documentation
  38. language neutral, generated (mostly) from comment blocks works with any language lets you describe the code however makes sense...in other words supports all those strange idioms in javascript
  39. language neutral, generated (mostly) from comment blocks works with any language lets you describe the code however makes sense...in other words supports all those strange idioms in javascript
  40. language neutral, generated (mostly) from comment blocks works with any language lets you describe the code however makes sense...in other words supports all those strange idioms in javascript
  41. Downsides
  42. Downsides
  43. Downsides
  44. Beautiful documentation is like beautiful code, it is efficient and elegant. Its most important traits accuracy, docs should match the api complete: no one likes an undocumented feature useable: users are developers, if they can&apos;t find the docs, they might as well not exist understandable: the docs should actually make sense. Sadly this can&apos;t be automated
  45. Beautiful documentation is like beautiful code, it is efficient and elegant. Its most important traits accuracy, docs should match the api complete: no one likes an undocumented feature useable: users are developers, if they can&apos;t find the docs, they might as well not exist understandable: the docs should actually make sense. Sadly this can&apos;t be automated
  46. Beautiful documentation is like beautiful code, it is efficient and elegant. Its most important traits accuracy, docs should match the api complete: no one likes an undocumented feature useable: users are developers, if they can&apos;t find the docs, they might as well not exist understandable: the docs should actually make sense. Sadly this can&apos;t be automated
  47. Beautiful documentation is like beautiful code, it is efficient and elegant. Its most important traits accuracy, docs should match the api complete: no one likes an undocumented feature useable: users are developers, if they can&apos;t find the docs, they might as well not exist understandable: the docs should actually make sense. Sadly this can&apos;t be automated
  48. Comments describe whats going on each block can have ONLY one tag and as many secondaryTags as you like
  49. I&apos;m only going to talk about @return and @param, but there is a lot of flexibility here
  50. These are data types for javascript, anything you want will work of course but consistency is a good policy
  51. module is a submodule of a parent module. YUI 3.x anim-scroll is a submodule of anim. A submodule encompasses a subset of the parent module&apos;s functionality.
  52. module is a submodule of a parent module. YUI 3.x anim-scroll is a submodule of anim. A submodule encompasses a subset of the parent module&apos;s functionality.
  53. Basic unit of functionality, generally its a javascript object
  54. module is a submodule of a parent module. YUI 3.x anim-scroll is a submodule of anim. A submodule encompasses a subset of the parent module&apos;s functionality.
  55. Events are fundemental to js, and need documenting, remember events don&apos;t necessarily get defined, just fired. I tend to create parts of a file, or a whole seperate file that contains events
  56. this is what we are documenting
  57. this is what we are documenting
  58. this is what we are documenting
  59. this is what we are documenting
  60. Attribute is really only applicable if you are using the attribute provider or YUI 3 attribute, like in widget
  61. Method docs are the meat of api docs these must be complete and good data types are really important
  62. Lots of command line options here don&apos;t stress, write a build script! if you are confused try -h
  63. A simple build script just an example your project won&apos;t work
  64. A simple build script just an example your project won&apos;t work