Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Tom Stuart In your grandparents’ attic you discover a mysterious old computer. You boot it up and discover it runs Ruby, but doesn’t support negative numbers! How can you implement negative numbers in an elegant way? We’ll explore two solutions and discover how important it is to pick the right representation. [Tom](https://twitter.com/tomstuart) is a [computer scientist](http://computationbook.com/) and programmer. He has lectured on optimising compilers at the University of Cambridge, co-organises the Ruby Manor conference, and is a member of the London Ruby User Group. He is currently the CTO of [FutureLearn](https://www.futurelearn.com/), an online learning platform. #ruby #rubyconf #rubyconfau #programming
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 titled "Representations Count," Tom Stuart, CTO of FutureLearn, explores a unique problem involving negative numbers in an old version of Ruby that does not support them. The talk, given at RubyConf AU 2019, leads the audience through an engaging fictional scenario where one discovers a vintage computer that limits numerical calculations. Stuart presents a challenge: how to implement support for negative numbers on this outdated system. He emphasizes the importance of selecting the right representation for signed numbers. The key points discussed in the presentation include: - **Problem Description**: The vintage Ruby implementation generates errors if an operation leads to a negative number. The challenge is to create a class that can handle signed numbers, allowing for operations to yield correct results without errors. - **Base Representation of Signed Numbers**: The class requires a sign and an absolute size for the numbers. Stuart proposes using symbols for signs while ensuring the size remains a positive integer to simplify computations. - **Creating Factory Methods**: The first step involves implementing factory methods for creating positive and negative numbers, which dictates how instances of the class are initialized with proper attributes. - **Equally and Addition**: The presentation details the `equals` method, which checks if two signed numbers are equivalent based on their size and sign. Stuart introduces the `plus` method, where errors must be handled when adding numbers of differing signs, particularly avoiding negative results in a non-negative supporting environment. - **Conditionals for Error Handling**: He explains the need for conditionals that check if subtraction is valid when combining positive and negative numbers, ensuring that they stay within the acceptable range. - **Representation of Zero**: An interesting discussion unfolds on handling zero in terms of its representation, leading to conclusions that clarify it should not be treated as a special case despite its signs differing (positive zero vs negative zero). - **Exploration of Multiplication**: Stuart extends the exploration to multiplication, suggesting geometric representations to conceptualize multiplicative operations without relying on subtraction, thus emphasizing elegance in code design. - **Design Decisions and Real-World Implications**: The presentation closes by underlining the significance of thoughtful representation choices in programming, encouraging developers to consider implications of design decisions in their work. Finalmente, Stuart's talk highlights that choosing the correct data representation can simplify operations and reduce cognitive load for programmers. By engaging the audience with practical implications, he fosters a deeper understanding of the complexities involved in numerical computations in programming.
Suggest modifications
Cancel