top of page

支援グループ

公開·11名のメンバー

Learn Ruby on Rails with Objects on Rails: A Practical Guide



Objects on Rails pdf 11




If you are a Ruby on Rails developer who wants to learn how to apply object-oriented design principles to your applications, you may be interested in reading Objects on Rails, a book by Avdi Grimm that explores alternative ways of structuring Rails applications using plain old Ruby objects (POROs). In this article, we will give you an overview of what this book is about, why you should read it, how you can get it, what are some key takeaways from it, and what are some challenges or limitations of it.




Objects On Rails Pdf 11



What is Objects on Rails?




Objects on Rails is an eBook written by Avdi Grimm, a well-known Ruby developer and author. The book was published in 2012 as a result of Grimm's experiment of building a Rails application from scratch using object-oriented design principles. The book is not a tutorial or a reference guide, but rather a narrative that documents Grimm's thought process and decisions as he develops a blogging application using test-driven development (TDD) and behavior-driven development (BDD) techniques. The book is divided into 11 chapters, each covering a different aspect of the application development, such as models, controllers, views, authentication, authorization, etc.


Why read Objects on Rails?




Learn how to apply object-oriented design principles to Rails applications




One of the main reasons to read Objects on Rails is to learn how to write better Rails code using object-oriented design principles, such as SOLID, DRY, encapsulation, abstraction, polymorphism, etc. The book teaches you how to design your Rails applications in a way that makes them more modular, reusable, testable, and maintainable. The book also shows you how to avoid some of the common pitfalls of Rails development, such as fat models, skinny controllers, callback hell, etc.


Explore alternative ways of structuring Rails applications




Another reason to read Objects on Rails is to explore alternative ways of structuring Rails applications that differ from the conventional Rails way of doing things. The book challenges some of the assumptions and conventions that Rails imposes on you and shows you how to use plain old Ruby objects for various purposes, such as service objects, presenters, decorators, domain models, etc. The book also shows you how to use dependency injection and composition over inheritance to reduce coupling and increase cohesion in your code.


Follow a practical example of building a Rails application from scratch




A third reason to read Objects on Rails is to follow a practical example of building a Rails application from scratch using TDD and BDD techniques. The book guides you through the development of a blogging application that has features such as posts, comments, tags, users, sessions, etc. The book shows you how to write tests using RSpec and Cucumber, how to implement features using POROs and Rails components, how to refactor your code using design patterns and principles, and how to deploy your application using Heroku.


How to get Objects on Rails?




Read it online for free




The full text of Objects on Rails is available to read online for free at https://objectsonrails.com/. The book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License, which means you can share and adapt it for non-commercial purposes as long as you give credit to the author and distribute it under the same license.


Download it in PDF, Epub, or Mobi formats for $5 USD




If you prefer to read Objects on Rails offline or on your favorite device, you can purchase the eBook in PDF, Epub, or Mobi (Kindle) formats for $5 USD at https://gumroad.com/l/objectsonrails. The package also includes the full source code of the blogging application that is developed in the book.


Get the source code on GitHub




If you want to run the code of Objects on Rails locally or modify it for your own purposes, you can get the source code on GitHub at https://github.com/avdi/objectsonrails. The repository contains instructions on how to set up and run the application using Bundler and Rake.


What are some key takeaways from Objects on Rails?




Use plain old Ruby objects for business logic




One of the key takeaways from Objects on Rails is to use plain old Ruby objects for business logic instead of relying on ActiveRecord models or ActionController controllers. The book advocates for separating business logic from framework code and using POROs for service objects, domain models, value objects, etc. This way, you can make your code more modular, reusable, testable, and maintainable. You can also avoid some of the drawbacks of ActiveRecord models or ActionController controllers, such as tight coupling, callback hell, fat models or skinny controllers syndrome.


Use dependency injection and composition over inheritance




Use presenters and decorators to handle presentation logic




A third key takeaway from Objects on Rails is to use presenters and decorators to handle presentation logic instead of cluttering your views or models with it. The book shows you how to use presenters and decorators to encapsulate presentation logic and delegate to other objects as needed. This way, you can make your views more concise and expressive, and your models more focused and pure. You can also avoid some of the problems of using helpers or partials, such as namespace pollution, lack of encapsulation, or performance issues.


What are some challenges or limitations of Objects on Rails?




It may not reflect the current state of Rails development




One of the challenges or limitations of Objects on Rails is that it may not reflect the current state of Rails development, as it was written in 2012 and some of its examples or recommendations may be outdated or incompatible with newer versions of Rails. For instance, the book uses Rails 3.2 and Ruby 1.9.3, which are no longer supported by the Rails team. The book also uses some gems or libraries that may have been deprecated or replaced by newer alternatives, such as RSpec 2, Cucumber, Factory Girl, etc. Therefore, you may need to adapt some of the code or concepts from the book to work with the latest versions of Rails and Ruby.


It may not suit every project or preference




Another challenge or limitation of Objects on Rails is that it may not suit every project or preference, as it is not a definitive guide or a best practice, but rather an exploration of one possible way of doing things. The book does not claim to be the only or the best way of structuring Rails applications using object-oriented design principles, but rather a personal experiment and a learning experience. Therefore, you may find that some of the ideas or techniques from the book may not work well for your project or your style of development. You may also disagree with some of the opinions or assumptions that the author makes in the book.


It may require more effort or learning curve than conventional Rails development




A third challenge or limitation of Objects on Rails is that it may require more effort or learning curve than conventional Rails development, as it requires you to think more about design decisions and trade-offs, and to learn some new concepts or tools that are not part of the standard Rails stack. The book also introduces some complexity or overhead that may not be necessary for simple or small applications, such as using multiple objects for different purposes, injecting dependencies into objects, testing objects in isolation, etc. Therefore, you may need to weigh the costs and benefits of using object-oriented design principles in your Rails applications.


Conclusion




Objects on Rails is a book by Avdi Grimm that explores alternative ways of structuring Rails applications using object-oriented design principles and plain old Ruby objects. The book teaches you how to write better Rails code using SOLID, DRY, and other OOP concepts; how to challenge some of the conventional Rails practices and use service objects, presenters, decorators, and more; and how to follow a practical example of building a blogging application from scratch using TDD and BDD techniques. The book is available to read online for free or to download in PDF, Epub, or Mobi formats for $5 USD. The source code is also available on GitHub.


If you are interested in learning more about object-oriented design principles and how they apply to Rails development, you should definitely check out Objects on Rails. However, you should also be aware that the book may not reflect the current state of Rails development; that it may not suit every project or preference; and that it may require more effort or learning curve than conventional Rails development. Ultimately, you should decide for yourself what works best for you and your project.


FAQs




  • What is object-oriented design?



  • Object-oriented design is a way of designing software systems based on the concepts of objects that have attributes and behaviors, and that interact with each other through messages.



  • What are some object-oriented design principles?



  • Some object-oriented design principles are SOLID (Single responsibility principle, Open/closed principle, Liskov substitution principle, Interface segregation principle, Dependency inversion principle), DRY (Don't repeat yourself), YAGNI (You ain't gonna need it), etc.



  • What are some benefits of object-oriented design?



  • Some benefits of object-oriented design are modularity, reusability, testability, maintainability, extensibility, etc.



  • What are some drawbacks of object-oriented design?



  • Some drawbacks of object-oriented design are complexity, overhead, learning curve, etc.



  • Who is Avdi Grimm?



  • Avdi Grimm is a Ruby developer and author who has written several books and articles on Ruby and Rails development, such as Confident Ruby, Exceptional Ruby, RubyTapas, etc. He is also a co-host of the Ruby Rogues podcast.



71b2f0854b


グループについて

グループへようこそ!他のメンバーと交流したり、最新情報をチェックしたり、動画をシェアすることもできます。
グループページ: Groups_SingleGroup
bottom of page