oliverdavies.uk/source/_daily_emails/2024-10-04.md
Oliver Davies 14d0433912 Add daily email for 2024-10-04
Make the change easy, then make the easy change
2024-10-09 23:03:05 +01:00

1.3 KiB

title date permalink tags cta snippet
Make the change easy, then make the easy change 2024-10-04 daily/2024/10/04/make-the-change-easy--then-make-the-easy-change
software-development
clean-code
~ Make the change easy, then make the easy change.

This week, I've been working on a particular component that processes and displays live data from APIs.

As the data is live, it's constantly changing and it's unlikely I'll see all the different states and use-cases that the data could be in.

There's also no guarantee the API will be available and I also may need to work offline with no Internet access to connect to the API.

I'm reminded of the quote by Kent Beck:

For each desired change, make the change easy (warning: this may be hard), then make the easy change.

In this case, to make the change easy, I need the data to be consistent, to see all the use-cases and permutations and to be available offline.

To make the change easy, I created a fake version of the service class that returns static data I can work with.

I can add whatever data I need to give me the examples and situations to work with and by implementing the same methods as the real service class, I can swap them without changing any other code.

Now I can make the easy change.