possible, make sure that any people whom participate in the project can understand and contribute effortlessly even though the project grows larger and larger and larger ! RGTHQTOCPEGOC[GXGPDGCUGEQPFEKVK\GPKPUQOGECUG
? AND deleted = ?", Time.now.utc, false).order("last_name, first_name") people = people.reject { |p| p.address.nil? } end ! def name "#{last_name}, #{first_name}" end ! def age (Date.today - person.birthdate) / 365 end ! def pseudo_id new_record? ? "new" : id end end
class="name"><%= person.name %></span> <span class="age"><%= person.age %></span> </div> <% end %> class PeopleController < ActionController::Base def index @people = Person.find_recent end end
… end ! def process1_method2 … end ! def process2_method1 … end ! def process2_method2 … end ! def process1_method3 … end ! def process1_method4 … end ! def process3_method1 … end ! def process3_method2 … end ! end
… end ! def process1_method2 … end ! def process2_method1 … end ! def process2_method2 … end ! def process1_method3 … end ! def process1_method4 … end ! def process3_method1 … end ! def process3_method2 … end ! def process1_method1 … end ! def process1_method2 … end ! def process2_method1 … end ! def process2_method2 … end ! def process1_method3 … end ! def process1_method4 … end ! def process3_method1 … end ! def process3_method2 … end ! def process1_method1 … end ! def process1_method2 … end ! def process2_method1 … end ! def process2_method2 … end ! def process1_method3 … end ! def process1_method4 … end ! def process3_method1 … end ! def process3_method2 … end ! end
AddToCartContext.new(user, book).call end ! def initialize(user, book) @user, @book = user, book @user.extend Customer end ! def call @user.add_to_cart(@book) end end
book).call end ! def initialize(user, book) @user, @book = user, book @user.extend Customer end ! def call @user.add_to_cart(@book) end end 2GTHQTOCPEGRTQDNGOJGTG
similar in some ways to the DCI notion of Roles. It doesn’t have the run-time mixin acrobatics nor does it have the “thy models shall be completely devoid of logic themselves” prescription, but other than that, it’ll often result in similar logic extracted using similar names.”
placed exactly within the actual code (not the test). ! And tightly separated from the model. 9GNN+ņOIQPPCNQUGO[LQDDGECWUGO[ENKGPVUECPEQFG EQORNKECVGFDWUKPGUURTQEGUUD[VJGOUGNXGUKHVJCVJCRRGPU