Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
By, Nickolas Means As developers, we spend more time writing code than thinking about the nuances of computer science. What would happen if we approached code like a writing exercise instead of a technical pursuit? What if we applied patterns from elegant prose instead of Gang of Four? Let's try it! We'll take some smelly Ruby and refactor it using only advice from Strunk and White's "The Elements of Style", the canonical text on writing beautiful, understandable English. You'll come away with a new approach to your craft and a new appreciation of the similarities between great writing and great code. Help us caption & translate this video! http://amara.org/v/GU7v/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the video titled "How To Code Like A Writer," Nickolas Means discusses an innovative approach to software development by treating coding as a writing exercise rather than a purely technical task. This presentation, delivered at Ruby on Ales 2015, emphasizes the importance of clarity and structure in code, analogous to good writing practices outlined in Strunk and White's "The Elements of Style." Key Points: - **Coding as Writing**: Means references a previous talk where it was suggested that developers spend more time writing than engineering, leading to the concept of considering code similar to prose. This opens up the idea of applying writing rules to coding practices. - **Strunk and White's Influence**: The canonical text by Strunk and White serves as a guide for improving code readability and structure. For instance, revising is necessary and often reveals flaws in initial arrangements, paralleling code that may require significant refactoring after it reaches production. - **Refactoring Example**: He presents a case study using a class named Shipping Utilities.rb, which was poorly structured and exhibited high complexity scores. The goal is to refactor this problematic code using principles from Strunk and White, rather than traditional technical refactoring methods. - **Specific Refactoring Steps**: - Isolate the problematic methods from the utilities class. - Clear unnecessary lines and improve variable names for better readability. - Teach methods to respond to specific messages, enhancing the code's clarity and structure. - Break down lengthy methods into smaller, more manageable ones for concise code writing. - Utilize parallel construction in code expressions to enhance readability and comprehension. - **Outcome of Refactoring**: The final refactoring process results in significantly reduced complexity scores, making the code cleaner and more maintainable. For example, a Flog score improved from 180.4 to 77.2 and a Fog score from 120.7 to 3, illustrating the effectiveness of applying writing principles to programming. Conclusions and Takeaways: - Coding should prioritize clarity and organization, akin to constructing an engaging narrative in writing. - Every piece of code should serve a clear purpose, eliminating unnecessary complexity and ensuring that the narrative is easy to follow. - Following the philosophy that "Good programmers write code that humans can understand," encourages developers to craft code with both the machine and human perspective in mind. - Ultimately, rethinking coding practices in the light of writing principles can lead to a more disciplined and effective approach to software development.
Suggest modifications
Cancel