Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
adults
appointments
baby
beers
catalogue
children
clock
dog
door
drops
floor
kid
leather_chair
light
milk_bottle
money
music
names
person
pills
student
teenager
teeth
wallet
water
yak
Gemfile
README.md

README.md

Command/Query Separation

Queries

Sometimes we want to get information about something. Is it Wednesday? How many people have signed up to attend the event? Which channel is your favorite? Asking the question doesn't change anything. It's either Wednesday or it isn't, and asking the question doesn't make it Thursday.

Commands

Other times, we do something to the world, and something changes. We throw something in the trash. Now the trash can has more stuff in it. We buy a drink. Now we have less money.

One or the Other

In many software systems we try to keep a clear separation between obtaining data and changing things. When we're asking about something, we don't change things, and when we change things, we don't get information back. If, when we've told the system to change, we want to know whether or not anything actually happened, or what the new situation is, we'll have to go ask.

These exercises focus on these two types of operations.

Exercises

  • leather_chair_test.rb
  • pills_test.rb
  • floor_test.rb
  • milk_bottle_test.rb
  • person_test.rb
  • door_test.rb
  • teeth_test.rb
  • music_test.rb
  • drops_test.rb
  • light_test.rb
  • baby_test.rb
  • kid_test.rb
  • beers_test.rb
  • teenager_test.rb
  • adult_test.rb
  • names_test.rb
  • dog_test.rb
  • water_test.rb
  • appointments_test.rb
  • yak_test.rb
  • student_test.rb
  • money_test.rb
  • time_test.rb
  • children_test.rb
  • catalogue_test.rb

Go make up more

... and submit pull requests