Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Zeitwerk is a new code loader for Ruby, and it is going to replace the classic autoloader in Rails 6. In this talk we'll cover what motivated Zeitwerk, how to use it, and interesting aspects of its implementation. rubyday Verona 2019 - April 11th https://2019.rubyday.it/ Next edition: April 2nd 2020, Verona - https://rubyday-2020.eventbrite.it Keep in touch! Subscribe to our newsletter http://eepurl.com/rCZZT
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
### Summary of the Video: Zeitwerk: A New Code Loader for Ruby In this talk at RubyDay 2019, Xavier Noria introduces Zeitwerk, a new code loader for Ruby that aims to replace the classic autoloader used in Rails 6. The presentation is structured around several key points that illustrate the motivations, functionalities, and implementation of Zeitwerk. #### Key Points Discussed: - **Introduction to Zeitwerk**: Zeitwerk is a gem designed to handle autoloading, eager loading, and reloading of code. It is positioned as a standalone component, independent of Rails, and can be used in any Ruby project as long as the file paths adhere to specific conventions. - **Historic Context**: The talk starts with a comparison of Rails' existing autoloading mechanism against Zeitwerk’s improved method. Specifically, while Rails typically relied on an explicit path setup, Zeitwerk streamlines the process, focusing on consistent naming conventions and file structures. - **Features of Zeitwerk**: - **No dependencies**: Zeitwerk has a minimal footprint with no external dependencies, which simplifies usage across various Ruby environments including JRuby, albeit with some considerations for threads. - **File Structure**: The audience is guided through a recommended file organization that enhances autoloading efficiency. It emphasizes the correlation between file names, class/module names, and directory structures. For example, a file named `user.rb` should declare the `User` constant - a predictable relationship that Zeitwerk expects. - **Efficiency and Memory Management**: Noria highlights the issues that arise with the traditional Rails autoloading system, particularly regarding efficiency and memory. Zeitwerk addresses these by adopting a more intuitive approach to class and module loading based on Ruby's inherent constant resolution mechanics. - **Implementation Examples**: Various practical examples are provided illustrating how Zeitwerk manages file dependencies, organizes namespaces, and resolves paths, all designed to prevent common pitfalls encountered in Rails' autoloading. - **Conclusion and Takeaways**: Zeitwerk enhances the Ruby development experience by ensuring projects are structured for optimal performance. Proper coding literacy regarding file and module organization is critical for this system to function correctly and efficiently. Noria emphasizes that with Zeitwerk, developers can streamline their Ruby code loading process and improve the overall management of constants. This talk encapsulates the benefits of adopting Zeitwerk, underscoring its role in modern Ruby development and the transition towards a more robust Rails autoloading structure.
Suggest modifications
Cancel