Layered Design for Ruby on Rails Applications: Discover practical design patterns for maintainable web applications

Оглавление⌄
Cover Page....2 Table of Contents....3 Preface....4 Part 1: Exploring Rails and Its Abstractions....12 Chapter 1: Rails as a Web Application Framework....13 Technical requirements....13 The journey of a click through Rails abstraction layers....14 Beyond requests – background and scheduled tasks....26 The heart of a web application – the database....30 Summary....35 Questions....35 Exercises....36 Further reading....36 Chapter 2: Active Models and Records....37 Technical requirements....37 Active Record overview – persistence and beyond....38 Active Model – the hidden gem behind Active Record....49 Seeking God objects....58 Summary....60 Questions....61 Exercises....61 Further reading....61 Chapter 3: More Adapters, Less Implementations....63 Technical requirements....63 Active Job as a universal queue interface....64 Active Storage and its adapters and plugins....72 Adapters and wrappers at your service....77 Summary....80 Questions....81 Exercises....81 Further reading....81 Chapter 4: Rails Anti-Patterns?....82 Technical requirements....82 Callbacks, callbacks everywhere....83 Concerning Rails concerns....96 On global and current states....107 Summary....113 Questions....114 Exercises....114 Chapter 5: When Rails Abstractions Are Not Enough....115 Technical requirements....115 The curse of fat/thin controllers and thin/fat models....116 Generic services and granular abstractions....126 Layered architecture and abstraction layers....127 Summary....131 Questions....132 Part 2: Extracting Layers from Models....133 Chapter 6: Data Layer Abstractions....134 Technical requirements....134 Using query objects to extract (complex) queries from models....135 Separating domain and persistence with repositories....151 Summary....155 Questions....155 Chapter 7: Handling User Input outside of Models....157 Technical requirements....157 Form objects – closer to the UI, farther from persistence....158 Filter objects or user-driven query building....179 Summary....186 Questions....186 Exercise....187 Chapter 8: Pulling Out the Representation Layer....188 Technical requirements....188 Using presenters to decouple models from views....189 Serializers are presenters for your API....203 Summary....209 Questions....209 Further reading....210 Part 3: Essential Layers for Rails Applications....211 Chapter 9: Authorization Models and Layers....212 Technical requirements....212 Authorization, authentication, and friends....213 Authorization models....217 Authorization enforcement, or the need for authorization abstractions....223 Performance implications of authorization....236 Summary....240 Questions....240 Exercise....241 Further reading....241 Chapter 10: Crafting the Notifications Layer....242 Technical requirements....242 From Action Mailer to multiple notification channels....243 Extracting notifications layer....249 Modeling user notification preferences....260 Summary....265 Questions....265 Exercises....265 Chapter 11: Better Abstractions for HTML Views....267 Technical requirements....267 The V in Rails’ MVC: templates and helpers....267 Thinking in components....279 Summary....288 Questions....289 Further reading....289 Chapter 12: Configuration as a First-Class Application Citizen....290 Technical requirements....290 Configuration sources and types....291 Using domain objects to tame configuration complexity....299 Summary....311 Questions....312 Exercises....312 Chapter 13: Cross-Layers and Off-Layers....313 Technical requirements....313 The Rails infrastructure layer and its diversity....313 Across the layers – logging and monitoring....316 Extracting implementations into services....327 Summary....332 Questions....333 Index....334 Gems and Patterns....350 Why subscribe?....356 Other Books You May Enjoy....357 Packt is searching for authors like you....359 Share your thoughts....359 Download a free PDF copy of this book....360
Описание
Ниже — практический обзор по теме «rails».
However, this initial simplicity often leads to uncontrollable complexity turning the well-structured codebase into a hardly maintainable mess. Ruby on Rails is an open-source framework for building web applications from scratch while focusing on productivity, leveraging the power of the convention-over-configuration principle, and the well-defined model-view-controller pattern, assisting the developers in building useful features. This book aims to help you keep the code maintainable while working on a Rails application.
Then, you’ll tackle many common design problems by discovering useful patterns and abstraction layers. You’ll start by exploring the framework capabilities and principles, allowing you to reap the full potential of Rails. By implementing abstraction and dividing the application into manageable modules, you’ll be able to concentrate on specific parts of the app development without getting overwhelmed by the entire codebase. Additionally, you’ll explore further steps in scaling Rails codebase, such as service extractions. This strategy also encourages code reuse, simplifying the process of adding new features and enhancing the application's capabilities.
By the end of this book, you’ll be a code design specialist with a deep understanding of the Rails framework principles.
It offers practical strategies for maintaining code readability and manageability, providing valuable guidance for developers at all levels. What you will learnDiscover Rails' core components and its request/response cycleUnderstand Rails' convention-over-configuration principle and its impact on developmentExplore patterns for flexibility, extensibility, and testability in RailsIdentify and address Rails’ anti-patterns for cleaner codeImplement design patterns for handling bloated models and messy viewsExpand from mailers to multi-channel notification deliveriesExplore different authorization models and layersUse a class-based approach to configuration in RailsWho this book is forThis book is for Rails application developers facing challenges in managing the growing complexity of their projects. Whether you've recently launched your first Rails minimum viable product or are struggling to progress with a sizable monolithic application, this book is here to help. Some experience in building web applications using the Rails framework will enhance your comprehension and application of the concepts presented in the book. A deep understanding of core Rails principles is a must.
Файл доступен для загрузки ниже.
Поделиться
Частые вопросы
Можно ли скачать «Layered Design for Ruby on Rails Applications: Discover practical design patterns for maintainable web applications» бесплатно?
Да, «Layered Design for Ruby on Rails Applications: Discover practical design patterns for maintainable web applications» доступна для бесплатного скачивания на нашем сайте в формате PDF. Ссылка на файл находится на этой странице.
В каком формате и какого размера файл?
Книга предоставляется в формате PDF, размер файла 1,9 МБ.
Кто автор и когда вышла книга?
автор — Dementyev Vladimir, издательство Packt Publishing Limited, год выпуска 2023, 360 страниц.
О чём книга «Layered Design for Ruby on Rails Applications: Discover practical design patterns for maintainable web applications»?
Ruby on Rails is an open-source framework for building web applications from scratch while focusing on productivity, leveraging the power of the convention-over-configuration principle, and the well-defined model-view-controller pattern, as