Code vs Data
- Code is a generalization of data
- Example: fields vs getters
age
vs getAge()
- Code gives more flexibility
- Simply return field
- Compute it on the spot
- Fetch from database
- Read from file
- Get from webservice
- Example:
find
item in list
- Example: smarter config files
- Example: factory functions instead of classes
- Factory design pattern
- Dependency injection
- Service providers