Make is Simple
Complexity is only Simplicity x 1000 -- A mathematician friend once told me that. The idea struck a chord with me and has stuck with me ever since.
Everything in this world is complex. When we design computer systems our goals should be to encapsulate that complexity into simple business level concepts. They in turn can be broken down into smaller and smaller simple systems - and then no part of the system will be complex on its own.
Here is an example. Say you need to download and update pricing information on a regular bases. The new process should simple be called 'Update Prices'.
I - The process could have the following simple breakdown:
- Update Prices
- Download Pricing
- Load New Pricing Data
- Update Pricing Data
- Download Pricing:
- Get External Resource URI from config
- Get External Source Dir from config
- Get Local Destination Dir, from config
- SFTP Download files
- Get External Resource URI from config
- Create a Config Module that reads YAML config file
- Create environment variable to set config file name
- Provide getter methods for each config value
- Create YAML config files, (one for dev, staging, and prod)
- Create a Config Module that reads YAML config file
- Load YAML parser
- Set config filename = config.basedir + / + ENV(CONFIG)
- yaml.parse(read filename)