# Real-World Event Sourcing: Command Tense (page 6)

**URL:** <https://forum.devtalk.com/t/real-world-event-sourcing-command-tense-page-6/185123>\
**Category:** PragProg Customers\
**Tags:** book-real-world-event-sourcing\
**Created:** [23 January 2025 21:25 UTC](https://forum.devtalk.com/t/real-world-event-sourcing-command-tense-page-6/185123 "2025-01-23T21:25:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![StevenNunez](https://forum.devtalk.com/user_avatar/forum.devtalk.com/stevennunez/32/704_2.png) [@StevenNunez](https://forum.devtalk.com/u/StevenNunez)\
**Post date:** [23 January 2025 21:25 UTC](https://forum.devtalk.com/t/real-world-event-sourcing-command-tense-page-6/185123/1 "2025-01-23T21:25:41Z")

</div>

In v2 of the calculator, does it make sens for the command tenses to be present?

```auto
defmodule EventSourcedCalculator.V2 do                                              
  def handle_command(%{value: _val}, %{cmd: :add, value: v}) do                     
    %{event_type: :value_added, value: v}                                           
  end                                                                               
                                                                                    
  def handle_command(%{value: _val}, %{cmd: :sub, value: v}) do                     
    %{event_type: :value_subtracted, value: v}                                      
  end                                                                               
                                                                                    
  def handle_command(%{value: _val}, %{cmd: :mul, value: v}) do                     
    %{event_type: :value_multiplied, value: v}                                      
  end                                                                               
                                                                                    
  def handle_command(%{value: _val}, %{cmd: :div, value: v}) do                     
    %{event_type: :value_divided, value: v}                                         
  end                                                                               
                                                                                    
  def handle_event(%{value: val},                                                   
                   %{event_type: :value_added, value: v}) do                        
    %{value: val + v}                                                               
  end                                                                               
                                                                                    
  def handle_event(%{value: val},                                                   
                   %{event_type: :value_subtracted, value: v}) do                   
    %{value: val - v}                                                               
  end                                                                               
                                                                                    
  def handle_event(%{value: val},                                                   
                   %{event_type: :value_multiplied, value: v}) do                   
    %{value: val * v}                                                               
  end                                                                               
                                                                                    
  def handle_event(%{value: val},                                                   
                   %{event_type: :value_divided, value: v}) do                      
    %{value: val / v}                                                               
  end                                                                               
end 

```

For instance the command to add a value is `value_added`, however, making it `add_value` does 2 things. Communicates that the value _has not been added yet_ and also allows consumers to more naturally respond to a command to add a value. It makes sense for handlers upon adding the numbers to emit `value_added` as an event.

Am I misunderstanding something?

---

<div class="post-metadata">

**Author:** ![StevenNunez](https://forum.devtalk.com/user_avatar/forum.devtalk.com/stevennunez/32/704_2.png) [@StevenNunez](https://forum.devtalk.com/u/StevenNunez)\
**Post date:** [23 January 2025 21:46 UTC](https://forum.devtalk.com/t/real-world-event-sourcing-command-tense-page-6/185123/2 "2025-01-23T21:46:08Z")

</div>

I wonder if a better example would have been to model the actions from a calculator.

```elixir
commands = [
  %{action: "press button", value: 1},
  %{action: "press button", value: :plus},
  %{action: "press button", value: 1},
  %{action: "press button", value: :equal},
]

```

When you run through these commands, the event handler for a button press with the value of equal would attempt to run the calculation. All other events would build a buffer.

This isn’t perfect either though since you’d need to introduce _taking input_ into the example with complicates things in addition to holding state.
