oliverdavies.uk/content/node.7c632749-fb6d-4407-a8f2-aac72d959a4d.yml

65 lines
2.5 KiB
YAML

uuid:
- value: 7c632749-fb6d-4407-a8f2-aac72d959a4d
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:36+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: |
Comments as communication
created:
- value: '2023-07-21T00:00:00+00:00'
changed:
- value: '2025-05-11T09:00:36+00:00'
promote:
- value: false
sticky:
- value: false
default_langcode:
- value: true
revision_translation_affected:
- value: true
path:
- alias: /daily/2023/07/21/comments-as-communication
langcode: en
body:
- value: |
<p>I often hear that code should be "self-documenting".</p>
<p>Instead of writing a comment, you should create a function or class with that name instead.</p>
<p>Whilst I agree with this, I think that code comments shouldn't describe what the code is doing - they should explain why the code is needed and provide any additional context to the person reading it.</p>
<p>If a comment just says <code>Returns true</code> or <code>Sends an email</code>, that can be understood by reading the code, so isn't providing any extra value or context. They can also become outdated as the code changes.</p>
<p>If a line of code is needed to fix a certain state or situation, or if a piece of code isn't particularly readable and isn't obvious what it does, those are good times to add comments.</p>
format: full_html
processed: |
<p>I often hear that code should be "self-documenting".</p>
<p>Instead of writing a comment, you should create a function or class with that name instead.</p>
<p>Whilst I agree with this, I think that code comments shouldn't describe what the code is doing - they should explain why the code is needed and provide any additional context to the person reading it.</p>
<p>If a comment just says <code>Returns true</code> or <code>Sends an email</code>, that can be understood by reading the code, so isn't providing any extra value or context. They can also become outdated as the code changes.</p>
<p>If a line of code is needed to fix a certain state or situation, or if a piece of code isn't particularly readable and isn't obvious what it does, those are good times to add comments.</p>
summary: null
field_daily_email_cta: { }