oliverdavies.uk/content/node.e187ec3b-5cde-4ab2-8c05-2d38eaa99756.yml

84 lines
3.3 KiB
YAML

uuid:
- value: e187ec3b-5cde-4ab2-8c05-2d38eaa99756
langcode:
- value: en
type:
- target_id: daily_email
target_type: node_type
target_uuid: 8bde1f2f-eef9-4f2d-ae9c-96921f8193d7
revision_timestamp:
- value: '2025-05-11T09:00:06+00:00'
revision_uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
revision_log: { }
status:
- value: true
uid:
- target_type: user
target_uuid: b8966985-d4b2-42a7-a319-2e94ccfbb849
title:
- value: 'Make the change easy, then make the easy change'
created:
- value: '2024-10-04T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:06+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2024/10/04/make-the-change-easy--then-make-the-easy-change
langcode: en
body:
- value: |
<p>This week, I've been working on a particular component that processes and displays live data from APIs.</p>
<p>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.</p>
<p>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.</p>
<p>I'm reminded of the quote by Kent Beck:</p>
<blockquote>
<p>For each desired change, make the change easy (warning: this may be hard), then make the easy change.</p>
</blockquote>
<p>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.</p>
<p>To make the change easy, I created a fake version of the service class that returns static data I can work with.</p>
<p>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.</p>
<p>Now I can make the easy change.</p>
format: full_html
processed: |
<p>This week, I've been working on a particular component that processes and displays live data from APIs.</p>
<p>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.</p>
<p>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.</p>
<p>I'm reminded of the quote by Kent Beck:</p>
<blockquote>
<p>For each desired change, make the change easy (warning: this may be hard), then make the easy change.</p>
</blockquote>
<p>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.</p>
<p>To make the change easy, I created a fake version of the service class that returns static data I can work with.</p>
<p>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.</p>
<p>Now I can make the easy change.</p>
summary: null
field_daily_email_cta: { }