oliverdavies.uk/content/node.ce877341-4025-4610-89b6-f1f4c9bfe5af.yml

80 lines
3 KiB
YAML

uuid:
- value: ce877341-4025-4610-89b6-f1f4c9bfe5af
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:00+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: 'Covering icky code with automated tests'
created:
- value: '2025-03-24T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:00+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2025/03/24/icky
langcode: en
body:
- value: |
<p>Every codebase has "icky" code.</p>
<p>Code that works but is difficult to read and understand, that most people will avoid working on.</p>
<p>It could be fragile and occasionally return different results or error.</p>
<p>It could be a suboptimal implementation.</p>
<p>I mention in <a href="/presentations/tdd-test-driven-drupal">my test-driven drupal talk</a> when I wrote some code that worked locally but didn't work because of the hosting setup and I had to rewrite the code in a different and less optimal way.</p>
<p>How do you build confidence around this code?</p>
<p>Write more automated tests around it.</p>
<p>This will make it easier to understand what the code does as the tests will act like examples and, as you find situations where the code can break, you can write tests to ensure it works as expected once fixed and will continue to work.</p>
<p>Once there are tests, the code will be easier to add to, change, refactor, read and understand.</p>
format: full_html
processed: |
<p>Every codebase has "icky" code.</p>
<p>Code that works but is difficult to read and understand, that most people will avoid working on.</p>
<p>It could be fragile and occasionally return different results or error.</p>
<p>It could be a suboptimal implementation.</p>
<p>I mention in <a href="http://default/presentations/tdd-test-driven-drupal">my test-driven drupal talk</a> when I wrote some code that worked locally but didn't work because of the hosting setup and I had to rewrite the code in a different and less optimal way.</p>
<p>How do you build confidence around this code?</p>
<p>Write more automated tests around it.</p>
<p>This will make it easier to understand what the code does as the tests will act like examples and, as you find situations where the code can break, you can write tests to ensure it works as expected once fixed and will continue to work.</p>
<p>Once there are tests, the code will be easier to add to, change, refactor, read and understand.</p>
summary: null
field_daily_email_cta: { }