logoalt Hacker News

Kerrick • today at 5:42 PM • 0 replies • view on HN

Try reading the aforementioned book, and look at the classes in the Rails API. They are often named very simply after the pattern.

For example, Active Record is on Page 160, and inspired https://api.rubyonrails.org/classes/ActiveRecord.html. Model View Controller is on page 330 and inspired https://api.rubyonrails.org/classes/ActiveModel.html, https://api.rubyonrails.org/classes/ActionView.html, and https://api.rubyonrails.org/classes/ActionController.html. Template View is on page 350, and inspired https://api.rubyonrails.org/classes/ActionView/Template.html.

Not all patterns used in Rails are so directly named, though. Layer Supertype is on page 475 and is behind the `class Company < ActiveRecord::Base; end` style. Single Table Inheritance is on page 278, and inspired https://api.rubyonrails.org/classes/ActiveRecord/Inheritance.... Repository is on page 322, and inspired https://api.rubyonrails.org/classes/ActiveRecord/FinderMetho.... Value Object is on page 486, and is a key part of https://api.rubyonrails.org/classes/ActiveRecord/Aggregation....

See also: https://signalvnoise.com/posts/3375-the-five-programming-boo...