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

EuRuKo 2015: One Inch at a Time - How to get People excited about Inline Docs

EuRuKo 2015: One Inch at a Time - How to get People excited about Inline Docs

René Föhring

October 17, 2015
Tweet

More Decks by René Föhring

Other Decks in Programming

Transcript

  1. How to get people excited about inline docs. One Inch

    at a Time René Föhring // @rrrene inch-ci.org
  2. How to get people excited about inline docs. One Inch

    at a Time René Föhring // @rrrene inch-ci.org
  3. # Returns the size of a given +filename_or_blob+. # #

    size(filename) # => 4096 # def size(filename_or_blob, mode = nil) end
  4. # Returns the size of a given +filename_or_blob+. # #

    size(filename) # => 4096 # def size(filename_or_blob, mode = nil) end free-form
  5. # Detects the size of the blob. # # size(filename)

    # => 4096 # # Params: # +filename_or_blob+:: String filename or blob # +mode+:: Optional mode (defaults to nil) def size(filename_or_blob, mode = nil) end RDoc
  6. # Detects the size of the blob. # # @example

    # size(filename) # => 4096 # # @param filename_or_blob [String] the filename # @param mode [String, nil] optional mode # @return [Fixnum,nil] def size(filename_or_blob, mode = nil) end YARD
  7. # Public: Detects the size of the blob. # #

    filename_or_blob – filename or blob # mode - Optional mode (defaults to nil) # # Examples # # size(filename) # => 4096 # # Returns Fixnum or nil. def size(filename_or_blob, mode = nil) end TomDoc
  8. „good code is its own documentation“ (myself ten years ago)

    versus „people are not Ruby parsers“ (Zach Holman)
  9. it is more important to document … public methods than

    private ones methods with many parameters
  10. it is more important to document … public methods than

    private ones methods with many parameters modules containing methods
  11. it is more important to document … public methods than

    private ones methods with many parameters modules containing methods ...
  12. # These rules provide priorities for all # code objects.

    CODE_OBJECTS = %w( classes modules constants methods parameters ) # ... which are also assigned a score. SCORES = (0..100)
  13. # Called by the `initech` gem. # # @return [void]

    def user_registered(username, _) end Score: ? Priority: ?
  14. # Called by the `initech` gem. # # @return [void]

    def user_registered(username, _) end Score: 90/100 Priority:
  15. # Called by the `initech` gem. # # @return [void]

    def user_registered(username, _) end Score: 90/100 Priority:
  16. # Called by the `initech` gem. # # @return [void]

    def user_registered(username, _) end Grade: A Priority:
  17. >> GradeList.all A – Really good B – Proper documentation

    found C – Please take a look U – Undocumented (not a bad thing)
  18. # Properly documented, could be improved: ┃ 50 4 Foo#initialize

    ┃ 50 4 Foo::Bar # Please take a look: ┃ 37 4 Foo::API#initialize ┃ 25 2 Foo::CodeObject#initialize # Undocumented: ┃ 0 4 Foo::CLI ┃ 0 4 Foo::API#send_request
  19. # Properly documented, could be improved: ┃ B ↑ Foo#initialize

    ┃ B ↑ Foo::Bar # Please take a look: ┃ C ↑ Foo::API#initialize ┃ C ↗ Foo::CodeObject#initialize # Undocumented: ┃ U ↑ Foo::CLI ┃ U ↑ Foo::API#send_request
  20. How to get people excited about inline docs. One Inch

    at a Time inch-ci.org René Föhring // @rrrene