at Object Design Rough Talks #1
https://gum.co/jspsc
Points of View@rosylilly
View Slide
What’s this?
VS
wow!!
@rosylillyCTO / Magnet
1. Modeling
If it walks like a duckand quacks like a duck,it must be a duck
QUACK!!!!Duck?
DuckPigeonBorderCoo Coo Coo CooQuack Quack Quack
DuckPigeonIf it walks like a ***and flies like a ***,it must be a ***
Bird
If it be born like a ***and dies like a ***,it must be a ***
LivingThingT h e A n y t h i n g G o e s
Let’s seek just the right borderCoo Coo Coo CooFliesWalksEatsRunsDiesBe BornPigeon
2. Viewpoint
Who are your users?
Click MeWhat happens?
Transfer MoneyShow LogsShow Amounts
Transfer MoneyShow LogsShow AmountsSCARY!!!!
Developer User
Communication
Observation
Newbie
ProTips: Marriage
Third Person
First Person
3. Interaction
Anemic Domain Model ?
Hyperemic Domain Model !
PigeonPigeon
SellerBuyer
GiverReceiver
SpeakerListener
User GiverReceiverSeller BuyerListener Speaker
Item RecoverAccessoryWeapon ProtectorHelmet Boots
Classify and Divide
4. Context
SellerBuyers
BuyerSellersSellersSellersSellersSellers
Look the borders ofcontexts
5. Mental Model
(3&&
VSMicrosoft Apple
VSWindow Apple
6. DCI
YOUAREREADY
Data
Context
Interaction
7. in REAL WORLD
WEAREREADY
BluePrint[email protected]
class StaffContext < BluePrint::Contextactive_if do |env|current_user.try(:staff?)endendContext
# app/blue_prints/staff_context/staff_user.rbmodule StaffContext::StaffUserextend BluePrint::Behavior!def user_name; "staff"; endend!# app/models/user.rbclass User < ActiveRecord::Basedef user_name; "#{name} san"; endend!user = User.new(name: "Magnet")StaffContext.deactivate!user.user_name # => "Magnet san"StaffContext.activate!user.user_name # => "staff" Interaction
GOT AXES?