Posts

Showing posts from May, 2024

Boundaries

Imagine that you have a well-designed application, possibly using dependency injection. It will almost always have a very thin layer visible in main() - capturing command-line parameters and environment variables, mainly[1], and then a call to an Application class which manages the rest of the initial logic - setting up resources such as logging, doing substantive validation of parameters, and creating and running the objects on the next level down which actually carry out the work of the application. This is simply following the SRP at a high level.

Convergence

This is an opinionated piece. Consider: fn handle_doubling_indicator(text: &str) -> (String, String) {     if text.len() == 7 { match &text[6..] {     "A" => ("First Mass".to_string(), text[0..5].to_string()),     "B" => ("Second Mass".to_string(), text[0..5].to_string()),     "C" =>  ("Third Mass".to_string(), text[0..5].to_string()),     "D" => ("Alternative observance".to_string(), text[0..5].to_string()),     "E" => ("Alternative propers".to_string(), text[0..5].to_string()),             _ => (String::new(), text.to_string()),         }     } else {         (String::new(), text.to_string())     } } and compare: std::pair<std::string, std::string> handle_doubling_indicator(const std::string &text) {   if (text.length() == 7)     {       switch (text[6]...