76 lines
2.8 KiB
YAML
76 lines
2.8 KiB
YAML
uuid:
|
|
- value: ea06edab-74a5-42d4-add9-d4dce3d0f792
|
|
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:07+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: 'You need tests to refactor safely'
|
|
created:
|
|
- value: '2024-09-01T00:00:00+00:00'
|
|
changed:
|
|
- value: '2025-05-11T09:00:07+00:00'
|
|
promote:
|
|
- value: false
|
|
sticky:
|
|
- value: false
|
|
default_langcode:
|
|
- value: true
|
|
revision_translation_affected:
|
|
- value: true
|
|
path:
|
|
- alias: /daily/2024/09/01/you-need-tests-to-refactor-safely
|
|
langcode: en
|
|
body:
|
|
- value: |
|
|
<p><a href="/daily/2024/08/31/make-it-work-then-make-it-good">Once you have working code</a>, you can refactor it to make it better.</p>
|
|
|
|
<p>You can rename variables, extract new functions or classes, ensure the code is styled and formatted correctly - anything to make the code easier to read, understand or maintain.</p>
|
|
|
|
<p>But, the key thing is the code still needs to work.</p>
|
|
|
|
<p>You don't want to break working code and introduce a regression, even if it is messy or difficult to read.</p>
|
|
|
|
<p>The best way I know to approach this is by having automated tests covering this code, and ensure they are working and passing before starting to refactor.</p>
|
|
|
|
<p>Then you can run the tests again and ensure they still pass.</p>
|
|
|
|
<p>If they pass, the code still works and the refactoring was successful.</p>
|
|
|
|
<p>If not, the code is broken and you need to revert the changes and start again.</p>
|
|
|
|
|
|
format: full_html
|
|
processed: |
|
|
<p><a href="http://default/daily/2024/08/31/make-it-work-then-make-it-good">Once you have working code</a>, you can refactor it to make it better.</p>
|
|
|
|
<p>You can rename variables, extract new functions or classes, ensure the code is styled and formatted correctly - anything to make the code easier to read, understand or maintain.</p>
|
|
|
|
<p>But, the key thing is the code still needs to work.</p>
|
|
|
|
<p>You don't want to break working code and introduce a regression, even if it is messy or difficult to read.</p>
|
|
|
|
<p>The best way I know to approach this is by having automated tests covering this code, and ensure they are working and passing before starting to refactor.</p>
|
|
|
|
<p>Then you can run the tests again and ensure they still pass.</p>
|
|
|
|
<p>If they pass, the code still works and the refactoring was successful.</p>
|
|
|
|
<p>If not, the code is broken and you need to revert the changes and start again.</p>
|
|
|
|
|
|
summary: null
|
|
field_daily_email_cta: { }
|