Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
We'll start with a simple Ruby Kata and solve it together, live, with imperative programming. We'll then fix the many, many, many things we got wrong. Then we'll solve the problem again using patterns from functional programming. You'll leave this talk with a clear and concrete example of why functional programming matters, why immutable code matters, and why it can help you writing bug-free code. The next time you find yourself writing imperative code, you'll think about... the functional alternative.
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 presentation 'The Functional Alternative' by Ju Liu at the Helvetic Ruby 2023 event, the speaker guides the audience through a practical exercise to illustrate the principles of functional programming versus imperative programming using a simple Ruby Kata. The session begins with the generation of 100 random numbers, followed by a straightforward task of representing these numbers as hashes. Liu emphasizes the initial simplicity of the task but quickly escalates its complexity by introducing a new requirement: to group consecutive equal numbers, which proves to be a challenge. Key points discussed during the video include: - **Imperative Programming**: The speaker demonstrates how to write imperative code to generate and process the random numbers. Initially, the focus is on printing hashes based on these numbers. - **Introducing Complexity**: The need to group consecutive equal numbers creates complications, necessitating the use of state management to keep track of previous values and their indices. - **Debugging Process**: Liu openly acknowledges errors encountered during this process, highlighting the importance of debugging and proper testing. - **Refactoring to Functional Programming Techniques**: After addressing the initial issues, Liu showcases the application of functional programming techniques, emphasizing the use of pure functions to eliminate side effects and enhance code clarity. - **Separation of Concerns**: The presentation stresses redesigning the application to separate data manipulation from output representation, thereby reducing complexity and improving code maintainability. - **Enhancements through Ruby Features**: Utilizing Ruby's slicing and pattern-matching capabilities helps make the codebase cleaner and more sophisticated. In conclusion, Liu encourages developers to challenge themselves in recognizing complexities in their coding practices and advocate for functional programming methods as a means to improve efficiency, clarity, and collaboration in software development. By the end of the session, viewers are armed with concrete examples of the significance of functional programming, immutability, and how these concepts contribute to writing bug-free code. For further exploration, the complete code is made available via a scan-able QR code at the end of the talk.
Suggest modifications
Cancel