From b38e7da76fdd386506be68295ae828e7086aa6bd Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 20 Feb 2025 00:10:54 +0000 Subject: [PATCH] Add daily email for 2025-02-07 Having less code than you started with --- source/_daily_emails/2025-02-07.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 source/_daily_emails/2025-02-07.md diff --git a/source/_daily_emails/2025-02-07.md b/source/_daily_emails/2025-02-07.md new file mode 100644 index 00000000..e17a9d7b --- /dev/null +++ b/source/_daily_emails/2025-02-07.md @@ -0,0 +1,30 @@ +--- +title: Having less code than you started with +date: 2025-02-07 +permalink: daily/2025/02/07/less +tags: + - software-development +cta: ~ +snippet: | + My favourite type of commits and merge requsts are ones that have less code than there was before. +--- + +When running commands like `git log` or viewing pull requests, you can see the number of lines that have been added, edited or removed. + +When adding new features, it's likely you'll be adding code. + +If you're refactoring code, you may have less code than before. + +I like commits like this. + +It's not true that having fewer lines of code means the code is better, but having less code makes it easier to maintain and more secure. + +You don't need to upgrade and maintain code that you aren't using, so why not remove it? + +Why have old TODO comments, `dd()`, `var_dump()` or `console.log()` functions in the code? + +If they're not used, they can be removed. + +I recently read a post that suggested there were 5 to 10 bugs in each 1,000 lines of production code as a general rule, so the less code there is, the fewer places there are for bugs to hide. + +In general, for production code, less is more.