oliverdavies.uk/content/node.8108dc36-1eb3-487b-9c03-600c49a6d11c.json
2025-05-30 02:34:52 +01:00

100 lines
No EOL
4.1 KiB
JSON

{
"uuid": [
{
"value": "8108dc36-1eb3-487b-9c03-600c49a6d11c"
}
],
"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:18+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": "Conventions over readability?"
}
],
"created": [
{
"value": "2024-03-08T00:00:00+00:00"
}
],
"changed": [
{
"value": "2025-05-11T09:00:18+00:00"
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2024\/03\/08\/conventions-over-readability",
"langcode": "en"
}
],
"body": [
{
"value": "\n <p>I previously wrote about why you shouldn't use variable names like <code>$x<\/code> and <code>$y<\/code> in your code and why you should use more descriptive names.<\/p>\n\n<p>But what if there is an existing convention?<\/p>\n\n<p>For example, I use Lua to configure Neovim and noticed that it's common to use shortened variable names, such as <code>buffer<\/code> instead of <code>buffer_number<\/code> or <code>bufferNumber<\/code>.<\/p>\n\n<p>It's also common to use the variable <code>M<\/code> to declare a module. For example:<\/p>\n\n<pre><code class=\"language-lua\">local M = {}\nM.find_files = function()\n \/\/ ...\nend\n\nreturn M\n<\/code><\/pre>\n\n<p>Whilst <code>Module<\/code> would be a more descriptive name, would deviating from the convention be more confusing for anyone reading the code?<\/p>\n\n<p>Do the benefits of following a convention outweigh the benefits of using more descriptive variable and function names?<\/p>\n\n<p>Which would be easier for newcomers to your project or team to understand and allow them to be productive sooner?<\/p>\n\n ",
"format": "full_html",
"processed": "\n <p>I previously wrote about why you shouldn't use variable names like <code>$x<\/code> and <code>$y<\/code> in your code and why you should use more descriptive names.<\/p>\n\n<p>But what if there is an existing convention?<\/p>\n\n<p>For example, I use Lua to configure Neovim and noticed that it's common to use shortened variable names, such as <code>buffer<\/code> instead of <code>buffer_number<\/code> or <code>bufferNumber<\/code>.<\/p>\n\n<p>It's also common to use the variable <code>M<\/code> to declare a module. For example:<\/p>\n\n<pre><code class=\"language-lua\">local M = {}\nM.find_files = function()\n \/\/ ...\nend\n\nreturn M\n<\/code><\/pre>\n\n<p>Whilst <code>Module<\/code> would be a more descriptive name, would deviating from the convention be more confusing for anyone reading the code?<\/p>\n\n<p>Do the benefits of following a convention outweigh the benefits of using more descriptive variable and function names?<\/p>\n\n<p>Which would be easier for newcomers to your project or team to understand and allow them to be productive sooner?<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "1970-01-01T00:32:50+00:00",
"guid": null,
"hash": "517f057d243494aec133607af3972ad8",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}