oliverdavies.uk/content/node.39813779-6ce3-4cac-b5c7-4b488066b9a9.json
2025-05-11 20:02:13 +01:00

100 lines
No EOL
3.8 KiB
JSON

{
"uuid": [
{
"value": "39813779-6ce3-4cac-b5c7-4b488066b9a9"
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
"value": "2025-04-21T01:21:19+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": "Good software is easy to test"
}
],
"created": [
{
"value": "2025-02-03T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-04-21T01:21:19+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2025\/02\/03\/testable",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>One piece of criteria for whether some software is good is whether it's easy to write automated tests for.<\/p>\n\n<p>I recently worked on a method that was more than 150 lines.<\/p>\n\n<p>It was difficult to understand, had too many responsibilities and didn't use dependency injection.<\/p>\n\n<p>This made it difficult to test.<\/p>\n\n<p>If it was split into several smaller methods or classes, each could be responsible for different aspects and have clear responsibilities.<\/p>\n\n<p>Each new method or class could have its own tests to verify its own functionality works.<\/p>\n\n<p>It would be easy to understand and identify and fix any issues.<\/p>\n\n<p>If dependency injection was used, things can be mocked or changed as needed to make the logic testable.<\/p>\n\n<p>If everything is in one large function, the code isn't testable.<\/p>\n\n<p>Even if it works now, it will be difficult to change in the future.<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>One piece of criteria for whether some software is good is whether it's easy to write automated tests for.<\/p>\n\n<p>I recently worked on a method that was more than 150 lines.<\/p>\n\n<p>It was difficult to understand, had too many responsibilities and didn't use dependency injection.<\/p>\n\n<p>This made it difficult to test.<\/p>\n\n<p>If it was split into several smaller methods or classes, each could be responsible for different aspects and have clear responsibilities.<\/p>\n\n<p>Each new method or class could have its own tests to verify its own functionality works.<\/p>\n\n<p>It would be easy to understand and identify and fix any issues.<\/p>\n\n<p>If dependency injection was used, things can be mocked or changed as needed to make the logic testable.<\/p>\n\n<p>If everything is in one large function, the code isn't testable.<\/p>\n\n<p>Even if it works now, it will be difficult to change in the future.<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "2025-04-21T01:21:19+00:00",
"guid": null,
"hash": "3ebf30f7b8a2b03f2ba95b73683d6184",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}