Unlike threads, flows have an identity that you provide. It’s not a nameless, behind the scene thing executing your code. Flows are front and center.
Business and Logical Flows
In PRDs, or even Design Documents you might have come across the term ‘Flow’. Something like ‘User login’ flow or ‘Use Cache’ flow. In those documents, a flow represents a sequence of events that occur under that context. Mind you, the flow is a small part of a larger picture, it doesn’t tell the full story. We could be talking about a PRD to launch referrals or a Design Document about data pipelines. We choosing the same terminology in metz is not serendipitous. It’s called a flow in metz to capture this exact meaning. A business or logical flow, and a metz flow are meant to be exactly the same.How is it different from a story?
How is it different from a story?
Once again, as is the case with PRDs and Design documents, a flow is a small part of a larger design.A story can be talking about ‘User accepts referral’, and it can contain a flow called ‘User signs up’. And the signup flow will kick off
a chain of events, data getting passed around, but all under the context of ‘User signs up’.
Which in turn is happening in service of a user accepting a referral.The story could change to ‘User refuses referral’, and the ‘User signs up’ flow will still kick off and do its job.
Which in turn is happening in service of a user accepting a referral.The story could change to ‘User refuses referral’, and the ‘User signs up’ flow will still kick off and do its job.
How to use flows?
You can create a flow through the following syntax:My flow is not running. Why?
My flow is not running. Why?
- Did you use
std.flow
to create it? - If yes, then did you pass an instance of the class and not some other object?
- Did you call the method you want to execute?
- Did you call
.run()
on the method you want to execute?
And with that, we have learnt the basic building blocks of metz. Go to the playground to try those things, but come back soon! In the next section we will cover how to go beyond just one class and file.