object invariants, immutability & you lightning talk
Post on 05-Aug-2015
245 Views
Preview:
TRANSCRIPT
Object Invariants, Immutability & You
Making Objects Do Your Bidding Domcode 26-11-2014
Jeroen v.d. Gulik
• CTO / Founder Isset (http://isset.nl)
• Builder of Artificial Stupidity
• @n0x13
• Likes Cats … a lot
“Every Great talk should start with a Quote”
- Ross Tuck
Telephone Game
“People Lie, therefore Objects Lie”
- Jeroen v.d. Gulik
Objects as dumb data stores
This is our industry standard
Context and Intent get lost- Ronald Reagan
Objects should have behaviour attached to
them- Mao Zedong
Objects should tell a tale about its current state and all the possible
ways to change that state- Adolf Hitler
Objects should be responsible for their own
internal consistency
Schrödinger's cat- Michael Jackson
Make the Implicit, Explicit
UnpaidOrder PaidOrder
“Sounds like a State Machine”- Igor Wiedler
Immutability
UnpublishedArticle PublishedArticle
UnpublishedArticle PublishedArticleDraft Article
Draft Article RetractedArticle
Magic is bad, hmmmkay- Mahatma Ghandi
Objects should …
• Be responsible for their own internal state
• Have specific behaviour towards its responsibility
• Broadcast their state
• Only care about the state it’s currently in.
Questions?
top related