JS: Polymorphism
Theory: Dispatch by file
pages.courses.lessons.theory_unit.sign_up_block_title
Another interesting trick is dispatching by file name.
In some systems, it's common to have different files belonging to separate environments for configuration rather than one file. For example:
configs/
database.development.json
database.production.json
database.test.json
Somewhere in the source code must be a code block that selects which file to load. The code below uses dispatching by key:
It is not difficult to see that using a startup environment name. So we can create a suitable file name. Let us do that:
The code is much shorter and no longer needs to be changed when expanding.

