Different deployment environments (e.g., development, testing, staging and production) often require that different pieces of code are switched on and off. For example, you only want to send real emails in production and write to an email log in all other environments instead. Or your code to initialise the database should only run in the staging environment. A simple but hard to maintain way for such conditional code executions is to define a globally available variable such as isProductionSystem and write ...

Bernhard Knasmüller on Software Development