why you should document your code
TRANSCRIPT
![Page 2: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/2.jpg)
![Page 3: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/3.jpg)
DOCUMENTATION
![Page 4: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/4.jpg)
![Page 5: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/5.jpg)
![Page 6: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/6.jpg)
![Page 7: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/7.jpg)
![Page 8: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/8.jpg)
![Page 9: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/9.jpg)
![Page 10: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/10.jpg)
![Page 11: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/11.jpg)
Let’s start since the beginning....
![Page 12: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/12.jpg)
![Page 13: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/13.jpg)
Documentation? Documentation a set of documents provided on paper, or online, or on digital or analog media
![Page 14: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/14.jpg)
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..
![Page 15: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/15.jpg)
![Page 16: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/16.jpg)
![Page 17: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/17.jpg)
![Page 18: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/18.jpg)
![Page 19: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/19.jpg)
![Page 20: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/20.jpg)
![Page 21: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/21.jpg)
![Page 22: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/22.jpg)
![Page 23: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/23.jpg)
![Page 24: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/24.jpg)
CRY!!!
![Page 25: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/25.jpg)
Leonardo@shivamib
![Page 26: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/26.jpg)
Loren Segal@lsegal
http://yardoc.org/
![Page 27: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/27.jpg)
Legacy 2.0?
![Page 28: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/28.jpg)
What is aLegacy?
![Page 29: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/29.jpg)
Why nobody likes to work with
Legacy CODE?
![Page 30: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/30.jpg)
Is it HARD?
![Page 31: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/31.jpg)
Is it complex?
![Page 32: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/32.jpg)
Is it complex?
![Page 33: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/33.jpg)
Makes no sense?
![Page 34: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/34.jpg)
CAOS?
![Page 35: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/35.jpg)
.... Ahh ok, did I say does NOT
haveDocumentation?
![Page 36: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/36.jpg)
![Page 37: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/37.jpg)
![Page 38: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/38.jpg)
![Page 39: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/39.jpg)
![Page 40: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/40.jpg)
![Page 41: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/41.jpg)
![Page 42: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/42.jpg)
Agile
Methods
![Page 43: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/43.jpg)
![Page 44: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/44.jpg)
![Page 45: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/45.jpg)
![Page 46: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/46.jpg)
![Page 47: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/47.jpg)
![Page 48: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/48.jpg)
All inspired by the Agile values...
![Page 49: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/49.jpg)
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
![Page 50: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/50.jpg)
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
![Page 51: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/51.jpg)
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
![Page 52: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/52.jpg)
...everyone pay Attention!
When the class is good....
![Page 53: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/53.jpg)
When the class is good....
![Page 54: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/54.jpg)
README DRIVEN DEVELOPMENT
![Page 55: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/55.jpg)
WriteME DRIVEN DEVELOPMENT
![Page 56: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/56.jpg)
![Page 57: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/57.jpg)
![Page 58: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/58.jpg)
![Page 59: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/59.jpg)
![Page 60: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/60.jpg)
![Page 61: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/61.jpg)
![Page 62: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/62.jpg)
![Page 63: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/63.jpg)
CRY!!!
![Page 64: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/64.jpg)
Overhead of thoughts
![Page 65: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/65.jpg)
Motivation
![Page 66: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/66.jpg)
Hands On
![Page 67: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/67.jpg)
Write it
![Page 68: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/68.jpg)
It’s your guide
![Page 69: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/69.jpg)
![Page 70: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/70.jpg)
CODE DOCUMENTATION
![Page 71: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/71.jpg)
Contract
![Page 72: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/72.jpg)
Contract
![Page 73: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/73.jpg)
![Page 74: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/74.jpg)
![Page 75: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/75.jpg)
![Page 76: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/76.jpg)
![Page 77: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/77.jpg)
![Page 78: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/78.jpg)
![Page 79: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/79.jpg)
![Page 80: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/80.jpg)
![Page 81: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/81.jpg)
Kent Beck
![Page 82: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/82.jpg)
Kent Beck• Communication• Simplicity• Flexibility
![Page 83: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/83.jpg)
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
![Page 84: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/84.jpg)
![Page 85: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/85.jpg)
ELEMENTS of a
GOOD Doc
![Page 86: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/86.jpg)
- Describe the behaviour (method or class).
ELEMENTS of a
GOOD Doc
![Page 87: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/87.jpg)
- Describe the behaviour (method or class).
- Avoid the first person ('We', 'I', 'You' is okay?!).
ELEMENTS of a
GOOD Doc
![Page 88: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/88.jpg)
- 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
![Page 89: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/89.jpg)
- 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
![Page 90: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/90.jpg)
- 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
![Page 91: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/91.jpg)
- 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
![Page 92: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/92.jpg)
![Page 93: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/93.jpg)
does not tell youA viarable the all history....name
![Page 94: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/94.jpg)
def find(name)
does not tell youA viarable the all history....name
![Page 95: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/95.jpg)
def find(name)
String? “John”
does not tell youA viarable the all history....name
![Page 96: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/96.jpg)
def find(name)
String? “John”
Symbol? :John
does not tell youA viarable the all history....name
![Page 97: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/97.jpg)
def find(name)
String? “John”
Hash? { :first => “John”, :last => “Lennon” }Symbol? :John
does not tell youA viarable the all history....name
![Page 98: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/98.jpg)
ocumentation rivenevelopment
DDD
![Page 99: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/99.jpg)
Write Docs for a Method
Write a Method
Validate Codewith Docs
![Page 100: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/100.jpg)
Write Docs for a Method
Write a Method
Validate Codewith Docs
Write Docs for a Method
Write a Method
Validate Codewith Docs
![Page 101: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/101.jpg)
![Page 102: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/102.jpg)
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
![Page 103: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/103.jpg)
Yardhttp://yardoc.org/
![Page 104: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/104.jpg)
![Page 105: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/105.jpg)
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
![Page 106: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/106.jpg)
![Page 107: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/107.jpg)
Hash?
![Page 108: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/108.jpg)
class OS 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
Hash?
![Page 109: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/109.jpg)
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
![Page 110: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/110.jpg)
STOP
![Page 111: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/111.jpg)
![Page 112: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/112.jpg)
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
![Page 113: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/113.jpg)
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
![Page 114: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/114.jpg)
Why should you
document your code?
![Page 115: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/115.jpg)
- Contribute with your code; - Improve your experience;- Think about you and the next;
![Page 116: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/116.jpg)
Does it make
sense?
![Page 117: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/117.jpg)
because is like Bad Sex...
![Page 118: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/118.jpg)
because is like Bad Sex...
...still being better than nothing....
![Page 119: Why you should document your code](https://reader034.vdocuments.us/reader034/viewer/2022052700/55b7c39bbb61eb0d068b461d/html5/thumbnails/119.jpg)
ReferencesLoren Segal - Just Say No To :nodoc: and Document Your 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 Beckhttp://blog.iterate.no/2012/06/20/programming-like-kent-beck/
Tom Preston-Wernerhttp://tom.preston-werner.com/2010/08/23/readme-driven-development.html
Jef RaskinComments are More Important than Code
Images collected from Google Images®