Image: Bullet Proof Glass
- They define the interface and cannot be used without the required parameters. They are the interface.
- They allow the movement of functions to any other file. A great way to aggregate similar functionality.
- They can expose redundant functions or at least allow for better refactoring using decorator function patterns.
- When aggregated in one file, they are instantly discoverable using the export keyword. Just import the file and all the functions are found using intellisense.
- Typescript type annotations make them safe during development to find errors before run time.
The Typescript function is a true first class citizen. This means they are ideally suited to alter other View Class behavior. They would be the small parts we talk about when creating code manufacturing pipelines.
This makes function composition the single most favored aspect for creating reusable Views. Keep the view as simple as possible and create reusable functions that act on one or more Views.
If we continue doing this we will see other patterns emerge as we attempt to get to the most abstract of patterns. The more abstract the more they are used. This is good because the more they are used the more bullet proof they become.
JWP2020 Function Parameters