├── abstract.txt ├── keynote └── WritingSolidRubyCode.key └── src ├── html ├── index_cyclo.html ├── memcpy.rb_cyclo.html └── treachery.rb_cyclo.html ├── memcpy.rb └── treachery.rb /abstract.txt: -------------------------------------------------------------------------------- 1 | Title: Writing Solid Ruby Code 2 | 3 | Abstract 4 | -------- 5 | 6 | Do you always seem to be fixing bugs in your software project? Are you spending more time fixing defects that actually implementing new behavior? If so, this talk is for you. 7 | 8 | In the mid-90s, Steve Maquire wrote a book that strongly effected the way I developed software. Primarily writing in C and C++ in those years, the struggle to deliver bug free software was especially a challenge. In the book "Writing Solid Code", Steve gives sage advice on the problems of developing large software projects and the challenges that go with making sure your software actual does what you think it should. 9 | 10 | Although as Ruby developers we are no longer using C to deliver our large projects, the challenge of writing solid, reliable code is still before us. Based on Maquire's advice and my own years of Ruby experience, this talk will show developers tools, techniques and practices that they can use to improve their software and begin writing solid code. 11 | 12 | Motivation 13 | ---------- 14 | 15 | I recently inherited a project where reliability is a strong requirement of the system. I'm sure other Ruby developers struggle with the same issues and revisiting Maquire's advice in "Writing Solid Code" (updated for Ruby development and a post-TDD world) is a good start in reaching the goal of more reliable systems. 16 | 17 | RubyConf talk proposal reference number: ba74221794c42920cfc5426d6bc4310b 18 | -------------------------------------------------------------------------------- /keynote/WritingSolidRubyCode.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jimweirich/presentation_writing_solid_ruby_code/ea23cb5c5415b39309bd3d127d4b7f265bb8364e/keynote/WritingSolidRubyCode.key -------------------------------------------------------------------------------- /src/html/index_cyclo.html: -------------------------------------------------------------------------------- 1 | Index for cyclomatic complexity 2 | 72 | 73 | 74 |

Index for cyclomatic complexity

75 |

Errors and Warnings

76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
ClassMethodComplexity
logical_system_status10
Exampledisplay_status10
84 |
85 |

Analyzed Files

86 | 94 | 95 | -------------------------------------------------------------------------------- /src/html/memcpy.rb_cyclo.html: -------------------------------------------------------------------------------- 1 | Cyclometric Complexity 2 | 72 | 73 |
74 |

Global :

75 |
Total Complexity: 12
76 |
Total Lines: 31
77 | 78 | 79 | 80 |
MethodComplexity# Lines
logical_system_status1017
81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /src/html/treachery.rb_cyclo.html: -------------------------------------------------------------------------------- 1 | Cyclometric Complexity 2 | 72 | 73 |
74 |

Class : Example

75 |
Total Complexity: 10
76 |
Total Lines: 19
77 | 78 | 79 | 80 |
MethodComplexity# Lines
display_status1017
81 |
82 | 83 | 84 | -------------------------------------------------------------------------------- /src/memcpy.rb: -------------------------------------------------------------------------------- 1 | def memcpy(to, from, size) 2 | 3 | 4 | i = 0 5 | while i < size 6 | to[i] = from[i] 7 | i += 1 8 | end 9 | end 10 | 11 | void *memcpy(void *pvTo, void *pvFrom, size_t size) 12 | { 13 | byte * pbTo = (byte *)pvTo; 14 | byte * pbFrom = (byte *)pvFrom; 15 | 16 | ASSERT(pvTo != NULL && pvFrom != NULL); 17 | ASSERT(pbTo >= pbFrom+size || pbFrom >= pbTo+size); 18 | 19 | while (size-- > 0) 20 | *pbTo++ = *pbFrom++; 21 | 22 | return (pvTo); 23 | } 24 | 25 | 26 | def show 27 | @stuff = Stuff.find(params[:id]) 28 | end 29 | 30 | 31 | 32 | def logical_system_status 33 | case mode 34 | when "OFF" 35 | (code == "V1") ? :off : 36 | (code == "V2" || code == "V3" || code == "V4") ? :off : 37 | :invalid 38 | when "ON" 39 | (code == "V5" || code == "V7" || code == "V8" || code == "V1") ? :on : 40 | (code == "V9" || code == "V10" || code == "V11") ? :running : 41 | :invalid 42 | when "STANDBY" 43 | (code == "V5" || code == "V7" || code == "V8" || code == "V1") ? :standby : 44 | (code == "V9" || code == "V10" || code == "V12") ? :idle : 45 | :invalid 46 | else 47 | :invalid 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /src/treachery.rb: -------------------------------------------------------------------------------- 1 | class Example 2 | def display_status 3 | case mode 4 | when "OFF" 5 | (code == "V1") ? :off : 6 | (code == "V2" || code == "V3" || code == "V4") ? :off : 7 | :invalid 8 | when "ON" 9 | (code == "V5" || code == "V7" || code == "V8" || code == "V1") ? :on : 10 | (code == "V9" || code == "V10" || code == "V11") ? :running : 11 | :invalid 12 | when "STANDBY" 13 | (code == "V5" || code == "V7" || code == "V8" || code == "V1") ? :standby : 14 | (code == "V9" || code == "V10" || code == "V12") ? :idle : 15 | :invalid 16 | else 17 | :invalid 18 | end 19 | end 20 | end 21 | --------------------------------------------------------------------------------