Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
By, Sean Griffin The most useful APIs are simple and composeable. Omnipotent DSLs can be great, but sometimes we want to just write Ruby. We're going to look at the process of designing a new API for attributes and type casting in Rails 5.0, and why simpler is better. We'll unravel some of the mysteries behind the internals of Active Record. After all, Rails is ultimately just a large legacy code base. In this talk you'll learn about the process of finding those simple APIs which are begging to be extracted, and the refactoring process that can be used to tease them out slowly.
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 talk titled "Designing a Great Ruby API - How We're Simplifying Rails 5," Sean Griffin shares insights on the process of designing a simplified API for attributes and type casting within Rails 5.0, emphasizing that the most effective APIs are simple and composable. He discusses the importance of identifying missing APIs in legacy codebases like Rails, and shares strategies to refactor and extract simpler APIs from complex existing code. Griffin illustrates the complexity of modifying attribute types in Active Record, using the example of a price attribute that needs to be represented as a money object. Key points include: - **Beginning the Refactor**: A rough outline of the desired API is essential, avoiding early rigidity to allow flexible iterations. - **Identifying Duplication**: Developers should look for duplicated concepts and patterns in the code, such as methods with similar prefixes or overridden methods in modules. - **Overriding Methods**: The need for overriding readers and writers to create desired behaviors, such as converting attribute types or managing typecasting behaviors, can lead to challenges and subtle bugs. - **Introduced Complexity**: Examples demonstrate that while trying to implement new features, existing hacks and complications can create unexpected behaviors. - **Refactoring Rules**: Stressing the importance of good test coverage throughout the refactoring process ensures stability and provides a safety net for changes. - **Iterative Process**: The talk stresses an iterative approach to refining APIs and type casting behaviors, where each change is validated with thorough testing. - **Clarity and Maintainability**: As the new API develops, maintaining clarity in the implementation remains paramount to ensure usability and predictability. Griffin concludes by emphasizing the need to balance complexity and functionality in API design, ensuring that enhancements in Rails 5 provide a streamlined and coherent experience for developers. He highlights that the ongoing challenge will be to evolve the APIs while keeping them intuitive and accessible. This talk aims to encourage developers to push the boundaries of Rails API design while maintaining a focus on developer experience and code maintainability.
Suggest modifications
Cancel