Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
By, Dinshaw Gobhai Sequential workflows are easy to write (top down), but hard to write well. State machine workflows start to feel hacky, when complex; presenter patterns can be very heavy. Promises are a beautiful way to define and execute progressive routines while allowing access to independent steps for things like logging, exception handling, and picking up where you left off. Help us caption & translate this video! http://amara.org/v/FrHJ/
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
### Promises in Ruby In the video "Promises in Ruby," Dinshaw Gobhai discusses how to effectively utilize promises in Ruby to manage complex workflows. The talk, presented at RubyConf 2014, explores the challenges of traditional sequential workflows and shares insights into implementing promises as a cleaner, more manageable coding pattern. #### Key Points Discussed: - **Introduction to Promises:** Gobhai introduces himself and explains his background with Ruby since 2000. He shares his experiences with automating ad publishing workflows that often involve lengthy sequential processes. - **Challenges with Traditional Patterns:** He highlights the difficulty of managing long top-down workflows and how using state machines can complicate exception handling, leading to unmanageable code. - **Exploration of JavaScript Promises:** The presenter reflects on a friend's suggestion to explore JavaScript promises, leading him to realize their potential in Ruby after further investigation. - **What Are Promises?** He describes promises as a method to establish direct correspondence between synchronous and asynchronous operations, making code more natural and readable compared to nested callbacks. - **State Management:** A promise transitions between three states: pending, fulfilled, and rejected. This structure allows for better error management, as it defines clear pathways for success and failure through chained calls to 'then'. - **Implementation in Ruby:** Gobhai illustrates how the promise pattern can be adapted in Ruby, showcasing examples from his codebase. He emphasizes the importance of using closures (lambdas) within promise implementations. - **Asynchronous Operations:** Gobhai discusses how promises allow for non-blocking operations, enabling developers to handle multiple tasks simultaneously. He presents examples demonstrating 'Promise.all' and 'Promise.any', showcasing how to manage collections of promises effectively. - **Benefits for Code Readability and Maintainability:** The video emphasizes how adopting promises can improve the structure of code, making it easier to follow and refactor. - **Reflection and Future Directions:** Gobhai acknowledges challenges that remain in operationalizing promises in production environments and encourages developers to continue exploring best practices for implementing promises in their work. #### Conclusions: Gobhai concludes by highlighting the elegance and utility of promises in Ruby, advocating for their adoption to enhance software development practices. He expresses gratitude to individuals who assisted him in understanding and presenting these concepts, reinforcing the community aspect of learning in programming. Overall, the talk aims to inspire Ruby developers to embrace promises to simplify asynchronous programming and improve workflow management. Happy coding!
Suggest modifications
Cancel