Legacy code: the code most tightly coupled to your revenue stream.
@dobbse
Legacy code is where the lifetime of the code is not coincident with the team lifetime.
@mfeathers at #xprolo
Honor legacy code. It exists because it is bringing value. We work on it because we want it to keep bringing value.
@woodyzuill
Some people call it legacy code. I like to call it revenue code.
@ryanflorence
Unsuccessful code doesn't survive long enough to become legacy! Legacy code is the sign of being successful.
@aklecha
foldl(events)
f(aggregate, command) => events
f(state, event) => state
f(state, event) => maybe(command)
RailsEventStore::Client.new.read_all_streams_forward(:head, 1)
=> ProductItemEvents::ProductItemSold
@event_id="74eb88c0-8b97-4f27-9234-ed390f72287c",
@metadata={:timestamp=>2014-11-12 22:20:24 UTC},
@data={:order_id=>23456, :product_item_id=>123456,
:attributes=>{
"id"=>123456, "order_id"=>23456, "product_type_id"=>98765,
"price"=>50, "barcode"=>"1234567890",
"scanned_at"=>nil, "serialized_type"=>nil,
"order_line_id"=>3456789, "code_id"=>nil,
"updated_at"=>2014-11-12 22:20:24 UTC, "created_at"=>2014-11-12 22:20:24 UTC}}
=> TicketSold
@event_id=“74eb88c0-8b97-4f27-9234-ed390f72287c”,
@metadata={:timestamp=>2014-11-12 22:20:24 UTC},
@data={:barcode=>”1234567890”,
:order=>{SaleIdentification value object},
:type=>{Ticket type value object},
:price=>{Price value object}}
Me: One more beer, please.
Bartender: Ok, here is your beer. (HTTP 200)
Bartender: Fuck off. You are drunk. (HTTP 403)
Me: One more beer, please.
Bartender: Ok, it will be delivered to your table. (HTTP 202)
Bartender: Sorry, we ran out of beer. (HTTP 404)
It does not matter if you actually get your beer or not.
They have different meaning.
Command is only for things that has not happened yet. If something has already happened then this is event.
Only valid in some cases
Avoid race conditions
Have your domain only deal with the “latest” version of the event
Elastic Search
Reporting model based on star schema
External services / applications
Available at:
https://talks.praglowski.com/switching-your-mindset