From 43af028670eb89c3d906b11e178a1042c4cdda1a Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 24 Mar 2024 22:46:34 +0000 Subject: [PATCH] Add daily email for 2024-03-23 Write programs that do one thing and do it well --- source/_daily_emails/2024-03-23.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 source/_daily_emails/2024-03-23.md diff --git a/source/_daily_emails/2024-03-23.md b/source/_daily_emails/2024-03-23.md new file mode 100644 index 00000000..0065b648 --- /dev/null +++ b/source/_daily_emails/2024-03-23.md @@ -0,0 +1,30 @@ +--- +title: Write programs that do one thing and do it well +date: 2024-03-23 +permalink: archive/2024/03/23/write-programs-that-do-one-thing-and-do-it-well +tags: + - software-development + - unix + - linux +cta: ~ +snippet: | + Write programs that do one thing and do it well. +--- + +Over the last few days, I've written about watchers and running commands such as automated tests when files are changed. + +Some tools have this built in, whilst others don't. + +I've used different tools to do this and recently switched to `entr`. + +The previous one wasn't showing me the output from running Drupal automated tests, which `entr` does. + +I also like that it follows the UNIX philosophy of doing one thing well and working well with other programs. + +For example, to run my automated tests when I change a file, I need to run `find web/modules/custom | entr ./run test`. + +`entr` isn't concerned with how to find the list of files to watch - only what to do with them. + +To get the list of files, I use the `find` command and provide the files to `entr`. + +I also like to do this with my application code. I like to write small modules and libraries with clear boundaries and responsibilities, do their tasks well, and work well with other parts of the application.