DEV Community

Discussion on: Clean Code – Part 1

Collapse
 
metalmikester profile image
Michel Renaud

For values subject to change, we've used databases in the past. This way, authorized users could change them without our involvement. The tables were "insert only", with the date and username of insertion. This allowed us to, for example, run reports with the value (e.g., tax rate) at a given date if we needed to (as opposed to the current value). Call it time travel.

Stuff like DaysInTheWeek would be a constant in the code. It makes for more readable code as opposed to an hardcoded value.