How would you explain Phoenix Contexts to a newbie?

Contexts are just the explicit application of behavior to data.

If I am the owner of a factory then I’m going to assign a worker to a task.

Under another train of thought, a worker would get assigned a task.

Either way that worker isn’t going to go to work on the first day and assign himself tasks and know what to do. As the owner of the factory I know why I hired him and what task he is supposed to perform. There’s no practical difference between the two.

The differences are subtle, but in both cases the context is the factory. I’m the first case I’m making that context explicit, “I, the factory owner, am assigning the worker this task.” The subject in this sentence is the factory owner, the verb is what the factory owner is doing.

Whereas in the second case I have the implicit association, “The worker gets assigned this task.” I assume it’s at the factory, I but the subject of the sentence is the worker and the verb is the assignment.

It’s the same in practice, but it’s how explicit I am about it.

It’s not a perfect metaphor, but that’s the point of metaphors. Who can ask for perfection when comparing two unlike things?

Note: Sorry for those with English as a second language. I just find this easiest to explain using sentence structure as a teaching tool.

3 Likes