June 2017
Beginner
330 pages
7h 30m
English
However, this OrderReport class has a nasty secret: it doesn't like change. Let's imagine that we're asked to update the bill_of_lading method to also print out the customer address:
class OrderReport def initialize(customer:, total:, address:) @customer = customer @total = total @address = address end def invoice puts "Invoice" puts @customer puts @total end def bill_of_lading puts "BOL" puts @customer puts "Shipping Label..." puts @address endendorder = OrderReport.new(customer: "Google", total: 100, address: "123 Any Street")order.invoiceorder.bill_of_lading
This may not seem like a major change; however, in order to accommodate the request, we had to make four changes.
One of the changes is even requiring us to pass ...
Read now
Unlock full access