Slides from my speech that I did internally at Locaweb and now in a German Conf supported by Infopark.
http://www.infopark.com/en/events/cloud-developer-camp/munich
14. Documentation?
Documentation a set of documents
provided on paper, or online, or on digital or
analog media
Document?
Document from Latin documentum
"example, proof, lesson," in M.L. "official
written instrument" any means, especially
graphic, proving the existence of a fact, the
accuracy or truth of a statement etc..
49. Responding to change
over following a plan
Individuals and interactions
over processes and tools
Working software over
Customer collaboration over
contract negotiation
write any kind of documentation
50. Responding to change
over following a plan
Individuals and interactions
over processes and tools
Working software over
Customer collaboration over
contract negotiation
write any kind of documentation
51. Responding to change
over following a plan
Individuals and interactions
over processes and tools
Working software over
Customer collaboration over
contract negotiation
write any kind of documentationcomprehensive documentation
83. Programs are read much more often
than written and therefore should
communicate clearly their intent.
Code is primarily means of
communication.
(For a typical enterprise system, a lot of
code will be modified by many
programmers over 5 – 15 years and
they’ll all need to understand it.)
Communication
86. - Describe the behaviour (method or class).
ELEMENTS
of a
GOOD Doc
87. - Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
ELEMENTS
of a
GOOD Doc
88. - Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
- The first sentence should summarize the method/class
ELEMENTS
of a
GOOD Doc
89. - Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
- The first sentence should summarize the method/class
- Use note (@note) to say something the user
should know about it.
ELEMENTS
of a
GOOD Doc
90. - Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
- The first sentence should summarize the method/class
- Use note (@note) to say something the user
should know about it.
- References (classes, methods, URLs, @see).
ELEMENTS
of a
GOOD Doc
91. - List of Parameters and expected returns types.
- Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
- The first sentence should summarize the method/class
- Use note (@note) to say something the user
should know about it.
- References (classes, methods, URLs, @see).
ELEMENTS
of a
GOOD Doc
100. Write Docs
for a Method
Write a
Method
Validate Code
with Docs
Write Docs
for a Method
Write a
Method
Validate Code
with Docs
101.
102. class OS
# Returns a list of String and
# numbers displaying CPU information
# of an OS: the CPU type, architecture, vendor
# clock speed (as integer), temperature (as
# integer) and voltage (as integer)
def processor_info
[ cpu_type, cpu_arch, cpu_vendor, cpu_clock,
cpu_temp, cpu_voltage ]
end
end
105. class OS
# @return [Array(String, String, String, Integer, Integer, Integer)]
# CPU type, architecture, vendor, clock speed, temp and voltage of an OS
def processor_info
[ cpu_type, cpu_arch, cpu_vendor, cpu_clock,
cpu_temp, cpu_voltage ]
end
end
112. class OS
# @return [Hash{Symbol=>[String, Integer]}]
# processor info filled into fields :cpu_type, :cpu_arch, :cpu_vendor,
# :cpu_clock (Integer), :cpu_temp (Integer), :cpu_voltage (Integer)
# representing proc values of a CPU
def processor_info
{ :cpu_type => cpu_type,
:cpu_arch => cpu_arch,
:cpu_vendor => cpu_vendor,
:cpu_clock => cpu_clock,
:cpu_temp => cpu_temp,
:cpu_voltage => cpu_voltage }
end
end
113. class ProcessorInfo
# @return [String] CPU type (AMD, Intel, ...)
attr_accessor :cpu_type
# @return [String] CPU Architeture (x86,ARM)
attr_accessor :cpu_arch
# @return [String] CPU speed in hz (3.4.ghz = 3400)
attr_accessor :cpu_clock
end
class OS
# @return [ProcessorInfo] proc info of current OS
def processor_info
ProcessorInfo.new.tap do |p|
p.cpu_type, p.cpu_arch, p.cpu_ clock = cpu_type, cpu_arch, cpu_clock
end
end
end
119. References
Loren Segal - Just Say No To :nodoc: and DocumentYour Code!
http://www.youtube.com/watch?v=tCw7CpRvYOE
Maurício Aniche at QCon SP (2012):
Métodos ágeis: o que é folclore e o que é real?
Krzysztof, Stig, and Jakub - Programming like Kent Beck
http://blog.iterate.no/2012/06/20/programming-like-kent-beck/
Tom Preston-Werner
http://tom.preston-werner.com/2010/08/23/readme-driven-development.html
Jef Raskin
Comments are More Important than Code
Images collected from Google Images®