[{"content":"\n100 Exercises to Learn Rust by Luca Palmieri was easily the most effective, hands-on resource I encountered while learning Rust. While Rustlings has its place for drilling isolated compiler errors, its exercises often feel too trivial and fragmented to build genuine architectural intuition. Luca\u0026rsquo;s course, by contrast, anchors the language mechanics to a continuous, realistic project that forces you to grapple with how Rust features fit together in practice. (Working through it in RustRover with inline AI completion turned off also kept me honest, since I had to actually reason through every borrow-checker error myself.)\nThe running project, building a ticket management system, was great motivation. Virtually every software developer has professional experience living inside ticket trackers, making the problem domain immediately intuitive without requiring any domain onboarding. We certainly didn\u0026rsquo;t build Jira; the domain model stayed intentionally lean with titles, descriptions, IDs, and statuses. That lightweight scope was an asset rather than a drawback: it gave just enough structural meat to naturally motivate constructor validation, state transitions, collection trade-offs (Vec to HashMap to BTreeMap), Index and IndexMut mechanics, and eventually multi-threaded client-server channels without getting bogged down in domain trivia:\n// Chapter 3 starts with basic struct encapsulation and invariant validation: pub struct Ticket { title: String, description: String, status: String, } impl Ticket { pub fn new(title: String, description: String, status: String) -\u0026gt; Self { if title.is_empty() || title.len() \u0026gt; 50 { panic!(\u0026#34;Title must not be empty and cannot exceed 50 bytes\u0026#34;); } if description.is_empty() || description.len() \u0026gt; 500 { panic!(\u0026#34;Description must not be empty and cannot exceed 500 bytes\u0026#34;); } if status != \u0026#34;To-Do\u0026#34; \u0026amp;\u0026amp; status != \u0026#34;In Progress\u0026#34; \u0026amp;\u0026amp; status != \u0026#34;Done\u0026#34; { panic!(\u0026#34;Only `To-Do`, `In Progress`, and `Done` statuses are allowed\u0026#34;); } Ticket { title, description, status } } pub fn title(\u0026amp;self) -\u0026gt; \u0026amp;str { \u0026amp;self.title } } I know Luca also has a dedicated Build Your Own Jira with Rust workshop, and I wonder if that repository builds out a more fully functional system. Given how clean and approachable his explanations and architectural style are, it\u0026rsquo;s definitely something I want to skim on GitHub.\nWhere this resource really shines is as a companion to The Rust Programming Language (TRPL). TRPL is indispensable for theory and foundational language semantics, but it is theory-heavy and its hands-on projects are sparse. 100 Exercises fills that exact void. It bridges the gap between reading about ownership and actually fighting the borrow checker across thread boundaries, interior mutability (RefCell, Mutex, RwLock), and scoped threads.\nChapter 7 (Threads) was the highlight of the second half, even if its ending felt a little anti-climactic: after spending nearly the entire chapter building out a channel-based client/server architecture, the final exercise swaps it out entirely for Arc\u0026lt;RwLock\u0026lt;TicketStore\u0026gt;\u0026gt;:\n// Chapter 7 builds out a multi-threaded client-server architecture using channels: enum Command { Insert { draft: TicketDraft, response_channel: SyncSender\u0026lt;TicketId\u0026gt;, }, Get { id: TicketId, response_channel: SyncSender\u0026lt;Option\u0026lt;Ticket\u0026gt;\u0026gt;, }, } pub struct TicketStoreClient { sender: SyncSender\u0026lt;Command\u0026gt;, } impl TicketStoreClient { pub fn insert(\u0026amp;self, draft: TicketDraft) -\u0026gt; Result\u0026lt;TicketId, OverloadedError\u0026gt; { let (response_sender, response_receiver) = std::sync::mpsc::sync_channel(1); self.sender .try_send(Command::Insert { draft, response_channel: response_sender, }) .map_err(|_| OverloadedError)?; Ok(response_receiver.recv().unwrap()) } } In Go or Elixir, the channel implementation would have been the final word, so pivoting to locks at the last minute felt abrupt, and we barely got to spend any time with that final concurrent design before moving on. Still, it drove home an important Rust distinction: because Send and Sync guarantee data-race freedom at compile time, Arc\u0026lt;RwLock\u0026lt;T\u0026gt;\u0026gt; is often the cleaner, lower-overhead choice for shared in-memory state, leaving channels for work queues and decoupled tasks:\n// The final concurrent iteration swaps out channels for an in-memory lock: #[derive(Clone)] pub struct TicketStore { tickets: Arc\u0026lt;RwLock\u0026lt;BTreeMap\u0026lt;TicketId, Ticket\u0026gt;\u0026gt;\u0026gt;, } impl TicketStore { pub fn new() -\u0026gt; Self { Self { tickets: Arc::new(RwLock::new(BTreeMap::new())), } } pub fn get(\u0026amp;self, id: TicketId) -\u0026gt; Option\u0026lt;Ticket\u0026gt; { let store = self.tickets.read().unwrap(); store.get(\u0026amp;id).cloned() } } Chapter 8 (Futures), by comparison, felt much thinner. Instead of continuing to evolve TicketStore, it drops down to small, contrived TcpListener echo examples (even looping back to threads via spawn_blocking), and leaves async primitives like Semaphore and tokio::sync channels as concepts rather than real exercises. You come away with the core mental model (Future state machines, Send across .await yield points, async-aware locks, and cancellation), but not much muscle memory.\nThe book wraps up with a Final Challenge to put an HTTP API in front of the ticket store. I really liked that Luca provided the spec as a requests.http file rather than rigid unit tests, because it gives you a clear contract while leaving the implementation completely open. Rather than guessing my way through axum, serde, and tokio all at once, though, I\u0026rsquo;m shelving the Final Challenge for now and heading straight into Luca\u0026rsquo;s Zero to Production in Rust. Once I have a proper foundation in Tokio and Rust web services, I\u0026rsquo;ll come back and tackle it from a place of knowledge rather than trial and error.\nFull book notes.\n","permalink":"https://llcawthorne.github.io/posts/100-exercises-to-learn-rust/","summary":"\u003cp\u003e\u003cimg alt=\"100 Exercises to Learn Rust cover\" loading=\"lazy\" src=\"/posts/100-exercises-to-learn-rust/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003ca href=\"https://rust-exercises.com/100-exercises/\"\u003e\u003cem\u003e100 Exercises to Learn Rust\u003c/em\u003e\u003c/a\u003e by\nLuca Palmieri was easily the most effective, hands-on resource I encountered\nwhile learning Rust. While \u003cem\u003eRustlings\u003c/em\u003e has its place for drilling isolated\ncompiler errors, its exercises often feel too trivial and fragmented to build\ngenuine architectural intuition. Luca\u0026rsquo;s course, by contrast, anchors the\nlanguage mechanics to a continuous, realistic project that forces you to\ngrapple with how Rust features fit together in practice. (Working through it in\nRustRover with inline AI completion turned off also kept me honest, since I\nhad to actually reason through every borrow-checker error myself.)\u003c/p\u003e","title":"100 Exercises to Learn Rust"},{"content":"I worked through Rustlings as a companion to The Rust Programming Language (TRPL), specifically the Brown University interactive version. TRPL is notoriously theory-heavy and practice-light, and you can easily spend an hour reading dense chapters on ownership, lifetimes, or trait bounds without writing a single line of standalone code. Rustlings exists to bridge that specific gap. It\u0026rsquo;s a 94-exercise compiler-driven drill where you run the watcher in a terminal, it fails on an exercise, and you edit the file until the compiler and tests go green.\nIf you\u0026rsquo;re reading TRPL or another conceptual text, it\u0026rsquo;s a useful companion. It serves roughly the same purpose as the comprehension quizzes in Brown\u0026rsquo;s interactive edition to keep you honest and prove you were actually paying attention to the chapter you just finished. The early sections start very lightly, drilling ownership moves and mutability:\n// Early exercises drill elementary syntax, mutability, and ownership moves: fn fill_vec(vec: Vec\u0026lt;i32\u0026gt;) -\u0026gt; Vec\u0026lt;i32\u0026gt; { let mut vec = vec; vec.push(88); vec } If you\u0026rsquo;re learning Rust through a project-oriented book like Command-Line Rust or 100 Exercises to Learn Rust, those early exercises are completely trivial and you\u0026rsquo;ll already be doing much heavier lifting in real projects.\nWhere Rustlings genuinely earned its keep was in the later sections, particularly the conversion exercises. TRPL barely touches From and Into, which is a notable omission for beginners, and Rustlings forces you to implement From, FromStr, TryFrom, TryInto, AsRef, and AsMut. You quickly see how standard library conventions click together, like how implementing FromStr unlocks .parse::\u0026lt;YourType\u0026gt;() everywhere for free, and implementing From on error types unlocks clean ? operator propagation without nested match pyramids:\n// The conversions section drills standard library traits TRPL glosses over: impl TryFrom\u0026lt;\u0026amp;[i16]\u0026gt; for Color { type Error = IntoColorError; fn try_from(slice: \u0026amp;[i16]) -\u0026gt; Result\u0026lt;Self, Self::Error\u0026gt; { let \u0026amp;[red, green, blue] = slice else { return Err(IntoColorError::BadLen); }; (red, green, blue).try_into() } } fn byte_counter\u0026lt;T: AsRef\u0026lt;str\u0026gt;\u0026gt;(arg: T) -\u0026gt; usize { arg.as_ref().len() } The exercises also highlight subtle differences that books often gloss over, like how as integer casting silently truncates high bits while .try_into() uses the type system to catch out-of-range values and return a Result, or how multi-arm macros require semicolons rather than commas between arms, and how collect() infers the destination container purely from return type annotations:\n// Late exercises drill declarative macro syntax and iterator transpositions: macro_rules! my_macro { () =\u0026gt; { println!(\u0026#34;Check out my macro!\u0026#34;); }; ($val:expr) =\u0026gt; { println!(\u0026#34;Look at this other macro: {}\u0026#34;, $val); }; } // Transposing a collection of Results using collect\u0026#39;s type inference: fn list_of_results() -\u0026gt; Result\u0026lt;Vec\u0026lt;i32\u0026gt;, DivisionError\u0026gt; { let numbers = [27, 297, 38502, 81]; let division_results = numbers.into_iter().map(|n| divide(n, 27)); division_results.collect() } The tooling itself is completely frictionless. The watcher compiles on save, advances automatically when tests pass, and it\u0026rsquo;s a nice touch that the solutions stay empty until after you solve the problem yourself. Most exercises take thirty seconds, and the few that took longer weren\u0026rsquo;t conceptually difficult so much as exercises in getting used to Rust\u0026rsquo;s strictness, like learning when slice destructuring binds an element as \u0026amp;\u0026amp;str instead of \u0026amp;str and balancing references until the compiler is happy. It\u0026rsquo;s not going to teach you software architecture or how to structure large crates, but as a quick drill to build syntactic muscle memory and get comfortable reading rustc diagnostics alongside TRPL, it does its job well.\nFull book notes.\n","permalink":"https://llcawthorne.github.io/posts/rustlings/","summary":"\u003cp\u003eI worked through \u003ca href=\"https://rustlings.rust-lang.org/\"\u003eRustlings\u003c/a\u003e as a companion to\n\u003cem\u003eThe Rust Programming Language\u003c/em\u003e (TRPL), specifically the\n\u003ca href=\"https://rust-book.cs.brown.edu\"\u003eBrown University interactive version\u003c/a\u003e. TRPL is\nnotoriously theory-heavy and practice-light, and you can easily spend an hour\nreading dense chapters on ownership, lifetimes, or trait bounds without writing\na single line of standalone code. Rustlings exists to bridge that specific gap.\nIt\u0026rsquo;s a 94-exercise compiler-driven drill where you run the watcher in a\nterminal, it fails on an exercise, and you edit the file until the compiler and\ntests go green.\u003c/p\u003e","title":"Rustlings"},{"content":"\nI just wrapped up The Rust Programming Language, specifically the Brown University interactive version, and the sheer volume of notes I ended up taking says a lot about how much substance is packed into it. It isn\u0026rsquo;t often that an introductory language book doubles as a long-term reference you know you\u0026rsquo;ll keep returning to, but this one definitely earns that spot, and I think it\u0026rsquo;s easily the best starting point for anyone serious about learning Rust.\nThe biggest strength of the book is how directly and thoroughly it tackles the genuinely hard parts of the language. It doesn\u0026rsquo;t hand-wave ownership, borrowing, lifetimes, trait objects, or smart pointers. Instead of giving you a quick overview and leaving you to battle the compiler on your own, it takes the time to build a clear mental model of how the language manages memory.\nThe early chapters introduce ownership and borrowing from first principles, contrasting brittle manual index tracking with safe string slices:\n// Chapter 4 introduces ownership and borrowing by contrasting index tracking // with safe string slices: fn first_word(s: \u0026amp;str) -\u0026gt; \u0026amp;str { let bytes = s.as_bytes(); for (i, \u0026amp;item) in bytes.iter().enumerate() { if item == b\u0026#39; \u0026#39; { return \u0026amp;s[0..i]; } } \u0026amp;s[..] } If there\u0026rsquo;s any real annoyance, it\u0026rsquo;s that the authors explain almost everything from first principles, which means if you already have experience in other languages, you\u0026rsquo;ll spend some time skimming through exhaustive explanations of elementary concepts that feel pretty self-explanatory. They definitely go into too much detail on some of the easy stuff in the early chapters, but that\u0026rsquo;s easy enough to forgive once you get to the meat of what makes Rust unique.\nBy the middle of the book, you dive into smart pointers and interior mutability, using RefCell\u0026lt;T\u0026gt; to mutate data behind an immutable borrow:\n// Chapter 15 introduces interior mutability with RefCell\u0026lt;T\u0026gt; for mock objects // where values must be mutated through an immutable reference: pub trait Messenger { fn send(\u0026amp;self, msg: \u0026amp;str); } struct MockMessenger { sent_messages: RefCell\u0026lt;Vec\u0026lt;String\u0026gt;\u0026gt;, } impl MockMessenger { fn new() -\u0026gt; MockMessenger { MockMessenger { sent_messages: RefCell::new(vec![]), } } } impl Messenger for MockMessenger { fn send(\u0026amp;self, message: \u0026amp;str) { self.sent_messages.borrow_mut().push(String::from(message)); } } Reading the Brown University edition felt like the right call, even if I\u0026rsquo;m only comparing it against what I imagine the standard text would be like without the interactive elements. The memory permission diagrams, which visually track read, write, and own permissions as variables move through their lifetimes, helped turn abstract borrow-checker rules into concrete states you can actually picture.\nThe ownership quizzes and design inventories were tough, too. They aren\u0026rsquo;t multiple-choice softballs, and they demand precise reasoning about the exact lines where borrows begin and end. Knowing they were constructed from real stumbling blocks on Stack Overflow makes the difficulty understandable, even when you get tripped up by a subtle edge case, and they really force you to confront your misconceptions before you carry them into a real project.\nBy the time I finished the final project, building a multi-threaded web server with a worker thread pool, I felt completely comfortable moving on to more hands-on, project-driven material:\n// The capstone project builds a multi-threaded web server with a worker // thread pool and a channel-based job queue: type Job = Box\u0026lt;dyn FnOnce() + Send + \u0026#39;static\u0026gt;; pub struct ThreadPool { workers: Vec\u0026lt;Worker\u0026gt;, sender: Option\u0026lt;mpsc::Sender\u0026lt;Job\u0026gt;\u0026gt;, } struct Worker { id: usize, thread: Option\u0026lt;thread::JoinHandle\u0026lt;()\u0026gt;\u0026gt;, } impl Worker { fn new(id: usize, receiver: Arc\u0026lt;Mutex\u0026lt;mpsc::Receiver\u0026lt;Job\u0026gt;\u0026gt;\u0026gt;) -\u0026gt; Worker { let thread = thread::spawn(move || loop { let message = receiver.lock().unwrap().recv(); match message { Ok(job) =\u0026gt; { job(); } Err(_) =\u0026gt; { break; } } }); Worker { id, thread: Some(thread), } } } Overall, it\u0026rsquo;s a demanding book, but it\u0026rsquo;s a remarkably effective foundation. If you can sit through the elementary explanations with a little patience, it gives you the conceptual grounding you need to stop fighting the compiler and actually start building things in Rust.\nFull book notes.\n","permalink":"https://llcawthorne.github.io/posts/the-rust-programming-language/","summary":"\u003cp\u003e\u003cimg alt=\"The Rust Programming Language cover\" loading=\"lazy\" src=\"/posts/the-rust-programming-language/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eI just wrapped up \u003cem\u003eThe Rust Programming Language\u003c/em\u003e, specifically the\n\u003ca href=\"https://rust-book.cs.brown.edu\"\u003eBrown University interactive version\u003c/a\u003e, and the\nsheer volume of notes I ended up taking says a lot about how much substance is\npacked into it. It isn\u0026rsquo;t often that an introductory language book doubles as a\nlong-term reference you know you\u0026rsquo;ll keep returning to, but this one definitely\nearns that spot, and I think it\u0026rsquo;s easily the best starting point for anyone\nserious about learning Rust.\u003c/p\u003e","title":"The Rust Programming Language"},{"content":"\nAt over 23 hours, this was a massive audiobook, but I think it\u0026rsquo;s one of the better books of software engineering advice I\u0026rsquo;ve read. The core framing is that programming is just the immediate act of producing code, while software engineering is what you have to do to keep that code sustainable over time and across a team, or as they put it, it\u0026rsquo;s programming if clever is a compliment and software engineering if clever is an accusation. Hyrum Wright is one of the co-authors, and you can tell he\u0026rsquo;s proud of Hyrum\u0026rsquo;s Law since it gets cited at least three times. It\u0026rsquo;s a solid observation though: with enough users, every observable quirk of your system becomes a contract someone depends on, and while Google obviously sees that at an extreme scale, I\u0026rsquo;ve seen it crop up even in my own smaller applications.\nWhile it\u0026rsquo;s true that not everyone works at the scale of Google or has the same need for code longevity, they tend to point out when their considerations are primarily scale-driven, and they share a lot of hard-won advice. They don\u0026rsquo;t shy away from making lessons out of where they\u0026rsquo;ve made mistakes either, offering several case studies where they openly admit they wish they had handled things better. A huge chunk of the book is about testing, and I really liked their emphasis on testing public behavior and outcomes rather than implementation details. They lean heavily toward using real dependencies or high-fidelity fakes instead of mocking everything out, which matches my own experience with mock-heavy tests becoming brittle and useless.\nThe chapters on Google’s internal tooling were interesting too, even if most of us don\u0026rsquo;t have the luxury of having thousands of software engineers around to develop custom build systems, code search tools, and entire languages just to support our core products. Still, their arguments for simple trunk-based development, short-lived branches, and relying on fast rollbacks rather than fear of releasing felt grounded in reality.\nSince this was another audiobook, my notes aren\u0026rsquo;t quite as filled out as normal, since I mostly just try to jot down core ideas when I\u0026rsquo;m listening on a run. There were plenty of good observations in here that I didn\u0026rsquo;t get down, but I think I managed to capture the main points that really struck me. It\u0026rsquo;s a long listen, but well worth the time.\n","permalink":"https://llcawthorne.github.io/posts/software-engineering-at-google/","summary":"\u003cp\u003e\u003cimg alt=\"Software Engineering at Google cover\" loading=\"lazy\" src=\"/posts/software-engineering-at-google/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eAt over 23 hours, this was a massive audiobook, but I think it\u0026rsquo;s one of the\nbetter books of software engineering advice I\u0026rsquo;ve read. The core framing is that\nprogramming is just the immediate act of producing code, while software\nengineering is what you have to do to keep that code sustainable over time and\nacross a team, or as they put it, it\u0026rsquo;s programming if clever is a compliment and\nsoftware engineering if clever is an accusation. Hyrum Wright is one of the\nco-authors, and you can tell he\u0026rsquo;s proud of Hyrum\u0026rsquo;s Law since it gets cited at\nleast three times. It\u0026rsquo;s a solid observation though: with enough users, every\nobservable quirk of your system becomes a contract someone depends on, and while\nGoogle obviously sees that at an extreme scale, I\u0026rsquo;ve seen it crop up even in my\nown smaller applications.\u003c/p\u003e","title":"Software Engineering at Google"},{"content":"\nThe Storm Before the Storm should have just been called Sulla: A History. Mike Duncan covers the decades from 146 BC to Sulla\u0026rsquo;s death in 78 BC, the stretch where the Roman Republic\u0026rsquo;s norms started breaking long before Caesar arrived, and while it spends a little time on the Gracchi and enough on Marius to set the stage, at least half the book belongs to Sulla. That isn\u0026rsquo;t really a complaint, though. Once Sulla shows up he dominates the period, and I learned a lot about a man I barely knew going in.\nI\u0026rsquo;m reading Tom Holland\u0026rsquo;s Rubicon now, and it probably covers enough of Sulla to pick up the story of Pompey, Crassus, and Caesar, but what Storm gave me was the grounding. Rubicon introduces Marius as a man in his sixties leading armies in the Social War, shortly before he comes out of retirement and starts his workout regimen, and without the earlier arc you lose the new man who saved Rome, held five consecutive consulships, and reorganized the army. Everyone comments on old Marius training with the young men on the Campus Martius, desperate for one more command. Coming from Storm, that reads as a fall from grace, but in Rubicon it mostly reads as stubbornness.\nStorm follows Marius all the way back to the war against Jugurtha, the Numidian king whose defeat made his name, and that showed me how far back the rivalry between Marius and Sulla goes. It starts at the very beginning of Marius\u0026rsquo;s career as a general. Sulla, serving under Marius, arranged Jugurtha\u0026rsquo;s capture and then put the scene on his personal seal ring, which was a brash move when Marius was the one commanding the army. Those early chapters are the parts left out of Rubicon that I valued most. Storm also gives more background on the Gracchi and a real grounding in the Italian citizenship problem, and its elaboration on the conditions that led to the Social War made the later story much easier to follow.\nSulla was the first Roman general to march his army on Rome, and he did it twice. He used that power and the proscriptions to restore the Senate\u0026rsquo;s traditional authority, a revolutionary acting in the service of conservatism, and then he took the dictatorship with no fixed end date, gave it up anyway, and retired to write his memoirs. It seems like such a bad idea to grab that much power and then not keep it. His reforms only rolled the clock back a little on the Senate\u0026rsquo;s decline, and his real legacy was the precedent that an army loyal to its general could take Rome. Caesar learned that lesson but not the resignation, and Suetonius has him joking that Sulla didn\u0026rsquo;t know his political ABCs. Augustus learned both lessons and was far shrewder, keeping the real power while making a great show of honoring the Senate.\nI hate to say it as a Cicero fan, but I suspect a lot of the populares\u0026rsquo; bad reputation comes from our conservative sources. Cicero is our richest witness, and he was firmly on the optimate side. Grain for the poor, land for farmers, and citizenship for the Italians are all good causes. Granted, some of the men promising them were after power rather than acting out of good-heartedness, and Cinna doesn\u0026rsquo;t sound particularly admirable, but I like the Gracchi, and I\u0026rsquo;m sorry about how it ended for them.\nAnytime debates are decided by armed gangs instead of the truth and strength of ideas, things have gone badly wrong, and Sulla\u0026rsquo;s purges were the natural, unfortunate outcome of a politics that had already moved from the Forum to the battlefield. At least he didn\u0026rsquo;t roll back citizenship and voting rights for the Italians. Then again, I suspect he would have if he hadn\u0026rsquo;t been forced to give his word to honor them so he wouldn\u0026rsquo;t have to fight his way back to Rome through all of Italy, and even with that promise, the Samnites fought him to the end at the Colline Gate.\nIf you\u0026rsquo;re planning to read Rubicon or anything else on Caesar, The Storm Before the Storm is a worthwhile ten-hour prequel. Duncan\u0026rsquo;s case that the Republic broke well before Caesar crossed the Rubicon makes the later story make more sense. I\u0026rsquo;ll cover Holland\u0026rsquo;s trilogy in one post once I finish it.\n","permalink":"https://llcawthorne.github.io/posts/the-storm-before-the-storm/","summary":"\u003cp\u003e\u003cimg alt=\"The Storm Before the Storm cover\" loading=\"lazy\" src=\"/posts/the-storm-before-the-storm/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eThe Storm Before the Storm\u003c/em\u003e should have just been called \u003cem\u003eSulla: A History\u003c/em\u003e.\nMike Duncan covers the decades from 146 BC to Sulla\u0026rsquo;s death in 78 BC, the\nstretch where the Roman Republic\u0026rsquo;s norms started breaking long before Caesar\narrived, and while it spends a little time on the Gracchi and enough on Marius\nto set the stage, at least half the book belongs to Sulla. That isn\u0026rsquo;t really a\ncomplaint, though. Once Sulla shows up he dominates the period, and I learned a\nlot about a man I barely knew going in.\u003c/p\u003e","title":"The Storm Before the Storm"},{"content":"\nHaskell Programming from First Principles by Chris Allen and Julie Moronuki, better known as The Haskell Book, is a massive book. My copy runs around 1,200 pages, and I worked through all of it, exercises and all, minus a few at the very end. This was actually my second attempt. The first time I fell off somewhere around page 300, since the pace was slow and nothing in the book had me building things, so I lost momentum. This time I paired it with Learn Haskell by Example for projects and Learn You a Haskell as light reading on the side, and that combination is what got me through, with The Haskell Book building up the theory and Learn Haskell by Example giving me a wide variety of places to apply it.\nNormally my personal notes distill a book down to a third or a half of the original size, but with The Haskell Book, it turned a 1,200-page volume into about 100 pages of dense prose. Even having finished the book, I wouldn\u0026rsquo;t say I fully understand Haskell, but at least the 100 pages of dense notes I took still make sense. It\u0026rsquo;s really like taking notes on a math book: once you skip all the exercises, the amount of material leftover is short but dense.\nThe explanations are excellent, if somewhat longwinded, and the book is really good at taking complicated concepts and making them understandable. It\u0026rsquo;s slow, and in the early chapters on types and type classes it\u0026rsquo;s almost mind-numbingly slow, since those concepts are fairly straightforward, but the slow style pays off once you hit the stuff that\u0026rsquo;s actually hard. Folding is a good example. Most books show you how to sum a list with a fold, maybe implement map and filter with one, and call folding a learned concept. The Haskell Book gives it 40 solid pages, which is kind of a big deal if you come from a language where you\u0026rsquo;d normally just reach for a while loop.\nThe early chapters build up recursion and list processing from first principles, showing that every function is curried before taking a deep dive into explicit spine traversal and folding:\n-- Early chapters build up functions and recursion from basic pattern matching: myZipWith :: (a -\u0026gt; b -\u0026gt; c) -\u0026gt; [a] -\u0026gt; [b] -\u0026gt; [c] myZipWith _ [] _ = [] myZipWith _ _ [] = [] myZipWith f (x:xs) (y:ys) = f x y : myZipWith f xs ys -- Folding gets an exhaustive 40-page treatment, demonstrating spine traversal: foldr :: (a -\u0026gt; b -\u0026gt; b) -\u0026gt; b -\u0026gt; [a] -\u0026gt; b foldr _ z [] = z foldr f z (x:xs) = f x (foldr f z xs) -- Defining standard operations in terms of foldr: myFilter :: (a -\u0026gt; Bool) -\u0026gt; [a] -\u0026gt; [a] myFilter p = foldr (\\x acc -\u0026gt; if p x then x : acc else acc) [] The type class chapters were the best part of the book for me. Semigroup, Monoid, Functor, Applicative, Monad, Foldable, and Traversable each get a full treatment, laws included, and you write a lot of instances yourself. It was the first resource I\u0026rsquo;d read that pressed hard on the monoidal part of Applicative. Advanced Functional Programming with Elixir had already shown me ap collecting all your validation errors instead of stopping at the first one, but it never pointed out that the collecting comes from the monoidal side of Applicative, combining the structures themselves rather than just applying functions inside them, so I didn\u0026rsquo;t really understand why it worked. That\u0026rsquo;s the piece that made Validation finally make sense to me:\n-- Validation behaves like Either, but accumulates errors monoidally: data Validation e a = Failure e | Success a deriving (Eq, Show) instance Functor (Validation e) where fmap _ (Failure err) = Failure err fmap f (Success a) = Success (f a) -- The monoidal side of Applicative: combining failures with (\u0026lt;\u0026gt;): instance Monoid e =\u0026gt; Applicative (Validation e) where pure = Success Failure e1 \u0026lt;*\u0026gt; Failure e2 = Failure (e1 \u0026lt;\u0026gt; e2) Failure e1 \u0026lt;*\u0026gt; _ = Failure e1 _ \u0026lt;*\u0026gt; Failure e2 = Failure e2 Success f \u0026lt;*\u0026gt; Success a = Success (f a) -- Collecting all validation errors instead of short-circuiting on the first: validatePerson :: Validation [String] Person validatePerson = Person \u0026lt;$\u0026gt; validateName \u0026#34;Chris\u0026#34; \u0026lt;*\u0026gt; validateAge 30 \u0026lt;*\u0026gt; validateEmail \u0026#34;chris@example.com\u0026#34; By the end, \u0026ldquo;follow the types\u0026rdquo; had become my main problem-solving strategy. Most of the time, once I figured out what the types required, there was only one sensible thing I could write that would compile. It sometimes felt a bit like quantum mechanics, where I could trust the equations the same way I trust the types, even when I wasn\u0026rsquo;t totally sure what it all meant. The book also cites research papers, which is unusual for an introductory programming book (Head First Go sure didn\u0026rsquo;t point me at any current research). It\u0026rsquo;s a quirk of the Haskell community, and while I\u0026rsquo;m not sure I\u0026rsquo;ll ever make it through Wadler \u0026lsquo;89, I appreciated the pointers.\nThere are a lot of exercises, more than in any other programming book I\u0026rsquo;ve read. They normally reach a little past what the chapter covered, but I could work through everything except maybe a challenge problem at the end without needing help. Some were just typing practice, since once you\u0026rsquo;ve written a Semigroup instance for Two a b, Three a b c and Four a b c d don\u0026rsquo;t teach you anything new. Others were genuinely hard, like writing a Semigroup for a type that wraps a function, which took my whole reading session.\nMy biggest complaint is that, for all the time it spends explaining concepts, the book is pretty light on using them in anger. I came out of the Monad and Transformers chapters knowing how to build a monad or a transformer from scratch, but without much sense of how to use them in a real program. I even had to write StateT myself as an exercise, supposedly the most obnoxious of the standard transformers, without ever seeing much of it in action, so Learn Haskell by Example is where I\u0026rsquo;m going to get that practice.\nTesting follows a similar pattern. The testing chapter is solid, it covers hspec and QuickCheck, explains generators well (including the difference between product and sum types), and points you to a real project to see tests in the wild, and the book goes on to reuse QuickCheck and checkers to test the type class laws, which is great. But it mostly used tests to show off checkers for testing laws and never really embraced testing ordinary, run-of-the-mill code. There were no tests for roughly the last ten chapters, and none in the final project, and it isn\u0026rsquo;t much of a project without tests.\nThe Parsers chapter was the big outlier. I understood all of the material as it was presented, it just wasn\u0026rsquo;t an adequate build-up to the exercises: \u0026ldquo;Here\u0026rsquo;s how to parse a char. Cool, now figure out a log file.\u0026rdquo; It used \u0026lt;|\u0026gt; in an exercise several pages before introducing it, told you to \u0026ldquo;try try\u0026rdquo; without explaining it, and introduced tokenization mostly through examples of doing it wrong. Then it asked for a SemVer parser, IPv4 and IPv6 parsers, and a parser for Graphviz\u0026rsquo;s DOT language, and that chapter took me about a week.\nQuality control seems to slip a bit as you go, too. Somewhere past page 900 the explanations got thinner. The JSON section switched examples halfway through and barely spent time on either, so I\u0026rsquo;ve seen aeson parse JSON, but I wouldn\u0026rsquo;t say I\u0026rsquo;m ready to use it. The exceptions chapter was all toy examples, never mentioned bracket or finally, and used catching SomeException as an example. The Composing Types chapter opened with a \u0026ldquo;warmup\u0026rdquo; that had me write the Applicative instance for Compose, and that was anything but a warmup. I also found a handful of errata. The State chapter has runState f \u0026gt;\u0026gt; f 0 where it needs parentheses. The book claims zipWith is just liftA2 specialized to lists, then immediately shows them producing different results. One Applicative exercise looks like it\u0026rsquo;s setting you up to produce Just 11 but can only ever produce Just 5. And it has you name constructors Success and Failure right after telling you to import QuickCheck, which already exports both.\nThe book is about ten years old, and you\u0026rsquo;ll feel it. The original project files pin GHC 8.6.5, which doesn\u0026rsquo;t even exist for Apple Silicon, the checkers tuple shapes for testing Traversable had changed, an old version of trifecta wanted a decade-old set of dependencies, and the final project uses network functions that have since been renamed, so I spent a fair amount of time fighting dependencies. I don\u0026rsquo;t hold version drift against a ten-year-old book, though, just expect to update some resolvers and function names as you go. The Basic Libraries chapter was like a museum trip, but most of the exhibits are still alive.\nThe final project is a finger daemon backed by SQLite. Honestly, it didn\u0026rsquo;t feel like much of a final project, since I mostly typed in the code from the book, but most of the prose explaining it felt unnecessary, which tells me the book did a good job preparing me, and it could have just been a code listing. The chapter starts out with a simple socket debug program that logs and echoes incoming bytes:\n-- Chapter 31 starts with a basic socket program that logs and echoes input: logAndEcho :: Socket -\u0026gt; IO () logAndEcho sock = forever $ do (soc, _) \u0026lt;- accept sock printAndKickback soc close soc where printAndKickback conn = do msg \u0026lt;- recv conn 1024 print msg sendAll conn msg From there, it builds up into a full-fledged, SQLite-backed modern finger daemon, using the applicative combinators from Chapter 17 to decode database rows:\n-- Building up to a full SQLite-backed network finger daemon: data User = User { userId :: Integer , username :: Text , shell :: Text , homeDirectory :: Text , realName :: Text , phone :: Text } deriving (Eq, Show) -- Using the applicative combinators from Chapter 17 to decode database rows: instance FromRow User where fromRow = User \u0026lt;$\u0026gt; field \u0026lt;*\u0026gt; field \u0026lt;*\u0026gt; field \u0026lt;*\u0026gt; field \u0026lt;*\u0026gt; field \u0026lt;*\u0026gt; field getUser :: Connection -\u0026gt; Text -\u0026gt; IO (Maybe User) getUser conn username = do results \u0026lt;- query conn getUserQuery (Only username) case results of [] -\u0026gt; return Nothing [user] -\u0026gt; return (Just user) _ -\u0026gt; throwIO DuplicateData handleQuery :: Connection -\u0026gt; Socket -\u0026gt; IO () handleQuery dbConn soc = do msg \u0026lt;- recv soc 1024 case msg of \u0026#34;\\r\\n\u0026#34; -\u0026gt; returnUsers dbConn soc name -\u0026gt; returnUser dbConn soc (decodeUtf8 name) handleQueries :: Connection -\u0026gt; Socket -\u0026gt; IO () handleQueries dbConn sock = forever $ do (soc, _) \u0026lt;- accept sock handleQuery dbConn soc close soc The exercises at the end go from \u0026ldquo;use the sqlite3 CLI to add a user\u0026rdquo; to \u0026ldquo;build a control socket on another port while the server runs,\u0026rdquo; which is basically \u0026ldquo;go read Marlow\u0026rsquo;s book on concurrency and come back to this project.\u0026rdquo; I skipped straight to the last step: celebrate completing this massive book.\nOverall, The Haskell Book is the best resource I\u0026rsquo;ve found for actually understanding Haskell. If you want to know why Applicative works the way it does, or what the Functor laws are for, this is the book. Just don\u0026rsquo;t expect it to teach you to build things. It\u0026rsquo;s light on putting its concepts to work, it drops testing for the last third, and the later chapters have a lot less polish than the early ones, so I wouldn\u0026rsquo;t have finished it without a project book alongside it. With one, it was well worth the 1,200 pages.\n","permalink":"https://llcawthorne.github.io/posts/haskell-programming-from-first-principles/","summary":"\u003cp\u003e\u003cimg alt=\"Haskell Programming from First Principles cover\" loading=\"lazy\" src=\"/posts/haskell-programming-from-first-principles/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eHaskell Programming from First Principles\u003c/em\u003e by Chris Allen and Julie Moronuki,\nbetter known as \u003cem\u003eThe Haskell Book\u003c/em\u003e, is a massive book. My copy runs around 1,200\npages, and I worked through all of it, exercises and all, minus a few at the\nvery end. This was actually my second attempt. The first time I fell off\nsomewhere around page 300, since the pace was slow and nothing in the book had\nme building things, so I lost momentum. This time I paired it with \u003cem\u003eLearn\nHaskell by Example\u003c/em\u003e for projects and \u003cem\u003eLearn You a Haskell\u003c/em\u003e as light reading on\nthe side, and that combination is what got me through, with \u003cem\u003eThe Haskell Book\u003c/em\u003e\nbuilding up the theory and \u003cem\u003eLearn Haskell by Example\u003c/em\u003e giving me a wide variety\nof places to apply it.\u003c/p\u003e","title":"Haskell Programming from First Principles"},{"content":"Learn Haskell by Building a Blog Generator is a free online book that teaches Haskell through a single project, a small static blog generator. It\u0026rsquo;s short, around 150 pages if you export it to PDF, and that\u0026rsquo;s a big part of its appeal. I read it during a week when my laptop was in the shop, as a bounded, finishable side project to fill the gap while my main Haskell books (The Haskell Book and Haskell by Example) were on hold.\nInstead of teaching concepts in a neat progression and then applying them, the book introduces Haskell features only when the project needs them. You build an HTML printer library, design a small custom markup language and a parser for it, glue the two together into a working converter, and then add error handling and support for multiple files, pass configuration through an environment, and finish up with tests and generated documentation. The HTML side is built as a small embedded domain-specific language (EDSL), and it\u0026rsquo;s really pleasant to use. Along the way the book makes some smart, practical design points, like keeping implementation details in an Html.Internal module while exposing a clean public API with an explicit export list, and using newtype to keep raw strings and HTML from getting mixed up:\n-- Chapter 3 starts by creating a type-safe HTML domain-specific language: newtype Html = Html String newtype Structure = Structure String newtype Title = Title String html_ :: Title -\u0026gt; Structure -\u0026gt; Html html_ (Title title) (Structure content) = Html ( el \u0026#34;html\u0026#34; ( el \u0026#34;head\u0026#34; (el \u0026#34;title\u0026#34; (escape title)) \u0026lt;\u0026gt; el \u0026#34;body\u0026#34; content ) ) p_ :: String -\u0026gt; Structure p_ = Structure . el \u0026#34;p\u0026#34; . escape h1_ :: String -\u0026gt; Structure h1_ = Structure . el \u0026#34;h1\u0026#34; . escape render :: Html -\u0026gt; String render (Html str) = str What worked best is that you end up with a real, working tool instead of a pile of toy exercises, and that makes the concepts stick in a way pure explanation doesn\u0026rsquo;t. Records, recursion, Either for error handling, and passing an environment through a program all show up because the project needs them, so their purpose is obvious. The custom markup parser in the middle of the book gives a very practical demonstration of recursive list processing and stateful pattern matching across text lines:\n-- The middle chapters design a custom markup parser using recursive pattern matching: type Document = [Structure] data Structure = Heading Natural String | Paragraph String | UnorderedList [String] | CodeBlock [String] deriving (Eq, Show) parseLines :: Maybe Structure -\u0026gt; [String] -\u0026gt; Document parseLines context txts = case txts of [] -\u0026gt; maybeToList context (\u0026#39;*\u0026#39; : \u0026#39; \u0026#39; : line) : rest -\u0026gt; maybe id (:) context (Heading 1 (trim line) : parseLines Nothing rest) (\u0026#39;-\u0026#39; : \u0026#39; \u0026#39; : line) : rest -\u0026gt; case context of Just (UnorderedList list) -\u0026gt; parseLines (Just (UnorderedList (list \u0026lt;\u0026gt; [trim line]))) rest _ -\u0026gt; maybe id (:) context (parseLines (Just (UnorderedList [trim line])) rest) currentLine : rest -\u0026gt; let line = trim currentLine in if line == \u0026#34;\u0026#34; then maybe id (:) context (parseLines Nothing rest) else case context of Just (Paragraph p) -\u0026gt; parseLines (Just (Paragraph (unwords [p, line]))) rest _ -\u0026gt; maybe id (:) context (parseLines (Just (Paragraph line)) rest) Threading configuration through the program was my first hands-on look at the Reader pattern and monad transformers, well before my other books covered them in depth. Chapter 7 replaces manual Env parameter passing with Reader:\n-- Chapter 7 replaces manual Env threading with Reader: -- Before: txtsToRenderedHtml :: Env -\u0026gt; [(FilePath, String)] -\u0026gt; [(FilePath, String)] txtsToRenderedHtml env txtFiles = let txtOutputFiles = map toOutputMarkupFile txtFiles index = (\u0026#34;index.html\u0026#34;, buildIndex env txtOutputFiles) htmlPages = map (convertFile env) txtOutputFiles in map (fmap Html.render) (index : htmlPages) -- After: Reader threads Env implicitly through do notation: txtsToRenderedHtml :: [(FilePath, String)] -\u0026gt; Reader Env [(FilePath, String)] txtsToRenderedHtml txtFiles = do let txtOutputFiles = map toOutputMarkupFile txtFiles index \u0026lt;- (,) \u0026#34;index.html\u0026#34; \u0026lt;$\u0026gt; buildIndex txtOutputFiles htmlPages \u0026lt;- traverse convertFile txtOutputFiles pure $ map (fmap Html.render) (index : htmlPages) The testing chapter uses hspec with automatic test discovery, which was nice to work with, and it left me with a much better impression of Haskell testing than the cruder harness in another book I was reading at the time. It also takes a worthwhile detour into optparse-applicative instead of hand-rolling argument parsing.\nThe later chapters thin out, though. The testing chapter only tests one module and leaves the rest as optional practice, and the documentation chapter is brief, so both feel like they were written in more of a hurry than the core project chapters. At least one example didn\u0026rsquo;t compile as written either, since the Reader chapter needed an mtl import the text never mentions, which is easy to fix but is the kind of thing that stalls a beginner. The generator also reads its own simple markup language instead of Markdown. For a tutorial this short, that\u0026rsquo;s the practical choice, since writing a full Markdown parser would swallow the book, but it does limit how useful the finished tool is. And I read it in a three-day binge, which it\u0026rsquo;s short enough to allow, but I\u0026rsquo;d recommend spreading it out so the material has time to sink in.\nI wouldn\u0026rsquo;t replace Hugo with the generator. It lacks the stuff you take for granted in a mature static site generator, like nice themes and extensions, and all my existing posts are written in Markdown instead of its custom markup, so porting them over would be a pain. That\u0026rsquo;s not really the point, though. The point is learning Haskell by building something real, and the book does that well.\nOverall it\u0026rsquo;s a short, practical, and enjoyable introduction to building a real program in Haskell. Its biggest strength is that every concept shows up attached to a reason to use it, and its weaknesses are mostly at the end, where testing and documentation get thinner treatment, plus the occasional example that doesn\u0026rsquo;t compile as written. It works best alongside a more thorough book that explains the theory the project leans on.\n","permalink":"https://llcawthorne.github.io/posts/learn-haskell-by-building-a-blog-generator/","summary":"\u003cp\u003e\u003ca href=\"https://learn-haskell.blog/\"\u003e\u003cem\u003eLearn Haskell by Building a Blog Generator\u003c/em\u003e\u003c/a\u003e is a\nfree online book that teaches Haskell through a single project, a small static\nblog generator. It\u0026rsquo;s short, around 150 pages if you export it to PDF, and that\u0026rsquo;s\na big part of its appeal. I read it during a week when my laptop was in the\nshop, as a bounded, finishable side project to fill the gap while my main\nHaskell books (\u003cem\u003eThe Haskell Book\u003c/em\u003e and \u003cem\u003eHaskell by Example\u003c/em\u003e) were on hold.\u003c/p\u003e","title":"Learn Haskell by Building a Blog Generator"},{"content":"\nLearn You a Haskell (LYAH) is the friendly, illustrated, free online Haskell introduction that a lot of people start with. I read it as the third track in my Haskell study, alongside The Haskell Book for the deep theory and laws and Haskell by Example for project-driven practice, and I own it in print, mostly to support the author.\nLYAH ended up being my \u0026ldquo;medium\u0026rdquo; book. It wasn\u0026rsquo;t demanding enough to need my protected morning focus time, but it wasn\u0026rsquo;t throwaway reading either. It moves fast and covers an enormous amount of ground in relatively few pages, and it rarely gives you exercises, so it was easy to pick up between chapters of my heavier books, but I also retained less from it than from the books where I was typing and testing code. More than once I described it as a book where you\u0026rsquo;re lucky to keep anything, but you\u0026rsquo;ll recognize the topic when it comes up again somewhere else, and that turned out to be worth a lot, since plenty of concepts were already familiar by the time The Haskell Book covered them properly.\nSome of its explanations are really excellent, good enough that I thought about a second pass just to capture them in notes. Its treatment of IO and functors pushed back on the \u0026ldquo;IO is a magic box\u0026rdquo; idea I\u0026rsquo;d picked up elsewhere and reframed IO as just one more thing that supports fmap. Folding a tree with foldMap into any monoid was the first time Monoid felt useful to me. Toy examples like Sum and Product never sold it, since + and * are already right there, but one traversal that can collapse the structure in different ways depending only on which monoid you pick is the real pitch. The State monad clicked here too, and it made it clear that State solves a problem you mostly only have in a pure language. Using filterM with a Writer to log was intuitive, and using it with [True, False] to generate a power set was a great \u0026ldquo;aha\u0026rdquo; moment for how the list monad branches. The Monads and Zippers chapters are the standouts, and if someone only read two chapters of LYAH, I\u0026rsquo;d point them there.\nIt does have some weak spots. Without exercises, a lot slides by, so it\u0026rsquo;s more of a tour than a workout. It uses some functions before explaining them, like leaning on sequenceA and comparing it to sequence without ever properly introducing sequence, which is easy enough to fill in but adds friction. And it just stops, with no wrap-up or sense of where to go next, so it reads like an online tutorial that got bound into a book, which is basically what it is.\nLYAH is a good read and a great companion book, but not a primary one. Its best explanations (IO, Functor, Monoid via foldMap, State, Monads, and Zippers) make it worth reading on their own, and its breadth gives you a mental map of the territory, but if you want Haskell to stick, pair it with something that makes you write code. For me, The Haskell Book supplied the depth and the laws, Haskell by Example supplied the projects, and LYAH supplied friendly first encounters and a few explanations I still think are the best I\u0026rsquo;ve seen.\n","permalink":"https://llcawthorne.github.io/posts/learn-you-a-haskell/","summary":"\u003cp\u003e\u003cimg alt=\"Learn You a Haskell for Great Good! cover\" loading=\"lazy\" src=\"/posts/learn-you-a-haskell/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eLearn You a Haskell\u003c/em\u003e (LYAH) is the friendly, illustrated, free online Haskell\nintroduction that a lot of people start with. I read it as the third track in my\nHaskell study, alongside \u003cem\u003eThe Haskell Book\u003c/em\u003e for the deep theory and laws and\n\u003cem\u003eHaskell by Example\u003c/em\u003e for project-driven practice, and I own it in print, mostly\nto support the author.\u003c/p\u003e\n\u003cp\u003eLYAH ended up being my \u0026ldquo;medium\u0026rdquo; book. It wasn\u0026rsquo;t demanding enough to need my\nprotected morning focus time, but it wasn\u0026rsquo;t throwaway reading either. It moves\nfast and covers an enormous amount of ground in relatively few pages, and it\nrarely gives you exercises, so it was easy to pick up between chapters of my\nheavier books, but I also retained less from it than from the books where I was\ntyping and testing code. More than once I described it as a book where you\u0026rsquo;re\nlucky to keep anything, but you\u0026rsquo;ll recognize the topic when it comes up again\nsomewhere else, and that turned out to be worth a lot, since plenty of concepts\nwere already familiar by the time \u003cem\u003eThe Haskell Book\u003c/em\u003e covered them properly.\u003c/p\u003e","title":"Learn You a Haskell for Great Good!"},{"content":"\nI read this as evening light reading alongside a much more deliberate Haskell push, and built the whole Depot/Storefront tutorial along the way, with auth, i18n, Action Mailer/Mailbox, and hundreds of fast passing tests. Coming from a mostly JEE/JSF background (with a little Angular thrown in), I expected Rails' \u0026ldquo;Cadillac, all-bells-and-whistles\u0026rdquo; reputation to feel dated by 2026. It didn\u0026rsquo;t. It\u0026rsquo;s still the batteries-included framework, and the batteries are good ones: a rich text editor built in, which I had to bolt onto my own JEE app; a full email system in both directions, Action Mailer for outgoing with genuinely well-thought-out test-mode delivery support, Action Mailbox for incoming routed like a controller. I don\u0026rsquo;t expect a web framework to check my email for me, and I\u0026rsquo;m not sure I\u0026rsquo;d trust it over something like Mailchimp once you need real deliverability at scale, but as a \u0026ldquo;we already thought of that\u0026rdquo; touch I was impressed, and the testing support around it is A+.\nOn views, I think my team\u0026rsquo;s move to JSF was a step backward, and Rails reinforced that. ERB is happy to just be light HTML with a little programmatic output sprinkled in, the same way JSP is fine if you use it with a light touch and don\u0026rsquo;t let logic creep in, and the book gives the same DRY warning I\u0026rsquo;d give myself. Slim was in there as an option and genuinely looked like an upgrade in conciseness, but I stayed away from it deliberately, once you step away from raw HTML you sometimes tie your own hands, and direct HTML access is one of the places JSF shoots itself in the foot. Turbo and Stimulus impressed me more than expected too. As a longtime JSF developer I\u0026rsquo;m instinctively wary of anything promising to hide JavaScript from you, but Turbo/Stimulus make JS a first-class citizen without demanding you write obnoxious amounts of it.\nThe early application iterations start by generating the product maintenance scaffolding, defining model associations, and enforcing validation rules right on ActiveRecord models:\n# Chapters 6 and 7 establish ActiveRecord models, migrations, and validations: class Product \u0026lt; ApplicationRecord has_many :line_items before_destroy :ensure_not_referenced_by_any_line_item validates :title, :description, :image_url, presence: true validates :title, uniqueness: true validates :price, numericality: { greater_than_or_equal_to: 0.01 } private def ensure_not_referenced_by_any_line_item unless line_items.empty? errors.add(:base, \u0026#34;Line Items present\u0026#34;) throw :abort end end end Testing was the sharpest contrast with JEE. Heavyweight containers make fast test cycles a real problem, and Capybara spinning up a lightweight server against headless Chrome, backed by Minitest that\u0026rsquo;s actually fast, means I\u0026rsquo;ve got hundreds of tests now and still don\u0026rsquo;t think twice about running the whole suite, or just a relevant subset. System tests were occasionally flaky without retries though, which brought back some uncomfortable memories of flaky Selenium and Geb tests from my Java days. I\u0026rsquo;m a BDD fan, so RSpec being a real drop-in swap for Minitest mattered to me, same reason I liked Geb (Groovy) back when I was Groovy-curious and why I already love hspec in Haskell:\n# System tests drive headless Chrome via Capybara to verify live UI workflows: class OrdersTest \u0026lt; ApplicationSystemTestCase test \u0026#34;check routing and payment type dynamic selection\u0026#34; do visit store_index_url click_on \u0026#34;Add to Cart\u0026#34;, match: :first click_on \u0026#34;Checkout\u0026#34; fill_in \u0026#34;Name\u0026#34;, with: \u0026#34;Dave Thomas\u0026#34; fill_in \u0026#34;Address\u0026#34;, with: \u0026#34;123 Main Street\u0026#34; fill_in \u0026#34;E-mail\u0026#34;, with: \u0026#34;dave@example.com\u0026#34; assert_no_field \u0026#34;Routing number\u0026#34; select \u0026#34;Check\u0026#34;, from: \u0026#34;Pay type\u0026#34; assert_field \u0026#34;Routing number\u0026#34; click_button \u0026#34;Place Order\u0026#34; assert_text \u0026#34;Thank you for your order\u0026#34; end end The middle chapters hotwire the storefront using Turbo Streams to replace the cart partial in the sidebar asynchronously without requiring full page reloads:\n# Chapter 11 hotwires the storefront cart using Turbo Streams: # app/controllers/line_items_controller.rb def create product = Product.find(params[:product_id]) @line_item = @cart.add_product(product) respond_to do |format| if @line_item.save format.turbo_stream { render turbo_stream: [ turbo_stream.replace(:cart, partial: \u0026#34;layouts/cart\u0026#34;, locals: { cart: @cart }), turbo_stream.replace(\u0026#34;notice\u0026#34;, partial: \u0026#34;store/notice\u0026#34;, locals: { notice: \u0026#34;Added to cart.\u0026#34; }) ] } format.html { redirect_to store_index_url } end end end ActiveRecord\u0026rsquo;s reflection-based models were a big step up coming from Java: no verbose POJO to wire up for every new table, no middleware class you\u0026rsquo;re forced to add just to have somewhere to put nothing. It even writes most of the migration for you. I assume most modern frameworks have caught up on this front by now, but coming from the old-fashioned way, it\u0026rsquo;s slick. I also appreciated that Rails doesn\u0026rsquo;t force a heavy middleware layer on you; MVC is enough separation for most of what I do, and in my JEE app that middle tier tends to be a repetitive passthrough. Rails is comfortable letting the controller hold logic, or pushing it down to the model as the last line of enforcement, which is the better default.\ni18n was convenient too: wrapping things in t() calls is a bit of a chore, but I\u0026rsquo;ve done worse to a frontend, and having everything, including ActiveRecord\u0026rsquo;s own validation error messages, live in the same YAML files beats splitting your translations from the framework\u0026rsquo;s built-in ones the way Java properties files tend to.\nThe advanced iterations build out full inbound email routing with Action Mailbox, routing incoming support inquiries directly to a mailbox controller that links them to customer orders:\n# Chapter 16 processes incoming emails using Action Mailbox: class SupportMailbox \u0026lt; ApplicationMailbox def process recent_order = Order.where(email: mail.from_address.to_s).order(\u0026#34;created_at desc\u0026#34;).first SupportRequest.create!( email: mail.from_address.to_s, subject: mail.subject, body: mail.decoded, order: recent_order ) end end Most of my reactions here are colored by the JEE lens, and most things look good next to JEE, it\u0026rsquo;s an old, overcomplicated, designed-by-committee way of building web apps. But Rails earned its reputation independent of that comparison: an all-inclusive framework that stays flexible everywhere except right at its core (try ripping out Active Record and ask whether you\u0026rsquo;re still using Rails). Django\u0026rsquo;s next on the list, then a pure JavaScript frontend, then something slimmed down like a Go microservice or a Compojure backend, to see what the batteries-included approach actually costs you once the batteries are gone.\n","permalink":"https://llcawthorne.github.io/posts/agile-web-development-with-rails-8/","summary":"\u003cp\u003e\u003cimg alt=\"Agile Web Development with Rails 8 cover\" loading=\"lazy\" src=\"/posts/agile-web-development-with-rails-8/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eI read this as evening light reading alongside a much more deliberate Haskell\npush, and built the whole Depot/Storefront tutorial along the way, with auth,\ni18n, Action Mailer/Mailbox, and hundreds of fast passing tests. Coming from a\nmostly JEE/JSF background (with a little Angular thrown in), I expected Rails'\n\u0026ldquo;Cadillac, all-bells-and-whistles\u0026rdquo; reputation to feel dated by 2026. It didn\u0026rsquo;t.\nIt\u0026rsquo;s still the batteries-included framework, and the batteries are good ones: a\nrich text editor built in, which I had to bolt onto my own JEE app; a full email\nsystem in both directions, Action Mailer for outgoing with genuinely\nwell-thought-out test-mode delivery support, Action Mailbox for incoming routed\nlike a controller. I don\u0026rsquo;t expect a web framework to check my email for me, and\nI\u0026rsquo;m not sure I\u0026rsquo;d trust it over something like Mailchimp once you need real\ndeliverability at scale, but as a \u0026ldquo;we already thought of that\u0026rdquo; touch I was\nimpressed, and the testing support around it is A+.\u003c/p\u003e","title":"Agile Web Development with Rails 8"},{"content":"The first thing that struck me about The Foundations of Western Civilization was how abnormally fast it moved before it got to Greek history. The biggest Bronze Age civilizations got a lecture, and in five lectures or so we were in Greece and things slowed down. For Egypt in particular, it felt like they summed up the entirety of Egyptian history with a sentence or two each about the Old Kingdom, Middle Kingdom, and New Kingdom, then talked a little about Egyptian life and were done.\nThe lecturer\u0026rsquo;s background in religious history really shows in his topics. Religion got a lot of time, and not that it wasn\u0026rsquo;t big in history, but the course especially got bogged down comparing the Reformation and Counter-Reformation over three lectures. I would much rather have had more detail on Egypt than three lectures on the differences between Luther and Calvin and the specifics of how the Catholics chose to counter them. But then again, I\u0026rsquo;m an atheist, and every time the course touched on religion it reminded me how long religion has held us back and distracted us with imaginary concerns. It also spent a whole lecture each on the Hebrews, Jesus and the New Testament, the Christian Church in Late Antiquity, Scholasticism in Monasteries, and Mohammed and Islam. To think that theology was once the Queen of the Sciences, the highest subject taught in universities. It also felt like he downplayed the Inquisition, just mentioning as an aside that it was a thing while telling us so much else about the Catholic Church.\nThe lecturer also had a bone to pick with the way history is commonly taught. His claim was that the Roman Empire never really had a Fall, except in Edward Gibbon\u0026rsquo;s imagination looking back from the 18th century. Likewise, there were no Dark Ages. What we call the Dark Ages was a great time of expansion in Europe and hundreds of years where it was happily not held back by plagues. By my own reckoning, that holds up only for the later part of the period. The Plague of Justinian struck in 541 and recurred for about two centuries, but from around 750 until the Black Death arrived in 1347, Europe was largely plague free. So at least 750 to 1000, which falls within the traditional Dark Ages, really was a time of plenty. Indeed, Charlemagne\u0026rsquo;s kingdom was viewed as a new Rome by contemporaries, even though it unfortunately didn\u0026rsquo;t survive his grandsons. Scholars now usually call the whole period the Early Middle Ages anyway. The one era still commonly called a Dark Age and truly deserving of the term is the Greek Dark Ages, when the Greeks lost writing.\nHe also disagreed with the idea of the Renaissance, even though he gave a completely acceptable description of what characterized it and how it started in Florence and radiated outward. His argument was that Greek and Roman traditions never vanished during the Middle Ages, only became less prominent, so history is more continuous than the neat divisions we usually teach. I find that a tougher case to make than his Dark Ages argument, since there clearly was a resurgence of classical inspiration after the Middle Ages, even if it wasn\u0026rsquo;t the first. Indeed, some would say there was a Carolingian Renaissance in the 800s and a \u0026ldquo;Renaissance of the Twelfth Century\u0026rdquo; as well, and that the Italian Renaissance was just the best-known occurrence of a recurring theme.\nThis is the first of two Western Civilization courses, and it went quite a bit longer than I expected. I didn\u0026rsquo;t expect much after Rome, but it covered the Middle Ages, the Renaissance, and the Age of Exploration and Empire, so it was a broad sweep that went all the way to the New World. It\u0026rsquo;s kind of a fun point that I didn\u0026rsquo;t know Canute was a real king when I watched Vinland Saga, but this series of lectures educated me on the Danelaw and the Danish conquest of Britain.\nA few ideas stuck with me along the way. The lectures framed Sparta\u0026rsquo;s wars, Athens\u0026rsquo; trade, and Corinth\u0026rsquo;s colonies as responses to the same land shortage, and while war and trade looked stronger at the time, I think colonization had the biggest long-term impact, since that\u0026rsquo;s what spread Greek culture. I also noticed that Sparta and Rome were both devoted to ancestral custom (Lycurgus in Sparta, the mos maiorum in Rome) and both deeply militaristic, though innovative, democratic Athens was just as violent and just as willing to embrace \u0026ldquo;might makes right,\u0026rdquo; so tradition isn\u0026rsquo;t the whole story. Rome\u0026rsquo;s conquests were often framed as defensive, since fear of Rome pushed its neighbors to aid Rome\u0026rsquo;s enemies, which gave Rome its next target, though historians debate whether \u0026ldquo;defensive imperialism\u0026rdquo; is accurate or just Roman self-justification. And it\u0026rsquo;s remarkable that so many lasting political ideas came from Greece and Rome, which were both prone to demagogues and strongmen, maybe because later thinkers learned as much from their failures as from their successes.\nThe best thing I came away with wasn\u0026rsquo;t in the lectures themselves but came from thinking about them. Sparta and Rome both looked to their ancestors for guidance, which got me wondering how progress happens in societies that revere the past. My conclusion is that progress often comes from holding a nation to its founders\u0026rsquo; ideals. Abolitionists and suffragists succeeded largely by demanding the nation live up to its stated principles, which is in a sense a conservative argument in service of progress. The flip side is that people who believe in change can be too sure they know how to steer it, which is a real argument for caution, and it pairs well with Chesterton\u0026rsquo;s fence.\nI\u0026rsquo;ve picked out a good follow-up course that dedicates 48 lectures just to Egypt, Bob Brier\u0026rsquo;s The History of Ancient Egypt, but I\u0026rsquo;m not sure where I\u0026rsquo;ll fit it in. Perhaps on my eclectic topics pass at the end of the wide sweep of history. If I can fit in a course on Victorian Britain, surely I have time for one on Egypt.\n","permalink":"https://llcawthorne.github.io/posts/the-foundations-of-western-civilization/","summary":"\u003cp\u003eThe first thing that struck me about \u003cem\u003eThe Foundations of Western Civilization\u003c/em\u003e\nwas how abnormally fast it moved before it got to Greek history. The biggest\nBronze Age civilizations got a lecture, and in five lectures or so we were in\nGreece and things slowed down. For Egypt in particular, it felt like they summed\nup the entirety of Egyptian history with a sentence or two each about the Old\nKingdom, Middle Kingdom, and New Kingdom, then talked a little about Egyptian\nlife and were done.\u003c/p\u003e","title":"The Foundations of Western Civilization"},{"content":"\nTechnical Blogging talked a lot more about SEO, blog promotion, how to benefit from being a blogger, and how to scale; all good problems to have but a little early to worry about when you don\u0026rsquo;t have a blog yet. There was maybe a chapter on the actual act of blogging, but it was mostly watered-down Getting Things Done advice and a brief sketch of the pomodoro technique. It did remind me that I always wanted to check out the Things app for managing to-dos and projects, and it made me notice that Pragmatic Bookshelf has another entire book on the Pomodoro Technique (I can\u0026rsquo;t imagine what they have to say about it at book length, but several authors have managed to talk about the Pomodoro Technique for an entire book, judging from my Amazon results).\nIt also made me realize that it\u0026rsquo;s been fifteen years since I read Getting Things Done. I don\u0026rsquo;t have as much stuff to get done as I did back in school when I was working on a PhD and teaching classes too, but maybe I\u0026rsquo;ll re-read it anyway. It had useful productivity advice. I didn\u0026rsquo;t learn anything about productivity from what was in the Technical Blogging book. I also don\u0026rsquo;t plan to blog like it\u0026rsquo;s another job where I find myself spending 3-4 hours a week writing posts and need to schedule it in; I\u0026rsquo;m mostly reviewing books - when I finish a book, I can write a blogpost. I want to blog, but I\u0026rsquo;d rather spend most of my productive time reading and coding and when I am feeling creative put my thoughts out there.\nOne good idea from this book that was worth the price of admission was submitting a blog to Planet Haskell and/or Planet Clojure. You can submit just the proper tag feed to them so you are free to get off topic without getting into trouble, and they can push your posts out there for the world. It would be so cool to be featured by one of the Planets, as I\u0026rsquo;ve been subscribed to their RSS feeds for as long as I\u0026rsquo;ve had an RSS reader, even if I didn\u0026rsquo;t keep up for a time.\n","permalink":"https://llcawthorne.github.io/posts/technical-blogging/","summary":"\u003cp\u003e\u003cimg alt=\"Technical Blogging cover\" loading=\"lazy\" src=\"/posts/technical-blogging/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eTechnical Blogging\u003c/em\u003e talked a lot more about SEO, blog promotion, how to benefit\nfrom being a blogger, and how to scale; all good problems to have but a little\nearly to worry about when you don\u0026rsquo;t have a blog yet. There was maybe a chapter\non the actual act of blogging, but it was mostly watered-down \u003cem\u003eGetting Things\nDone\u003c/em\u003e advice and a brief sketch of the pomodoro technique. It did remind me that\nI always wanted to check out the Things app for managing to-dos and projects,\nand it made me notice that Pragmatic Bookshelf has another entire book on the\nPomodoro Technique (I can\u0026rsquo;t imagine what they have to say about it at book\nlength, but several authors have managed to talk about the Pomodoro Technique\nfor an entire book, judging from my Amazon results).\u003c/p\u003e","title":"Technical Blogging"},{"content":"\nGrokking Simplicity by Eric Normand teaches the difference between actions, calculations, and data as a way to reason about mutation and side effects, and it works better as a vocabulary book than a technique book. If you\u0026rsquo;ve already internalized what map, filter, and reduce are for, and I mean really internalized it and not just being able to write the syntax, most of the core material is going to read as confirmation of things you already believe instead of new information. The higher-order function chapters and the copy-on-write chapters fall right into that bucket. They\u0026rsquo;re clearly and patiently explained, and useful for someone who\u0026rsquo;s never had the difference between mutating and copying spelled out, but they\u0026rsquo;re slow going if you\u0026rsquo;ve been burned by shared mutable state enough times to already distrust it on instinct.\nThe best material is outside that core. The architecture chapters cover both stratified design and the onion model, and they were solid and worth having read, though not so revelatory that I\u0026rsquo;m in a hurry to go through them again. The concurrency chapters were the standout. They introduce a diagramming technique for reasoning about timelines and ordering that I hadn\u0026rsquo;t run into before and thought was really creative, and it\u0026rsquo;s a lot different from the usual \u0026ldquo;just use locks or actors and hope\u0026rdquo; approach most books take. Those are the chapters I\u0026rsquo;d go back to if a project involving concurrency comes up, since it\u0026rsquo;s the kind of technique you have to actually apply before it sticks.\nThe biggest miss for me was the immutable data chapters. I went in hoping for advice on using immutable data structures in single-binding languages, the discipline of writing code where a name, once bound, stays bound. What I got was mostly copy-on-write technique, demonstrated with JavaScript objects that get rebound on every update. That\u0026rsquo;s a reasonable way to teach it in a language like Elixir where rebinding is idiomatic, but it doesn\u0026rsquo;t really carry over to the habit I was actually after, which is reaching for val by default in Kotlin, or treating a Haskell declaration as a one-time mathematical definition instead of a variable that just happens not to change. The chapter shows you how to build the immutable structure, but it doesn\u0026rsquo;t really show you how to live in a codebase that treats bindings as permanent.\nOverall, it\u0026rsquo;s a fast, well-explained, easy read that\u0026rsquo;s clearly aimed at someone running into these ideas for the first time. If that\u0026rsquo;s not you, you\u0026rsquo;ll skim more than you expect, but the concurrency material deserves a second look, and the architecture chapters were worth reading once, even if they weren\u0026rsquo;t essential.\n","permalink":"https://llcawthorne.github.io/posts/grokking-simplicity/","summary":"\u003cp\u003e\u003cimg alt=\"Grokking Simplicity cover\" loading=\"lazy\" src=\"/posts/grokking-simplicity/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eGrokking Simplicity\u003c/em\u003e by Eric Normand teaches the difference between actions,\ncalculations, and data as a way to reason about mutation and side effects, and\nit works better as a vocabulary book than a technique book. If you\u0026rsquo;ve already\ninternalized what \u003ccode\u003emap\u003c/code\u003e, \u003ccode\u003efilter\u003c/code\u003e, and \u003ccode\u003ereduce\u003c/code\u003e are for, and I mean really\ninternalized it and not just being able to write the syntax, most of the core\nmaterial is going to read as confirmation of things you already believe instead\nof new information. The higher-order function chapters and the copy-on-write\nchapters fall right into that bucket. They\u0026rsquo;re clearly and patiently explained,\nand useful for someone who\u0026rsquo;s never had the difference between mutating and\ncopying spelled out, but they\u0026rsquo;re slow going if you\u0026rsquo;ve been burned by shared\nmutable state enough times to already distrust it on instinct.\u003c/p\u003e","title":"Grokking Simplicity"},{"content":"\nThe best part of the book was section 2, where it described different architecture styles and gave each one star ratings across a variety of characteristics, which I\u0026rsquo;m sure come from the authors\u0026rsquo; experience with each style. I also liked how it framed microservices as part of a trend pendulum, reacting against the reuse pain that SOA left behind, since I like noticing when a new trend is really just correcting for the last one\u0026rsquo;s mistakes. I\u0026rsquo;m not an architect currently, so I have no need for architecture decision records (ADRs), except maybe for technical decisions made on personal projects so I can go back and remember the thought that went into them. I may start using adr-tools on my own for that. Since I mostly listened to this on runs, my notes don\u0026rsquo;t really do it justice. I want to go back sometime when I\u0026rsquo;m not out of breath and write proper summaries of the ratings for each architecture style.\n","permalink":"https://llcawthorne.github.io/posts/fundamentals-of-software-architecture/","summary":"\u003cp\u003e\u003cimg alt=\"Fundamentals of Software Architecture cover\" loading=\"lazy\" src=\"/posts/fundamentals-of-software-architecture/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eThe best part of the book was section 2, where it described different\narchitecture styles and gave each one star ratings across a variety of\ncharacteristics, which I\u0026rsquo;m sure come from the authors\u0026rsquo; experience with each\nstyle. I also liked how it framed microservices as part of a trend pendulum,\nreacting against the reuse pain that SOA left behind, since I like noticing when\na new trend is really just correcting for the last one\u0026rsquo;s mistakes. I\u0026rsquo;m not an\narchitect currently, so I have no need for architecture decision records (ADRs),\nexcept maybe for technical decisions made on personal projects so I can go back\nand remember the thought that went into them. I may start using\n\u003ca href=\"https://github.com/npryce/adr-tools\"\u003eadr-tools\u003c/a\u003e on my own for that. Since I\nmostly listened to this on runs, my notes don\u0026rsquo;t really do it justice. I want to\ngo back sometime when I\u0026rsquo;m not out of breath and write proper summaries of the\nratings for each architecture style.\u003c/p\u003e","title":"Fundamentals of Software Architecture"},{"content":"\nI first read The Pragmatic Programmer years ago, and the 20th anniversary edition holds up really well. It isn\u0026rsquo;t just a nostalgia lap, since the updates feel necessary, folding in ideas like ETC (\u0026ldquo;Easier to Change\u0026rdquo;), functional-style data pipelines, and more modern concurrency patterns without losing the voice that made the original a classic. It reads less like a list of rules and more like advice from people who have actually shipped things and learned from what went wrong.\nI listened to it as an audiobook, and it worked better than I expected for a book this dense with concepts. The narration keeps a good pace, and the material is conversational enough that it doesn\u0026rsquo;t need diagrams on every page to land. If you\u0026rsquo;ve read the original, it\u0026rsquo;s worth a revisit, and if you haven\u0026rsquo;t, this is the version to start with.\n","permalink":"https://llcawthorne.github.io/posts/the-pragmatic-programmer/","summary":"\u003cp\u003e\u003cimg alt=\"The Pragmatic Programmer cover\" loading=\"lazy\" src=\"/posts/the-pragmatic-programmer/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eI first read \u003cem\u003eThe Pragmatic Programmer\u003c/em\u003e years ago, and the 20th anniversary\nedition holds up really well. It isn\u0026rsquo;t just a nostalgia lap, since the updates\nfeel necessary, folding in ideas like ETC (\u0026ldquo;Easier to Change\u0026rdquo;), functional-style\ndata pipelines, and more modern concurrency patterns without losing the voice\nthat made the original a classic. It reads less like a list of rules and more\nlike advice from people who have actually shipped things and learned from what\nwent wrong.\u003c/p\u003e","title":"The Pragmatic Programmer"},{"content":"\nAdvanced Functional Programming with Elixir turned out to be a pretty good, easy introduction to functional programming concepts, and it uses good domain examples instead of math. It walks through Elixir\u0026rsquo;s protocol system with a DDD slant, using a theme park domain with rides, patrons, and Fast Passes instead of the numbers-only examples you get in most Haskell books. The code is built around a companion library called FunPark, a teaching-scale version of Koski\u0026rsquo;s real production package, Funx. The theme park was a good choice, and it paid off most in the Eq/FastPass chapter, where a real business rule (two Fast Passes with the same datetime conflict, but should still be equal by id) motivated contramap far better than an abstract definition ever could have:\n# Chapter 2 defines contramap as a plain comparator map so types can have # more than one domain-specific notion of equality: defmodule FunPark.Eq.Utils do alias FunPark.Eq def contramap(f) do %{ eq?: fn a, b -\u0026gt; Eq.eq?(f.(a), f.(b)) end, not_eq?: fn a, b -\u0026gt; Eq.not_eq?(f.(a), f.(b)) end } end end The quality was uneven, but in a predictable way. Eq, Ord, and Predicates were a low bar that the book cleared easily. Monoid was the standout chapter, and the one place where all the abstract machinery (Eq.All, comparators built with contramap) paid off concretely enough to justify the ceremony:\n# Chapter 4 combines comparators monoidally using Eq.All: defmodule FunPark.Monoid.Eq.All do defstruct eq?: \u0026amp;FunPark.Monoid.Eq.All.default_eq?/2, not_eq?: \u0026amp;FunPark.Monoid.Eq.All.default_not_eq?/2 def default_eq?(_, _), do: true def default_not_eq?(_, _), do: false end defimpl FunPark.Monoid, for: FunPark.Monoid.Eq.All do alias FunPark.Monoid.Eq.All def empty(_), do: %All{} def append(%All{} = eq1, %All{} = eq2) do %All{ eq?: fn a, b -\u0026gt; eq1.eq?.(a, b) \u0026amp;\u0026amp; eq2.eq?.(a, b) end, not_eq?: fn a, b -\u0026gt; eq1.not_eq?.(a, b) || eq2.not_eq?.(a, b) end } end end The monad theory was thin and abstract on its own and only came together once Maybe and Either gave it somewhere to land. The one real gap was motivation for Reader and Effect, which never quite sold me. The mechanics were fine, but no example was compelling enough to answer \u0026ldquo;why bother wrapping this?\u0026rdquo;\nThe Eq and Ord chapters are straightforward once you accept that Elixir protocols dispatch on struct type only, which forces workarounds like contramap and to_eq_map (comparators as plain maps, not just protocol implementations) the moment your domain needs more than one valid notion of equality for a type. That ties into DDD nicely, since equality isn\u0026rsquo;t structural, it depends on the bounded context, so the same type can have different valid comparators depending on which part of the domain is asking.\nThe Predicates and Foldable chapter introduced Foldable for Function (a predicate as a fold, with zero-arity thunk dispatch) with almost no explanation, and I had to do some real reconstruction before it landed. It turned out to be a catamorphism (one function per fixed shape) hiding under a name that sounds like list reduction. I also caught a bug in the protocol declaration there. defprotocol declared fold_l(structure, transform_fn, base), but every real implementation and call site used (structure, acc, func), so the protocol\u0026rsquo;s own docs had the argument names reversed. It\u0026rsquo;s harmless, since protocol callback names aren\u0026rsquo;t enforced, but it\u0026rsquo;s misleading on a cold read.\nMonoid was the best chapter. Sum is the toy case, and Eq.All and Eq.Any are the real payoff, equality combinators as monoids, with \u0026amp;\u0026amp; and || doing the combining. I caught one real typo there too (default_not_eq vs. default_not_eq?), and it confirmed a design tension worth remembering: this machinery is worth it once you have multiple domain-meaningful comparators that need combining and reusing, but not for a one-off comparison you could write with \u0026amp;\u0026amp; directly.\nThe monad theory chapter is careful to say it\u0026rsquo;s \u0026ldquo;inspired by category theory, not a direct implementation.\u0026rdquo; The laws (left identity, right identity, and associativity) landed fine once I reverse-engineered pure, which shows up without explanation, as the same idea as Monoid\u0026rsquo;s wrap/empty, just Monad-flavored. There\u0026rsquo;s no dedicated Functor chapter, and map gets treated as a free consequence of bind and pure instead of getting its own build-up, unlike From Objects to Functions, which used Functor as the on-ramp to Monad.\nReader was clean mechanically (the environment as a deferred function, ask/asks, and run as the escape hatch), but the worked examples were too small to justify the ceremony over just passing an argument. The one clear win was swapping run(computation, prod_env) for run(computation, test_env), which is a real dependency injection payoff, independent of the toy examples around it.\nMaybe and Either are where the book actually sold itself. You chain bind-based computations and only check for failure once at the end, instead of doing constant nil checks, which is a direct answer to how much Go\u0026rsquo;s manual err != nil checking grates on me. Either wins over Maybe when you need to carry why something failed. Choosing bind to fail fast versus ap to collect all the errors was the most concrete moment in the whole book where an abstraction proved its worth, since the same operations give you two different validation strategies with one shared vocabulary:\n# Chapters 8 and 9 contrast fail-fast binding with error-accumulating validation: defmodule FunPark.Ride.FastLane do import FunPark.Monad.Either, only: [bind: 2, right: 1, left: 1] # Fail-fast pipeline: aborts at the first failing condition: def ensure_fast_pass_lane(%Patron{} = patron, %Ride{} = ride) do patron |\u0026gt; ensure_height(ride) |\u0026gt; bind(\u0026amp;ensure_age(\u0026amp;1, ride)) |\u0026gt; bind(\u0026amp;ensure_ticket(\u0026amp;1, ride)) end # Applicative traversal: accumulates all validation errors simultaneously: def validate_eligibility(%Patron{} = patron, %Ride{} = ride) do validators = [ \u0026amp;ensure_height(\u0026amp;1, ride), \u0026amp;ensure_age(\u0026amp;1, ride), \u0026amp;ensure_ticket(\u0026amp;1, ride) ] FunPark.Monad.Either.validate(patron, validators) end end Effect never made a compelling case for why actions specifically need to be trapped in a monad, though the ride repository example was believable as a real pattern. It was the weakest chapter at justifying its own existence.\nI\u0026rsquo;m not convinced the full ceremony is worth it over Kotlin\u0026rsquo;s null safety for the Maybe case, since that comparison feels close to a wash. Either doesn\u0026rsquo;t have an equally clean stand-in in Kotlin, though. Kotlin\u0026rsquo;s Result\u0026lt;T\u0026gt; is tied to Throwable, so a hand-rolled Outcome type or Arrow\u0026rsquo;s Either are the real equivalents, and that\u0026rsquo;s the one idea from this book most likely to actually change how I write Kotlin.\nOverall, it\u0026rsquo;s a good, easy introduction to FP for someone with some prior exposure who wants examples grounded in a domain instead of math. I\u0026rsquo;m glad I had AI on hand to work through the parts the book left underexplained, especially the Foldable predicate case, since it would\u0026rsquo;ve been a rougher read alone.\n","permalink":"https://llcawthorne.github.io/posts/advanced-functional-programming-with-elixir/","summary":"\u003cp\u003e\u003cimg alt=\"Advanced Functional Programming with Elixir cover\" loading=\"lazy\" src=\"/posts/advanced-functional-programming-with-elixir/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eAdvanced Functional Programming with Elixir\u003c/em\u003e turned out to be a pretty good,\neasy introduction to functional programming concepts, and it uses good domain\nexamples instead of math. It walks through Elixir\u0026rsquo;s protocol system with a DDD\nslant, using a theme park domain with rides, patrons, and Fast Passes instead of\nthe numbers-only examples you get in most Haskell books. The code is built\naround a companion library called \u003ccode\u003eFunPark\u003c/code\u003e, a teaching-scale version of Koski\u0026rsquo;s\nreal production package, \u003ccode\u003eFunx\u003c/code\u003e. The theme park was a good choice, and it paid\noff most in the \u003ccode\u003eEq\u003c/code\u003e/\u003ccode\u003eFastPass\u003c/code\u003e chapter, where a real business rule (two Fast\nPasses with the same datetime conflict, but should still be equal by \u003ccode\u003eid\u003c/code\u003e)\nmotivated \u003ccode\u003econtramap\u003c/code\u003e far better than an abstract definition ever could have:\u003c/p\u003e","title":"Advanced Functional Programming with Elixir"},{"content":"\nI didn\u0026rsquo;t find a lot of the advice in this book terribly useful. It mostly seemed like common sense backed by a bit of research. The onboarding advice was probably the most useful part, if only because I\u0026rsquo;m senior enough now that it might come in handy with junior colleagues. The idea is basically to focus on single activities at first, starting with concrete code instead of diagrams, and remembering that everything is new to them. It is easy to forget once you\u0026rsquo;ve been steeped in a codebase for years.\nThe Roles of Variables Framework was new to me too. I actually paused my run to jot down the key ideas since it felt worth remembering, even though I wasn\u0026rsquo;t sure how valuable it would be in practice. Looking at my own code though, I mostly stick to \u0026ldquo;fixed value\u0026rdquo; variables over any of the other roles (vals in Kotlin, and I\u0026rsquo;m trying to do some Haskell on the side for fun). I also liked the advice on dealing with interruptions by offloading as much of your thought process as possible instead of trying to hold it all in your head. That\u0026rsquo;s basically what I use Obsidian for at home, and at work I\u0026rsquo;ve had the same notes.txt file open for ten years that\u0026rsquo;s probably 50 pages long by now.\n","permalink":"https://llcawthorne.github.io/posts/the-programmers-brain/","summary":"\u003cp\u003e\u003cimg alt=\"The Programmer\u0026rsquo;s Brain cover\" loading=\"lazy\" src=\"/posts/the-programmers-brain/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eI didn\u0026rsquo;t find a lot of the advice in this book terribly useful. It mostly seemed\nlike common sense backed by a bit of research. The onboarding advice was\nprobably the most useful part, if only because I\u0026rsquo;m senior enough now that it\nmight come in handy with junior colleagues. The idea is basically to focus on\nsingle activities at first, starting with concrete code instead of diagrams, and\nremembering that everything is new to them. It is easy to forget once you\u0026rsquo;ve\nbeen steeped in a codebase for years.\u003c/p\u003e","title":"The Programmer's Brain"},{"content":"\nA perfectly good introduction to the Elixir language, although it didn\u0026rsquo;t have anything specific to learning functional programming in it beyond getting used to doing things the Elixir way. I guess it had more recursion than most introductory programming books\u0026hellip; It feels like a terrible introduction in comparison to Dave Thomas\u0026rsquo; Programming Elixir though, since it stops totally short of introducing the Actor model and OTP, which are unique strengths of Elixir, but that\u0026rsquo;s obviously a longer book to read.\nThe book starts with Elixir fundamentals: immutable variables, the pipe operator (|\u0026gt;), and pattern matching with case and tuples to control flow without relying on imperative reassignment:\n# Chapters 2 and 3 build intuition for immutability and pattern matching: defmodule AbilityScore do def parse_score(input) do case Integer.parse(input) do :error -\u0026gt; {:error, \u0026#34;Invalid score: #{input}\u0026#34;} {score, _remainder} -\u0026gt; modifier = (score - 10) / 2 {:ok, modifier} end end end The middle chapters spend significant time on recursive functions, demonstrating how list head-tail decomposition handles unbounded loops before transitioning to the Enum module\u0026rsquo;s higher-order functions:\n# Chapter 4 leans into recursive list traversal and pattern matching heads/tails: defmodule StringList do def upcase([]), do: [] def upcase([head | tail]), do: [String.upcase(head) | upcase(tail)] end # Chapter 5 replaces explicit recursion with higher-order functions and capture syntax: total_cost = [10, 25, 40] |\u0026gt; Enum.map(\u0026amp;(\u0026amp;1 * 1.08)) |\u0026gt; Enum.reduce(0, \u0026amp;+/2) The final chapters move toward application design with typed structs, guard clauses, and separating pure domain logic from impure I/O boundaries:\n# Chapters 6 and 7 structure domain data using structs and boundary functions: defmodule Character do @enforce_keys [:name] defstruct [:name, health: 100, mana: 50] def attack(%Character{health: hp} = target, damage) when damage \u0026gt;= 0 do new_hp = max(hp - damage, 0) %{target | health: new_hp} end def alive?(%Character{health: hp}), do: hp \u0026gt; 0 end ","permalink":"https://llcawthorne.github.io/posts/learn-functional-programming-with-elixir/","summary":"\u003cp\u003e\u003cimg alt=\"Learn Functional Programming with Elixir cover\" loading=\"lazy\" src=\"/posts/learn-functional-programming-with-elixir/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eA perfectly good introduction to the Elixir language, although it didn\u0026rsquo;t have\nanything specific to learning functional programming in it beyond getting used\nto doing things the Elixir way. I guess it had more recursion than most\nintroductory programming books\u0026hellip; It feels like a terrible introduction in\ncomparison to Dave Thomas\u0026rsquo; \u003cem\u003eProgramming Elixir\u003c/em\u003e though, since it stops totally\nshort of introducing the Actor model and OTP, which are unique strengths of\nElixir, but that\u0026rsquo;s obviously a longer book to read.\u003c/p\u003e","title":"Learn Functional Programming with Elixir"},{"content":"I listened to two Great Courses lecture series on existentialism, No Excuses: Existentialism and the Meaning of Life by Robert C. Solomon and Existentialism and the Authentic Life by Skye C. Cleary.\nNo Excuses had a lot of lectures devoted to fictional works, more than I expected from a philosophy course. The title comes from Sartre\u0026rsquo;s idea of Absolute Freedom, that even chained in a dungeon you\u0026rsquo;re still free to choose your own interpretation of the facts and how you react to them. The Bad Faith concept stuck with me too, the idea that you\u0026rsquo;re acting in bad faith any time your aspirations ignore the actual facts of your situation. I could aspire to be a champion basketball player, but the facts say I\u0026rsquo;m 5'11\u0026quot; and almost 50, so aspiring to that would be bad faith.\nExistentialism and the Authentic Life covered a wide variety of existentialist authors I hadn\u0026rsquo;t heard of before, along with the generally expected ones. My favorite was already Camus, since I\u0026rsquo;ve read some of his works before, and his idea of the Absurd, the tension between wanting the universe to have inherent meaning and it flatly refusing to provide any. I\u0026rsquo;ll admit my own notes on it were thin though, since I was working out at the time, so I ended up going to Gemini afterward to help me reconstruct the Myth of Sisyphus material properly.\nHeidegger and Ortega were both phenomenologists that liked to make up words, which is about the most accurate one-line summary I can give either of them. When the lecture asked me to fill in the blank on \u0026ldquo;I am ___,\u0026rdquo; I immediately reached for \u0026ldquo;Senior Software Engineer,\u0026rdquo; which was exactly the trap Sartre was pointing at: you\u0026rsquo;re always more than your vocation, no matter how many labels you stack up.\n","permalink":"https://llcawthorne.github.io/posts/existentialism-great-courses/","summary":"\u003cp\u003eI listened to two Great Courses lecture series on existentialism, \u003cem\u003eNo Excuses:\nExistentialism and the Meaning of Life\u003c/em\u003e by Robert C. Solomon and \u003cem\u003eExistentialism\nand the Authentic Life\u003c/em\u003e by Skye C. Cleary.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eNo Excuses\u003c/em\u003e had a lot of lectures devoted to fictional works, more than I\nexpected from a philosophy course. The title comes from Sartre\u0026rsquo;s idea of\nAbsolute Freedom, that even chained in a dungeon you\u0026rsquo;re still free to choose\nyour own interpretation of the facts and how you react to them. The Bad Faith\nconcept stuck with me too, the idea that you\u0026rsquo;re acting in bad faith any time\nyour aspirations ignore the actual facts of your situation. I could aspire to be\na champion basketball player, but the facts say I\u0026rsquo;m 5'11\u0026quot; and almost 50, so\naspiring to that would be bad faith.\u003c/p\u003e","title":"Two Great Courses on Existentialism"},{"content":"\nI picked up Build Websites with Hugo because I\u0026rsquo;m a PragProg loyalist with plans to revive my old blog, and if they have a book on something I\u0026rsquo;m using, I like to have an opinion on it. My opinion is that it\u0026rsquo;s fine, but barely. The book is from 2020, and Hugo has changed enough since then that half the examples either don\u0026rsquo;t work or generate deprecation warnings. I was running Hugo 0.164 against a book written for 0.68, and the scaffolding generated by hugo new theme is completely different now, so it actively conflicted with the book\u0026rsquo;s instructions at nearly every step.\nWorse, the entire book has you building a custom theme from scratch, which is a reasonable way to teach, except that anyone graduating from this book is going to immediately throw that theme away for something maintained by people who actually know CSS, so you spend 200 pages building something disposable. What you do get out of it is an understanding of how Hugo thinks, with the template hierarchy, partials, taxonomies, front matter, and the asset pipeline, and that did turn out to be worth something, so just go in knowing you\u0026rsquo;re reading it for the concepts and not the site. Honestly, you\u0026rsquo;d probably learn as much in an afternoon of playing with Hugo directly and asking an AI assistant when you get stuck.\nThere wasn\u0026rsquo;t much else in it worth remembering, except maybe how to make a cool \u0026ldquo;This page will take X minutes to read\u0026rdquo; summary.\n","permalink":"https://llcawthorne.github.io/posts/build-websites-with-hugo/","summary":"\u003cp\u003e\u003cimg alt=\"Build Websites with Hugo cover\" loading=\"lazy\" src=\"/posts/build-websites-with-hugo/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eI picked up \u003cem\u003eBuild Websites with Hugo\u003c/em\u003e because I\u0026rsquo;m a PragProg loyalist with\nplans to revive my old blog, and if they have a book on something I\u0026rsquo;m using, I\nlike to have an opinion on it. My opinion is that it\u0026rsquo;s fine, but barely. The\nbook is from 2020, and Hugo has changed enough since then that half the\nexamples either don\u0026rsquo;t work or generate deprecation warnings. I was running Hugo\n0.164 against a book written for 0.68, and the scaffolding generated by\n\u003ccode\u003ehugo new theme\u003c/code\u003e is completely different now, so it actively conflicted with\nthe book\u0026rsquo;s instructions at nearly every step.\u003c/p\u003e","title":"Build Websites with Hugo"},{"content":"\nThis was one of the better books I\u0026rsquo;ve read recently for actually changing how I think about programming. It combines domain-driven design, test-first development, and functional programming into one coherent story, which is pretty rare, since most books only tackle one of those at a time. Unlike some of my other recent reads, the Kotlin itself was well-structured and idiomatic throughout, not just functional-flavored Java.\nThe book builds a real app, a to-do list called Zettai, outside-in with TDD, starting from acceptance tests and working down to the domain core. It uses http4k, which the author picked specifically for its \u0026ldquo;everything is a function\u0026rdquo; philosophy (an HttpHandler is just (Request) -\u0026gt; Response), and Exposed for persistence. The book\u0026rsquo;s repo only has the start and end states for each step (step1 through step7, spread loosely across 13 chapters) rather than the intermediate changes, so I had to lean on the book\u0026rsquo;s prose to follow why the code evolved the way it did and not just what it ended up as:\n// Early chapters model web handling and outside-in testing purely as functions: val app: HttpHandler = routes( \u0026#34;/todo/{user}/{list}\u0026#34; bind Method.GET to ::showList, \u0026#34;/todo/{user}\u0026#34; bind Method.POST to ::createList ) // In http4k, an HttpHandler is simply a function: (Request) -\u0026gt; Response: fun showList(request: Request): Response { val user = request.path(\u0026#34;user\u0026#34;)?.let(::User) val listName = request.path(\u0026#34;list\u0026#34;)?.let(::ListName) return if (user != null \u0026amp;\u0026amp; listName != null) { Response(Status.OK).body(\u0026#34;Showing list $listName for ${user.name}\u0026#34;) } else { Response(Status.BAD_REQUEST) } } The book starts with actor-based domain-driven testing and works its way through receiver-typed lambdas and extension functions, higher-order functions and purity, and a hub-and-spokes (ports and adapters) architecture before it gets into the theory. From there it covers monoids (with a door state machine example), functors, monads, and applicatives, then event sourcing and profunctors, and it finishes with a logging and JSON capstone that pulls everything together. The theory was mostly motivated with real code before the abstraction got a name, which I appreciated. Functors come out of Holder, List, and Outcome, and then ProjectionQuery deliberately breaks the container idea to push you into thinking of them as computations instead of containers. Monads come from a concrete TxReader\u0026lt;TxReader\u0026lt;T\u0026gt;\u0026gt; nesting problem instead of being introduced abstractly, and applicatives show up through error-accumulating validation with `!` and `*` operators, contrasted against the way monads short-circuit:\n// Chapters 7 and 11 replace exceptions with Outcome\u0026lt;E, T\u0026gt;, contrasting // monadic bind (short-circuiting) with applicative failure accumulation: sealed class Outcome\u0026lt;out E : OutcomeError, out T : Any\u0026gt; { data class Success\u0026lt;out T : Any\u0026gt;(val value: T) : Outcome\u0026lt;Nothing, T\u0026gt;() data class Failure\u0026lt;out E : OutcomeError\u0026gt;(val error: E) : Outcome\u0026lt;E, Nothing\u0026gt;() fun \u0026lt;U : Any\u0026gt; transform(f: (T) -\u0026gt; U): Outcome\u0026lt;E, U\u0026gt; = when (this) { is Success -\u0026gt; Success(f(value)) is Failure -\u0026gt; this } } fun \u0026lt;E : OutcomeError, T : Any, U : Any\u0026gt; Outcome\u0026lt;E, T\u0026gt;.bind( f: (T) -\u0026gt; Outcome\u0026lt;E, U\u0026gt; ): Outcome\u0026lt;E, U\u0026gt; = when (this) { is Outcome.Success -\u0026gt; f(value) is Outcome.Failure -\u0026gt; this } fun \u0026lt;E : OutcomeError, T : Any\u0026gt; combineFailures( first: Outcome\u0026lt;E, T\u0026gt;, second: Outcome\u0026lt;E, T\u0026gt;, combine: (E, E) -\u0026gt; E ): Outcome\u0026lt;E, T\u0026gt; = when (first) { is Outcome.Success -\u0026gt; second is Outcome.Failure -\u0026gt; when (second) { is Outcome.Success -\u0026gt; first is Outcome.Failure -\u0026gt; Outcome.Failure(combine(first.error, second.error)) } } The exceptions were the door monoid section and parts of chapter 7, where the vocabulary showed up before the payoff did. That was disorienting in the moment, even though the payoff did eventually arrive by the end of the chapter.\nThe latter half of the book evolves the architecture into full event sourcing, turning domain operations into commands that produce immutable events, which are then projected into queryable in-memory views:\n// The latter half develops full event sourcing, generating immutable events // from commands and updating projections for query handling: data class ToDoListCreated(val id: ListId, val owner: User, val name: ListName) : EntityEvent data class ItemAddedToList(val id: ListId, val item: ToDoItem) : EntityEvent // Executing domain commands into events: fun handle(command: CreateToDoList): Outcome\u0026lt;DomainError, List\u0026lt;EntityEvent\u0026gt;\u0026gt; = if (command.name.isValid()) { Outcome.Success(listOf(ToDoListCreated(ListId.mint(), command.owner, command.name))) } else { Outcome.Failure(InvalidListName(command.name)) } // Projecting events into a read-only queryable view: class ListProjection : Projection\u0026lt;ListRow, EntityEvent\u0026gt; { private val rows = mutableMapOf\u0026lt;ListId, ListRow\u0026gt;() fun apply(event: EntityEvent): Unit = when (event) { is ToDoListCreated -\u0026gt; rows[event.id] = ListRow(event.id, event.name, emptyList()) is ItemAddedToList -\u0026gt; rows.computeIfPresent(event.id) { _, row -\u0026gt; row.copy(items = row.items + event.item) } else -\u0026gt; Unit } } The Kotlin was the kind you\u0026rsquo;d want to see in a strong codebase, with extension functions, receiver types, sealed classes, and generics all used the way they\u0026rsquo;re meant to be used and not just as vehicles for FP theory. The actor-based test framework, Pesticide, was a neat pattern too: you write a test once and run it against the domain, a local HTTP server, or a deployed instance, even if I\u0026rsquo;m not sure I\u0026rsquo;d adopt the library itself over something mainstream like kotest:\n// Acceptance tests are defined with Pesticide using domain language and human actors, // parameterized to run against an in-memory domain, local HTTP, or deployed servers: typealias ZettaiDDT = DomainDrivenTest\u0026lt;ZettaiActions\u0026gt; class SeeATodoListDDT : ZettaiDDT(allActions()) { val frank = ToDoListOwner(\u0026#34;Frank\u0026#34;) val bob = ToDoListOwner(\u0026#34;Bob\u0026#34;) val shoppingListName = \u0026#34;shopping\u0026#34; val shoppingItems = listOf(\u0026#34;carrots\u0026#34;, \u0026#34;apples\u0026#34;, \u0026#34;milk\u0026#34;) val gardenListName = \u0026#34;gardening\u0026#34; val gardenItems = listOf(\u0026#34;fix fence\u0026#34;, \u0026#34;mow lawn\u0026#34;) @DDT fun `List owners can see their lists`() = ddtScenario { setUp { frank.`starts with a list`(shoppingListName, shoppingItems) bob.`starts with a list`(gardenListName, gardenItems) }.thenPlay( frank.`can see #listname with #itemnames`(shoppingListName, shoppingItems), bob.`can see #listname with #itemnames`(gardenListName, gardenItems) ) } @DDT fun `Only owners can see their lists`() = ddtScenario { setUp { frank.`starts with a list`(shoppingListName, shoppingItems) bob.`starts with a list`(gardenListName, gardenItems) }.thenPlay( frank.`cannot see #listname`(gardenListName), bob.`cannot see #listname`(shoppingListName) ) } } The final third, especially the logging and JSON chapters, had a noticeably higher error rate than the rest of the book. Functions like storeEvents got used before they were shown, parameter counts didn\u0026rsquo;t match, and field names had typos. The JSON chapter has you build a hand-rolled JSON library that even the author admits he was \u0026ldquo;wary\u0026rdquo; of introducing, and it\u0026rsquo;s incomplete, since its own reflection-based code generation \u0026ldquo;seldom works right without manual intervention.\u0026rdquo; A thin adapter wrapping kotlinx.serialization in an Outcome probably would have served the book\u0026rsquo;s own goals better than building JSON parsing from scratch. There\u0026rsquo;s also an optional 50-page category theory appendix, which was a mixed bag. Functors, monads, and comonads mostly confirmed what the main text had already taught me, and Kleisli categories turned out to be bind with different notation once I decoded them, but profunctors and the Yoneda lemma were presented abstractly enough that I had to reconstruct them from the code examples myself before they landed.\nLooking back at it now, after a stretch in Haskell, I remember a lot more about the DDD and TDD from this book than I do about the details of Kotlin. It was really into TDD, with the whole app built outside-in from acceptance tests, and I miss that now that I\u0026rsquo;m working through 1000 pages of Django 5 By Example without a single test in them. Anyway, it\u0026rsquo;s a dense book, but it was worth the length, and it changed how I think about combining DDD, testing, and FP instead of treating them as separate concerns. I\u0026rsquo;d recommend it to someone with some Kotlin under their belt and the patience for some rough editing toward the end.\n","permalink":"https://llcawthorne.github.io/posts/from-objects-to-functions/","summary":"\u003cp\u003e\u003cimg alt=\"From Objects to Functions cover\" loading=\"lazy\" src=\"/posts/from-objects-to-functions/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eThis was one of the better books I\u0026rsquo;ve read recently for actually changing how I\nthink about programming. It combines domain-driven design, test-first\ndevelopment, and functional programming into one coherent story, which is pretty\nrare, since most books only tackle one of those at a time. Unlike some of my\nother recent reads, the Kotlin itself was well-structured and idiomatic\nthroughout, not just functional-flavored Java.\u003c/p\u003e","title":"From Objects to Functions"},{"content":"\nBetter than initially assessed: Chapter 2 introduces collections, good variance coverage (with a Pet hierarchy), covers extensions and their role in the stdlib, two lambda/HOF chapters. Unusual ordering: generics before lambdas. map/filter/fold deferred to lambda chapters. Coroutines appendix exists but dated.\nHead First Kotlin uses the usual Head First spiral approach (introduce a concept lightly, let it sit, circle back with depth later), which meant it deferred anything not strictly load-bearing to the appendices. Labeled breaks and enum classes, both things I\u0026rsquo;d consider core language features, got pushed all the way to Appendix C rather than covered in the main chapters. That appendix is even honest about it in the title: \u0026ldquo;The Top Ten Things (We Didn\u0026rsquo;t Cover)\u0026rdquo;: ten separate topics, including packages, visibility modifiers, sealed classes, and object declarations, that never made it into the twelve main chapters at all.\nThe early chapters lay down Kotlin\u0026rsquo;s foundational mechanics: null safety, safe calls, and the Elvis operator to banish NullPointerExceptions from day-to-day code:\n// Chapter 8 tackles Kotlin\u0026#39;s null safety system and nullable types: class Duck(val name: String?) fun printDuckName(duck: Duck?) { // Safe calls chain without throwing NullPointerException: val length = duck?.name?.length ?: 0 println(\u0026#34;Duck name length: $length\u0026#34;) // Executing code only when a value is guaranteed non-null: duck?.name?.let { println(\u0026#34;Valid duck name: $it\u0026#34;) } } The generics chapter is surprisingly thorough. Using a concrete Pet hierarchy with dogs and cats, it walks through declaration-site variance and demystifies what out (covariance) and in (contravariance) mean in practice:\n// Chapter 10 uses a Pet hierarchy to teach generic variance (in/out): abstract class Pet(val name: String) class Cat(name: String) : Pet(name) class Dog(name: String) : Pet(name) // Covariance (out) allows Contest\u0026lt;Cat\u0026gt; to be passed where Contest\u0026lt;Pet\u0026gt; is expected: class Contest\u0026lt;out T : Pet\u0026gt;(val entries: List\u0026lt;T\u0026gt;) { fun getWinner(): T = entries.random() } // Contravariance (in) allows a Retailer\u0026lt;Pet\u0026gt; to supply animals to a Retailer\u0026lt;Cat\u0026gt;: interface Vet\u0026lt;in T : Pet\u0026gt; { fun treat(patient: T) } The book finishes strong with two dedicated chapters on lambdas, higher-order functions, and standard collection combinators, illustrating trailing lambda syntax and pipeline operations:\n// Chapters 11 and 12 close out with higher-order functions and collection combinators: data class Grocery( val name: String, val category: String, val unitPrice: Double, val quantity: Int ) fun search(groceries: List\u0026lt;Grocery\u0026gt;, criteria: (Grocery) -\u0026gt; Boolean): List\u0026lt;Grocery\u0026gt; { val results = mutableListOf\u0026lt;Grocery\u0026gt;() for (item in groceries) { if (criteria(item)) { results.add(item) } } return results } fun main() { val cart = listOf( Grocery(\u0026#34;Tea\u0026#34;, \u0026#34;Beverage\u0026#34;, 4.5, 2), Grocery(\u0026#34;Coffee\u0026#34;, \u0026#34;Beverage\u0026#34;, 8.0, 1), Grocery(\u0026#34;Apples\u0026#34;, \u0026#34;Produce\u0026#34;, 1.2, 5) ) // Trailing lambda syntax and chaining stdlib combinators: val totalProduceCost = cart .filter { it.category == \u0026#34;Produce\u0026#34; } .map { it.unitPrice * it.quantity } .fold(0.0) { acc, cost -\u0026gt; acc + cost } } Compare that to Head First Go, which felt reasonably complete without needing to punt a top-ten list to the back of the book, but that\u0026rsquo;s not really a fair fight. Go is a deliberately small language by design (that\u0026rsquo;s Rob Pike\u0026rsquo;s whole philosophy: minimal surface area, few ways to do anything), so a Head First treatment of it has a real shot at covering the whole language in the main chapters. Kotlin\u0026rsquo;s surface area is just bigger: null safety, data classes, sealed classes, extension functions, coroutines, object expressions/declarations, operator overloading. So a book aimed at teaching it from scratch in a similarly-sized page count is going to hit a wall and have to defer something. It\u0026rsquo;s less \u0026ldquo;Head First Kotlin did a worse job\u0026rdquo; and more \u0026ldquo;the two books picked structurally different-sized languages to cover with the same format.\u0026rdquo;\n","permalink":"https://llcawthorne.github.io/posts/head-first-kotlin/","summary":"\u003cp\u003e\u003cimg alt=\"Head First Kotlin cover\" loading=\"lazy\" src=\"/posts/head-first-kotlin/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eBetter than initially assessed: Chapter 2 introduces collections, good variance\ncoverage (with a Pet hierarchy), covers extensions and their role in the stdlib,\ntwo lambda/HOF chapters. Unusual ordering: generics before lambdas.\nmap/filter/fold deferred to lambda chapters. Coroutines appendix exists but\ndated.\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eHead First Kotlin\u003c/em\u003e uses the usual Head First spiral approach (introduce a\nconcept lightly, let it sit, circle back with depth later), which meant it\ndeferred anything not strictly load-bearing to the appendices. Labeled breaks\nand enum classes, both things I\u0026rsquo;d consider core language features, got pushed\nall the way to Appendix C rather than covered in the main chapters. That\nappendix is even honest about it in the title: \u0026ldquo;The Top Ten Things (We Didn\u0026rsquo;t\nCover)\u0026rdquo;: ten separate topics, including packages, visibility modifiers, sealed\nclasses, and object declarations, that never made it into the twelve main\nchapters at all.\u003c/p\u003e","title":"Head First Kotlin"},{"content":"\nKotlin from Scratch is a project book, and the projects are mostly math and computation: Euclid\u0026rsquo;s algorithm, the Sieve of Eratosthenes, Fibonacci, physics simulations, fractals, sorting, and A* search. It was good typing practice, and some of the math and algorithms were really interesting, but it was disappointing as a source of good Kotlin code. The first two chapters covered the language fundamentals in almost as much depth as all of Head First Kotlin, but that depth never came back. Nothing after chapter 2 touches generics, sealed classes, delegation, or coroutines, extension functions never show up, and the language features stay limited. Chapter 3 was a whole detour into JavaFX that I didn\u0026rsquo;t ask for and won\u0026rsquo;t need for Android or Swift, though I don\u0026rsquo;t regret typing it, since the Stage and Scene boilerplate turned into a really cool spiral, and fighting the Gradle multi-module setup taught me more about the build system than the book itself did.\nThe early mathematical exercises rely heavily on traditional imperative loops and mutable var declarations for classic algorithms:\n// Early chapters lean heavily on mutable vars for classic mathematical algorithms: fun gcd(a: Int, b: Int): Int { var x = a var y = b while (y != 0) { val temp = y y = x % y x = temp } return x } fun sieve(limit: Int): List\u0026lt;Int\u0026gt; { val isPrime = BooleanArray(limit + 1) { true } isPrime[0] = false isPrime[1] = false var p = 2 while (p * p \u0026lt;= limit) { if (isPrime[p]) { var multiple = p * p while (multiple \u0026lt;= limit) { isPrime[multiple] = false multiple += p } } p++ } return isPrime.indices.filter { isPrime[it] } } The author\u0026rsquo;s code quality was the real letdown. He leans on mutable vars constantly, and worse, on global mutable state. If anything, spotting all those vars helped remind me to use more vals. The genetic algorithm chapter had tournament() calls with no parameters that still returned different results every time, because they were secretly reaching into a global population plus some randomness, so there\u0026rsquo;s no referential transparency and no way to reason about a call site without reading the function body. The comments were often pure noise too, like // Run the genetic algorithm sitting right above runGA(). Project 16 was missing an entire function, which the errata later confirmed wasn\u0026rsquo;t my mistake, so I pulled that one from the GitHub companion repo instead of fighting a broken example.\nThe fold and map chapter was a letdown in a different way. It only reached for the classic textbook examples of summing a list, calculating a product, and concatenating strings, and nothing that shows off what the tools are actually for. I ended up chewing on a much better example on my own, finding all the subsets of a set (the power set). I worked that out mostly by instinct, keeping the subsets so far and, for each new element, adding a copy of every existing subset with that element in it, before I ever realized fold was the idiomatic way to express it. Even where the book does introduce a powerful construct, it plays it safe with examples that don\u0026rsquo;t show its range:\n// The book\u0026#39;s fold examples were basic, motivating this comparison of // imperative mutable set building versus an idiomatic one-liner with fold: fun \u0026lt;T\u0026gt; powerSet(set: Set\u0026lt;T\u0026gt;): Set\u0026lt;Set\u0026lt;T\u0026gt;\u0026gt; { var subsetsSoFar: MutableSet\u0026lt;Set\u0026lt;T\u0026gt;\u0026gt; = mutableSetOf(emptySet()) for (element in set) { val newSubsets: MutableSet\u0026lt;Set\u0026lt;T\u0026gt;\u0026gt; = mutableSetOf() for (existing in subsetsSoFar) { val combined: MutableSet\u0026lt;T\u0026gt; = mutableSetOf() combined.addAll(existing) combined.add(element) newSubsets.add(combined) } subsetsSoFar.addAll(newSubsets) } return subsetsSoFar } fun \u0026lt;T\u0026gt; powerSetFold(set: Set\u0026lt;T\u0026gt;): Set\u0026lt;Set\u0026lt;T\u0026gt;\u0026gt; = set.fold(setOf(emptySet())) { subsetsSoFar, element -\u0026gt; subsetsSoFar + subsetsSoFar.map { it + element } } One thing it did get right, which I wouldn\u0026rsquo;t have assumed coming from Java, is its package-naming advice to \u0026ldquo;join multiple words or use camelCase,\u0026rdquo; which checks out against the official Kotlin coding conventions, since they explicitly allow both.\nI skipped typing the Modeling/Simulation and Fractals chapters, since they were more JavaFX and more of the same mutable-state pattern, and just skimmed them on GitHub instead. The sorting and searching chapter (chapter 7) had the cleanest code in the book, with fewer vars, and the ones it had were properly scoped instead of global. In-place sorting algorithms are supposed to mutate anyway, so that\u0026rsquo;s not really a knock.\nThe genetic algorithm (GA) chapter and the particle swarm optimization (PSO) and ant colony chapter were the highlight. I typed three GA variants by hand (a toy problem, a knapsack problem, and multivariate equation solving, by way of the \u0026ldquo;weasel program\u0026rdquo; Shakespeare quote demo), then took the GitHub shortcut for PSO and the traveling salesman ant simulation once I\u0026rsquo;d internalized the pattern. PSO actually beat the GA on the Eggholder problem: it took fewer generations, found a solution the GA never found in multiple runs, and didn\u0026rsquo;t get stuck in the same local optimum the GA kept falling into:\n// The closing chapters implement nature-inspired optimization algorithms, // such as a genetic algorithm knapsack solver with chromosome fitness evaluation: data class Individual(val chromosome: BooleanArray, var fitness: Double = 0.0) class GeneticAlgorithm( private val weights: DoubleArray, private val values: DoubleArray, private val capacity: Double, private val popSize: Int = 100, private val mutationRate: Double = 0.01 ) { fun calculateFitness(ind: Individual): Double { var totalWeight = 0.0 var totalValue = 0.0 for (i in ind.chromosome.indices) { if (ind.chromosome[i]) { totalWeight += weights[i] totalValue += values[i] } } return if (totalWeight \u0026lt;= capacity) totalValue else 0.0 } fun tournamentSelection(population: List\u0026lt;Individual\u0026gt;, k: Int = 5): Individual { val tournament = List(k) { population.random() } return tournament.maxByOrNull { it.fitness } ?: tournament.first() } } So it\u0026rsquo;s worth reading for the algorithms and the typing reps, but not for the Kotlin, and I wouldn\u0026rsquo;t recommend it as a \u0026ldquo;here\u0026rsquo;s good idiomatic Kotlin\u0026rdquo; reference.\n","permalink":"https://llcawthorne.github.io/posts/kotlin-from-scratch/","summary":"\u003cp\u003e\u003cimg alt=\"Kotlin from Scratch cover\" loading=\"lazy\" src=\"/posts/kotlin-from-scratch/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eKotlin from Scratch\u003c/em\u003e is a project book, and the projects are mostly math and\ncomputation: Euclid\u0026rsquo;s algorithm, the Sieve of Eratosthenes, Fibonacci, physics\nsimulations, fractals, sorting, and A* search. It was good typing practice, and\nsome of the math and algorithms were really interesting, but it was\ndisappointing as a source of good Kotlin code. The first two chapters covered\nthe language fundamentals in almost as much depth as all of \u003cem\u003eHead First\nKotlin\u003c/em\u003e, but that depth never came back. Nothing after chapter 2 touches\ngenerics, sealed classes, delegation, or coroutines, extension functions never\nshow up, and the language features stay limited. Chapter 3 was a whole detour\ninto JavaFX that I didn\u0026rsquo;t ask for and won\u0026rsquo;t need for Android or Swift, though I\ndon\u0026rsquo;t regret typing it, since the Stage and Scene boilerplate turned into a\nreally cool spiral, and fighting the Gradle multi-module setup taught me more\nabout the build system than the book itself did.\u003c/p\u003e","title":"Kotlin from Scratch"},{"content":"\n1177 BC is far less a final verdict than I would\u0026rsquo;ve preferred. Apparently, historians have discussed the Bronze Age collapse for at least 100 years, but this book mostly calls into question the traditional simple ideas and makes a case for a combination of earthquakes, revolts, and, to a much lesser extent than originally thought, the sea people invading, plus maybe some type of disruption of the trade networks, which again could be caused by the sea people or other unknown maritime raiders.\nIt\u0026rsquo;s also possible that the private merchant class became more important than the traditional palace-based economy, but many disagree with this opinion despite the fact it has some supporters with good arguments. The sea people may have been more merchant than invader. But that shift could\u0026rsquo;ve happened in the chaos after the collapse, rather than being a cause of the collapse on its own.\nThe most important take home is that there are only maybe two clear references to the sea people, the strongest being from Egypt. Others are merely references to enemy ships. So much of the argument for the sea people being the sole cause of collapse is greatly overstated, especially since many of the cities that fell don\u0026rsquo;t look like sites of combat. People have written entire books on sea people despite the lack of clear evidence. If they existed and contributed, it was probably on a smaller scale, maybe in the fall of a couple of major civilizations, possibly Egypt, but they weren\u0026rsquo;t a clear cause of the collapse as a whole. Indeed, their artifacts may occur in many places due to them moving in after civilization collapse for other reasons. Even the clearest remains we have of the sea people are questionable. There were definitely cultural changes in artifacts post-collapse.\nI learned a lot about how modern history has incorporated scientific methods, including DNA analysis, and it looks like migrant southern Europeans mated with Canaanites rather than invading the area. It\u0026rsquo;s questionable what displaced the southern Europeans, but waves of earthquakes are possible judging by the remains of cities in the area.\nThere are also at least ten diseases that could\u0026rsquo;ve ravaged the late Bronze Age civilizations, but it\u0026rsquo;s difficult to find objective evidence and no one wrote about it if there was widespread disease. Considering there\u0026rsquo;s no clear argument for a single cause, epidemic as a contributing cause isn\u0026rsquo;t out of the question despite the lack of evidence. But that basically translates to the evidence being so poor that guessing is allowed.\nThere\u0026rsquo;s more evidence than before of widespread drought due to climate change. Some letters point to famines in several of the major kingdoms, and looping back to the \u0026ldquo;sea people,\u0026rdquo; they could be Europeans driven south and west from famine. Apparently, historians are happy to spend their whole life arguing over drought indicated only by two textual references. Fortunately, new scientific methods have confirmed drought conclusively enough that it is now considered a major historical event. All that information has become available since the first edition of this book, and the author was quite hyped about it. It\u0026rsquo;s awfully suspicious that climate change, which is our modern danger, also happened to be at least part of the cause of the Bronze Age collapse, but stranger coincidences have happened even if it could easily be modern historians grasping at modern problems. However, scientific pollen studies, oxygen isotope studies, stalactite growth studies, and studies of the Nile all point to extended droughts in many major kingdoms around 1250-1000 BC.\nHonestly, it sounds like this whole book could be replaced by a sentence saying 300 years of drought did it. That\u0026rsquo;s a bit of an oversimplification; he sticks to his guns on the idea that it was multiple factors. But the author has changed his mind enough to say drought could easily be the main driver, where in the first edition he thought drought wasn\u0026rsquo;t well supported enough to be anything but a minor contributing factor. There\u0026rsquo;s still an open question of whether it was climate change or volcanic activity that caused the drought. Also, the evidence of revolts in some towns could\u0026rsquo;ve been explained by drought and famine, and it likely also contributed to European migration. So everything we talked about is still relevant. The author stands by his point that any one cause would\u0026rsquo;ve been lucky to bring down one major civilization, much less all of them, so it is likely drought was a major contributing factor among many others, some possibly connected to the drought. The fact that the drought likely lasted 300 years is why it had a bigger impact than other smaller droughts, and the connected economy likely helped chain the failures when systems started collapsing.\nI did learn how much faith historians put in pottery and that the siege of Troy has more historical evidence than the Hebrew Exodus.\n","permalink":"https://llcawthorne.github.io/posts/1177-bc/","summary":"\u003cp\u003e\u003cimg alt=\"1177 BC cover\" loading=\"lazy\" src=\"/posts/1177-bc/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003e1177 BC is far less a final verdict than I would\u0026rsquo;ve preferred. Apparently, historians have discussed the Bronze Age collapse for at least 100 years, but this book mostly calls into question the traditional simple ideas and makes a case for a combination of earthquakes, revolts, and, to a much lesser extent than originally thought, the sea people invading, plus maybe some type of disruption of the trade networks, which again could be caused by the sea people or other unknown maritime raiders.\u003c/p\u003e","title":"1177 BC"},{"content":"\nSometimes it\u0026rsquo;s fun to read easy books, and this was an easy, fun book. It didn\u0026rsquo;t go into as much depth about Python as the Python Tutorial on the Python website, but it covered the basics, then went on a romping overview of using all sorts of libraries to perform tasks you might need to perform. Some of the tasks were pretty relevant, like loading an Excel file, working with JSON, or sending yourself an email; others were cool and could be put to creative uses, like driving a web browser with Playwright or working with a SQLite database; and some were kind of niche topics that I\u0026rsquo;d look back up if I ever needed to deal with them, like working with XML, OCR, or speech recognition. They were all kind of fun to play with, so I enjoyed reading this book.\nThe early chapters quickly move through language fundamentals into practical text scanning using Python\u0026rsquo;s re module and pathlib for file traversal:\n# Chapters 9 and 10 introduce regular expressions and filesystem operations: import re from pathlib import Path phone_regex = re.compile( r\u0026#34;\u0026#34;\u0026#34;( (\\d{3}|\\(\\d{3}\\))? # Area code (\\s|-|\\.)? # Separator (\\d{3}) # First 3 digits (\\s|-|\\.) # Separator (\\d{4}) # Last 4 digits )\u0026#34;\u0026#34;\u0026#34;, re.VERBOSE, ) # Scanning text files in the working directory for matching numbers: for path in Path.cwd().glob(\u0026#34;*.txt\u0026#34;): content = path.read_text(encoding=\u0026#34;utf-8\u0026#34;) matches = phone_regex.findall(content) if matches: print(f\u0026#34;Found {len(matches)} phone number(s) in {path.name}\u0026#34;) From there, the book turns into a tour of practical recipes, like updating produce prices across spreadsheet cells with openpyxl:\n# Chapter 14 manipulates spreadsheets using openpyxl: import openpyxl wb = openpyxl.load_workbook(\u0026#34;produceSales.xlsx\u0026#34;) sheet = wb[\u0026#34;Sheet\u0026#34;] # Updating produce prices in place: PRICE_UPDATES = {\u0026#34;Garlic\u0026#34;: 3.07, \u0026#34;Celery\u0026#34;: 1.19, \u0026#34;Lemon\u0026#34;: 1.27} for row_num in range(2, sheet.max_row + 1): produce_name = sheet.cell(row=row_num, column=1).value if produce_name in PRICE_UPDATES: sheet.cell(row=row_num, column=2).value = PRICE_UPDATES[produce_name] wb.save(\u0026#34;updatedProduceSales.xlsx\u0026#34;) The later chapters touch on richer automation, using Playwright to control a headless browser, fill in form inputs, and inspect dynamic page elements:\n# Later chapters automate modern web browsers using Playwright: from playwright.sync_api import sync_playwright with sync_playwright() as playwright: browser = playwright.chromium.launch(headless=True) page = browser.new_page() page.goto(\u0026#34;https://pypi.org\u0026#34;) # Interacting with live page elements: search_input = page.locator(\u0026#34;input[name=\u0026#39;q\u0026#39;]\u0026#34;) search_input.fill(\u0026#34;requests\u0026#34;) search_input.press(\u0026#34;Enter\u0026#34;) page.wait_for_selector(\u0026#34;.package-snippet\u0026#34;) top_result = page.locator(\u0026#34;.package-snippet__name\u0026#34;).first.text_content() print(\u0026#34;Top PyPI search result:\u0026#34;, top_result) browser.close() ","permalink":"https://llcawthorne.github.io/posts/automate-the-boring-stuff-with-python/","summary":"\u003cp\u003e\u003cimg alt=\"Automate the Boring Stuff with Python cover\" loading=\"lazy\" src=\"/posts/automate-the-boring-stuff-with-python/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eSometimes it\u0026rsquo;s fun to read easy books, and this was an easy, fun book. It didn\u0026rsquo;t\ngo into as much depth about Python as the Python Tutorial on the Python website,\nbut it covered the basics, then went on a romping overview of using all sorts of\nlibraries to perform tasks you might need to perform. Some of the tasks were\npretty relevant, like loading an Excel file, working with JSON, or sending\nyourself an email; others were cool and could be put to creative uses, like\ndriving a web browser with Playwright or working with a SQLite database; and\nsome were kind of niche topics that I\u0026rsquo;d look back up if I ever needed to deal\nwith them, like working with XML, OCR, or speech recognition. They were all kind\nof fun to play with, so I enjoyed reading this book.\u003c/p\u003e","title":"Automate the Boring Stuff with Python"},{"content":"Go\u0026rsquo;s tooling is what stuck with me the most. gofmt is flawless, even on case statements, no matter how hard I try to trick it, it always formats the file correctly. Cross-compilation with GOOS/GOARCH is excellent, shipping a single self-contained binary is genuinely nice to hand off, and the command line tooling is great too. I like that the implementation stays transparent instead of hiding behind framework magic, and I prefer simple structs with methods over deep inheritance hierarchies. Head First Go gave me real confidence with the language, and Powerful Command-Line Applications in Go taught me a lot about building command-line apps, even in languages other than Go, like how easy it is to write a markdown previewer when the standard library gives you so much for free, and to always check out a new language\u0026rsquo;s argument-parsing frameworks early. Even // comments felt natural to me.\nSome of it is more neutral than a selling point. I appreciate Go\u0026rsquo;s minimalism as a deliberate design choice even though it isn\u0026rsquo;t really my target use case. Google\u0026rsquo;s involvement makes me a little cautious. Binary size and startup time don\u0026rsquo;t matter much for what I build, and skipping a GC isn\u0026rsquo;t a selling point when I\u0026rsquo;m not doing systems programming.\nI\u0026rsquo;m moving on from Go for now. Kotlin is more professionally applicable to me, and it works as a better Java without leaving the JVM. Real app development projects in Kotlin and Swift give me concrete motivation that Go doesn\u0026rsquo;t, and honestly my language list just needed trimming.\nI might come back to it, though. Distributed Systems in Go looks like the most transparent way to see microservice patterns without Spring hiding the mechanics, and Learn Go with Tests looks good for picking up TDD patterns. The books will still be there, and Go isn\u0026rsquo;t going anywhere.\nAfter trying ktlint in Kotlin, I\u0026rsquo;m even more impressed with how reliable and fast gofmt is. It\u0026rsquo;s a benefit of working with such a simple language. ktlint flags errors well but regularly gets stymied and unable to fix the file, so I have to either fix it manually or ignore the error. Formatting is more consistent in IntelliJ though, which is the main place I do Kotlin work. This is just something that bugs me when I type in book code in Vim, and Kotlin book code isn\u0026rsquo;t even formatted to ktlint\u0026rsquo;s specs either, whereas Go code everywhere looks pretty much the same. I still have to deal with Go\u0026rsquo;s odd capitalization rules for function names, but at least everything else looks reliably good.\n","permalink":"https://llcawthorne.github.io/posts/go-language-opinions/","summary":"\u003cp\u003eGo\u0026rsquo;s tooling is what stuck with me the most. gofmt is flawless, even on case\nstatements, no matter how hard I try to trick it, it always formats the file\ncorrectly. Cross-compilation with GOOS/GOARCH is excellent, shipping a\nsingle self-contained binary is genuinely nice to hand off, and the command\nline tooling is great too. I like that the implementation stays transparent\ninstead of hiding behind framework magic, and I prefer simple structs with\nmethods over deep inheritance hierarchies. \u003cem\u003eHead First Go\u003c/em\u003e gave me real\nconfidence with the language, and \u003cem\u003ePowerful Command-Line Applications in Go\u003c/em\u003e\ntaught me a lot about building command-line apps, even in languages other\nthan Go, like how easy it is to write a markdown previewer when the standard\nlibrary gives you so much for free, and to always check out a new language\u0026rsquo;s\nargument-parsing frameworks early. Even \u003ccode\u003e//\u003c/code\u003e comments felt natural to me.\u003c/p\u003e","title":"Go Language Opinions"},{"content":"\nThis was a good way to see a number of non-trivial applications in Go. It tackled real projects like a Markdown Previewer and a Port Scanner and used production-grade libraries like Cobra for command-line arguments and Viper for configuration settings. The Markdown Previewer was probably good enough for me to consider using it. Honestly, Cobra and Viper were good enough libraries that it makes me start looking at what my options are for command-line parsing libraries early when studying a new language now. A lot of the examples were big to type, but that is good since it made me feel more comfortable with the language. They were also complicated enough that I made mistakes and got to deal with error messages from the compiler. I will say I was disappointed multiple times that Go\u0026rsquo;s compiler points out the first error it finds and then stops, so when you fix it you might just be greeted by another error. It\u0026rsquo;s not like Java or Kotlin where the compiler spits out 10 errors and 5 are probably caused by the earlier errors but the other 5 need to be corrected. The pomodoro app was actually quite usable after I got past the fact that it wouldn\u0026rsquo;t display correctly in tmux. That was a hard debugging session wondering what was wrong with my output from typing up the code before I finally pinned the blame on running it in a tmux session though, since having a tmux session is just getting so normal to me. Not only did I learn a lot about using Go for small to intermediate-sized projects, but I learned a lot about writing good command-line apps that I can take with me to other languages.\nThe book starts with a simple word and line counter using flag, decoupling I/O behind io.Reader so you can test it with a bytes.Buffer:\n// Chapters 1 and 2 start with standard flag-based word/line counting, // decoupling I/O using io.Reader so testing with bytes.Buffer is trivial: func count(r io.Reader, countLines bool) int { scanner := bufio.NewScanner(r) if !countLines { scanner.Split(bufio.ScanWords) } wc := 0 for scanner.Scan() { wc++ } return wc } func main() { lines := flag.Bool(\u0026#34;l\u0026#34;, false, \u0026#34;Count lines\u0026#34;) flag.Parse() fmt.Println(count(os.Stdin, *lines)) } Projects like the Markdown Previewer (mdp) pull together file I/O, temp files, HTML templates, and launching a browser:\n// Chapter 3 builds the Markdown previewer, converting markdown to HTML // and creating temporary preview files before launching a browser: func run(filename string, out io.Writer, skipPreview bool) error { input, err := os.ReadFile(filename) if err != nil { return err } htmlData := parseContent(input) tempFile, err := os.CreateTemp(\u0026#34;\u0026#34;, \u0026#34;mdp*.html\u0026#34;) if err != nil { return err } defer os.Remove(tempFile.Name()) if err := saveHTML(tempFile.Name(), htmlData); err != nil { return err } if skipPreview { return nil } return preview(tempFile.Name()) } By the end, the book walks through full interactive terminal applications like the Pomodoro tool (pomo), backing the terminal UI with a concurrent in-memory repository protected by sync.RWMutex:\n// Chapter 9 reaches the interactive Pomodoro tool, backing the terminal UI // with a thread-safe in-memory repository protected by sync.RWMutex: type inMemoryRepo struct { sync.RWMutex intervals []pomodoro.Interval } func NewInMemoryRepo() *inMemoryRepo { return \u0026amp;inMemoryRepo{ intervals: []pomodoro.Interval{}, } } func (r *inMemoryRepo) Create(i pomodoro.Interval) (int64, error) { r.Lock() defer r.Unlock() i.ID = int64(len(r.intervals)) + 1 r.intervals = append(r.intervals, i) return i.ID, nil } func (r *inMemoryRepo) ByID(id int64) (pomodoro.Interval, error) { r.RLock() defer r.RUnlock() if id == 0 || int(id) \u0026gt; len(r.intervals) { return pomodoro.Interval{}, fmt.Errorf(\u0026#34;%w: %d\u0026#34;, pomodoro.ErrInvalidID, id) } return r.intervals[id-1], nil } ","permalink":"https://llcawthorne.github.io/posts/powerful-command-line-applications-in-go/","summary":"\u003cp\u003e\u003cimg alt=\"Powerful Command-Line Applications in Go cover\" loading=\"lazy\" src=\"/posts/powerful-command-line-applications-in-go/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eThis was a good way to see a number of non-trivial applications in Go. It\ntackled real projects like a Markdown Previewer and a Port Scanner and used\nproduction-grade libraries like Cobra for command-line arguments and Viper for\nconfiguration settings. The Markdown Previewer was probably good enough for me\nto consider using it. Honestly, Cobra and Viper were good enough libraries\nthat it makes me start looking at what my options are for command-line\nparsing libraries early when studying a new language now. A lot of the\nexamples were big to type, but that is good since it made me feel more\ncomfortable with the language. They were also complicated enough that I made\nmistakes and got to deal with error messages from the compiler. I will say I\nwas disappointed multiple times that Go\u0026rsquo;s compiler points out the first error\nit finds and then stops, so when you fix it you might just be greeted by\nanother error. It\u0026rsquo;s not like Java or Kotlin where the compiler spits out 10\nerrors and 5 are probably caused by the earlier errors but the other 5 need\nto be corrected. The pomodoro app was actually quite usable after I got past\nthe fact that it wouldn\u0026rsquo;t display correctly in tmux. That was a hard\ndebugging session wondering what was wrong with my output from typing up the\ncode before I finally pinned the blame on running it in a tmux session\nthough, since having a tmux session is just getting so normal to me. Not only\ndid I learn a lot about using Go for small to intermediate-sized projects,\nbut I learned a lot about writing good command-line apps that I can take\nwith me to other languages.\u003c/p\u003e","title":"Powerful Command-Line Applications in Go"},{"content":"\nOverall, it\u0026rsquo;s what I expect from a Head First book. It was a perfectly serviceable introduction to the Go programming language. Although it\u0026rsquo;s a Head First book, I feel like it treated me like an experienced programmer and didn\u0026rsquo;t waste a lot of time explaining how an if expression worked. Unlike Head First Kotlin which never got to a lot of things that it had to toss into Ten Brief Topics in the Appendix, it felt like it covered all the main topics that needed to be covered to understand Go. It even includes coverage of automated testing and a couple of chapters on web apps.\nIt skips past the basics quickly and gets right into Go\u0026rsquo;s core habits: multiple return values and the if err != nil checks you end up writing everywhere:\n// Chapter 3 introduces functions, pointers, and Go\u0026#39;s ubiquitous error handling: func paintNeeded(width float64, height float64) (float64, error) { if width \u0026lt; 0 { return 0, fmt.Errorf(\u0026#34;a width of %0.2f is invalid\u0026#34;, width) } if height \u0026lt; 0 { return 0, fmt.Errorf(\u0026#34;a height of %0.2f is invalid\u0026#34;, height) } area := width * height return area / 10.0, nil } func main() { amount, err := paintNeeded(4.2, 3.0) if err != nil { log.Fatal(err) } fmt.Printf(\u0026#34;%0.2f liters needed\\n\u0026#34;, amount) } By the middle of the book, the focus shifts to structs, defined types, and interfaces. Go\u0026rsquo;s interfaces are satisfied implicitly without an implements keyword, and the book spends adequate time showing how to extract concrete values back out via type assertions:\n// Chapter 11 covers interfaces, implicit satisfaction, and type assertions: type Player interface { Play(track string) Stop() } type TapePlayer struct { Batteries string } func (t TapePlayer) Play(track string) { fmt.Println(\u0026#34;Playing\u0026#34;, track) } func (t TapePlayer) Stop() { fmt.Println(\u0026#34;Stopped!\u0026#34;) } // Any type implementing Play and Stop satisfies Player automatically: func playList(device Player, songs []string) { for _, song := range songs { device.Play(song) } device.Stop() // Type assertions safely retrieve concrete implementations: if tape, ok := device.(TapePlayer); ok { fmt.Println(\u0026#34;Tape battery status:\u0026#34;, tape.Batteries) } } The final chapters put everything together into real web apps using net/http handlers and html/template:\n// Chapters 15 and 16 wrap up by building web applications using // standard net/http handlers and html/template rendering: type Guestbook struct { SignatureCount int Signatures []string } func viewHandler(writer http.ResponseWriter, request *http.Request) { signatures, err := getStrings(\u0026#34;signatures.txt\u0026#34;) if err != nil { http.Error(writer, err.Error(), http.StatusInternalServerError) return } html, err := template.ParseFiles(\u0026#34;view.html\u0026#34;) if err != nil { http.Error(writer, err.Error(), http.StatusInternalServerError) return } guestbook := Guestbook{ SignatureCount: len(signatures), Signatures: signatures, } err = html.Execute(writer, guestbook) if err != nil { http.Error(writer, err.Error(), http.StatusInternalServerError) } } ","permalink":"https://llcawthorne.github.io/posts/head-first-go/","summary":"\u003cp\u003e\u003cimg alt=\"Head First Go cover\" loading=\"lazy\" src=\"/posts/head-first-go/images/cover.jpg\"\u003e\u003c/p\u003e\n\u003cp\u003eOverall, it\u0026rsquo;s what I expect from a Head First book. It was a perfectly\nserviceable introduction to the Go programming language. Although it\u0026rsquo;s a Head\nFirst book, I feel like it treated me like an experienced programmer and\ndidn\u0026rsquo;t waste a lot of time explaining how an \u003ccode\u003eif\u003c/code\u003e expression worked. Unlike\n\u003cem\u003eHead First Kotlin\u003c/em\u003e which never got to a lot of things that it had to toss\ninto \u003cem\u003eTen Brief Topics in the Appendix\u003c/em\u003e, it felt like it covered all the main\ntopics that needed to be covered to understand Go. It even includes coverage\nof automated testing and a couple of chapters on web apps.\u003c/p\u003e","title":"Head First Go"},{"content":"So, I haven\u0026rsquo;t been blogging for about ten years. To tell the truth, I spent all day programming, so when I got off work, I spent my time reading history or philosophy or anything else not computer related. I can see from my previous posts that I was experimenting with video and had started reading Agile Web Development with Rails. Well, I\u0026rsquo;m still a full stack web developer, so I could do worse than looking back at the web framework that really started it all. So I will read Agile Web Development with Rails 8 and get a taste of convention before configuration. That doesn\u0026rsquo;t really fit with the new title of the blog, but it\u0026rsquo;s still something I want to do, so I will get it done. I was interested in functional programming and different approaches to web development 10 years ago, and have never fully explored either, so I\u0026rsquo;m picking up where I left off with a slightly updated approach.\nHaskell But let\u0026rsquo;s talk about the new title. It is \u0026ldquo;Senior Software Engineer Learns Functional Programming.\u0026rdquo; One of the last things I did but never blogged about was try to learn Haskell. I started with the venerable The Haskell Book. I read a bit over half and realized I still couldn\u0026rsquo;t program much of anything in Haskell. This was after spending previous effort learning functional programming. I learned some Scala and the syntax of Clojure and felt ineffectual with both aside from being able to use Scala as a better Java, so that\u0026rsquo;s what led me to Haskell to learn functional programming right. Well, I still want to do that. I didn\u0026rsquo;t think I wanted to really, but I spent some time reading Advanced Functional Programming with Elixir and it made a perfectly good case for why Haskell is a better programming language and featured a style that was not idiomatic Elixir but instead very Haskell inspired, and it got me interested again. So I\u0026rsquo;m not going to start over with The Haskell Book and try to re-learn programming from first principles. Instead I am going to read Haskell by Example which is more hands on and dip into the explanations of The Haskell Book whenever I need more theory. I\u0026rsquo;m also about halfway through Learn You a Haskell which I started over vacation, since I\u0026rsquo;m finding my intuition for working with linked lists has degraded.\nElixir The subtitle of the blog is \u0026ldquo;With explorations in Haskell, Elixir, and Clojure\u0026rdquo;. I\u0026rsquo;ve already read two Elixir books on the basics of the language (reviews upcoming) and I have every intention of spending more time with Elixir. The books I read didn\u0026rsquo;t even touch on the cool Actor model and OTP stuff that makes Elixir unique. It\u0026rsquo;s not the best language for learning to deal with immutable values since it allows you to rebind variables, which feels a bit like cheating. Sure the data structure itself is immutable, but you just end up pointing the same variable at the updated copy. Haskell won\u0026rsquo;t let you get away with that. I understand since the variables aren\u0026rsquo;t global and are local to the Actors working behind the scenes it is safe even for concurrent code, but I intend to learn how to deal with immutable data structures bound once to a name. So I will definitely spend some time away with Haskell but eventually get back to Elixir. It overlaps my other goal of trying web frameworks thanks to Phoenix, so my two big projects (\u0026ldquo;Learn Functional Programming\u0026rdquo; and \u0026ldquo;Try Web Frameworks\u0026rdquo;) actually meet.\nClojure I have also bought the most recent edition of Programming Clojure and Clojure Brain Teasers and plan to spend time with it again. I read Getting Clojure and Living Clojure and Clojure for the Brave and True years ago, and I felt pretty comfortable with the syntax of the languages and all the parentheses, but I never was able to use it for much. So after I spend some time writing code with Haskell, I\u0026rsquo;ll spend some time with Clojure again and see if I can do anything cool with it. I\u0026rsquo;m a Java developer by trade, so its position on the JVM feels quite welcome, and once I learn idiomatic functional coding in a language where I can\u0026rsquo;t back off and call Java code, maybe it will be accessible to me. I\u0026rsquo;ll probably spend a while with Haskell and then Elixir first though. I do want to play around with Ring to try writing my webapps with a minimalist Clojure library.\nWeb Frameworks Back to the web frameworks though\u0026hellip; I was going to dive into Agile Web Development with Rails 8 and try Ruby. Then I will read through Django 5 by Example. This builds up four sizable projects which I plan to steal. I don\u0026rsquo;t really like any dynamic language all that much, but I do normally prefer Python to Ruby for its usefulness with AI and its sensible stance on one way to do things and lack of going crazy with metaprogramming. I have every intention of stealing the Django projects to reimplement in other frameworks to serve my own curiosity. First in Rails, then move on to the next stop. So then I can read Programming Elixir and Programming Phoenix Liveview to try doing a web framework. How do I plan to make time for all this? Well, I think I can wrestle with Haskell for at most 30-60 minutes a day, so my time beyond that can be spent toying with web frameworks which requires less cognitive load. After Phoenix, there\u0026rsquo;s other options. I can try writing a typed API in Haskell with Servant or do something with Yesod. I also wouldn\u0026rsquo;t mind reading Distributed Services in Go and trying the same projects as microservices. I happen to like Go for being so simple that you can\u0026rsquo;t hide anything behind the language. I\u0026rsquo;ve recently read two books on it (reviews forthcoming) and feel pretty comfortable with it. Aside from that, I wouldn\u0026rsquo;t mind trying an Angular frontend with a backend in another language, since we actively use Angular in the new project at work. And I\u0026rsquo;m not opposed to trying React to just see the difference. Obviously, all JavaScript Single-Page Applications are more the rage now than old school web frameworks like Rails, and it fits my interests of seeing different ways to do things. I also have been toying around with Kotlin and would love an excuse to go back, so I would like to try Spring with Kotlin for the big enterprise way of doing a web framework along with Ktor for a lighter weight framework in the same language. I could code Spring in Java, but I do like not coding in Java when I\u0026rsquo;m away from work and find Kotlin a fun alternative. Spring and Angular are probably the most professionally relevant interests that I\u0026rsquo;ll be pursuing, but it\u0026rsquo;s obvious that I\u0026rsquo;m not trying to maximize for utility. I do really think it very clever that the new project at work is leaning into a modern Angular UI with a Java backend instead of using any of the trainwreck front end projects available on the Java platform. JSF was bad enough to make me never want to see a Java frontend again. Anyway, that\u0026rsquo;s as far as I\u0026rsquo;ve thought these two projects through, but if I make it that far with them, I\u0026rsquo;ll have a better idea of what I want to do next. Put together, they should keep me busy for a while, and assuming I don\u0026rsquo;t give up blogging for ten years or so again, it will give me something to blog about.\nWhy Now? Why do I think blogging will catch on this time? Well, what made me give up my side projects and blogging before was primarily being burnt out on spending all day coding at work to get off and do more of it at night. Now that my kid is older and I\u0026rsquo;ve got more time to focus on personal development, I figured why not fire the blog back up so I can shout my book reviews and whatnot into the void. Aside from that, work has us leaning a lot more on AI for writing code these days, so it\u0026rsquo;s as good an excuse as any to keep my own skills sharp with some side projects. I\u0026rsquo;ve also been rather good lately at putting my mind to stuff and keeping it going. I lost about 40 pounds and run 10K every day I don\u0026rsquo;t lift weights. So maybe I can stay focused on something intellectual too. Also, I still run over an hour most days a week, which gives me a great opportunity to listen to a history audiobook or fictional work, so it isn\u0026rsquo;t like I\u0026rsquo;m giving up my hobby reading. I\u0026rsquo;m just cutting into other spare time with a new project. As a busy dad, I really get 1-2 hours of free time that I\u0026rsquo;m not working out most days, so it\u0026rsquo;s easy to spend 30-60 minutes on Haskell and the remainder if there is any on something else. Or so I think. We\u0026rsquo;ll see if this blog rebirth lasts. So far, I\u0026rsquo;ve read about 8 technical books that I\u0026rsquo;ll end up posting reviews for, so I already have more content than I had last time before discontinuing it, and it seems something fun to do. I\u0026rsquo;ve already been reading a minimum of 30 minutes a day for over a year, and often for hours, so I\u0026rsquo;m just going to read different stuff.\nI didn\u0026rsquo;t put this in the first draft, because it feels kinda silly to get inspired by a book about a famous person, but there\u0026rsquo;s also another thing that motivated me to do more programming on the side. I listened to the audiobook on Steve Jobs while I was running. Really, I don\u0026rsquo;t care that much about Steve Jobs and still don\u0026rsquo;t after listening to his life story. He definitely had vision and did good things with Apple, and I\u0026rsquo;m writing this on a Mac so can\u0026rsquo;t complain about the results, but I consider him more of a visionary businessman than a real hacker. I liked Isaacson\u0026rsquo;s biography of Benjamin Franklin and figured Steve Jobs would be another accessible work by him for my runs. But you can\u0026rsquo;t read about the founding of Apple without encountering Woz. A true engineer that would\u0026rsquo;ve gladly made computers and gave them away, because he loved tinkering with circuitboards. I don\u0026rsquo;t really care about circuitboards either; I\u0026rsquo;ve always been a software guy. But being exposed to a story with that type of passion reminded me I used to be passionate about computers.\nI\u0026rsquo;ve always had a bit of a love-hate relationship with Apple. I still have Linux on my desktop PC and am a proud member of the Columbia Linux User\u0026rsquo;s Group despite not attending meetings all that often. The early Apple computers were toys with no CLI and one button mice because multiple buttons are confusing. But after OS X was reborn with BSD under the hood and a full fledged terminal, I found that having a computer that mostly worked with the default configuration and actually looked pretty good made it easier for me to focus on writing code and not spend so much time tinkering around with Linux. I learned from the Steve Jobs book that the first Macs were expandable because Woz thought people should be able to tinker with their own computers. Maybe I would\u0026rsquo;ve liked those better than the Macs at school.\nAnyway, back to passion, I didn\u0026rsquo;t take my computer apart and hide all the pieces because I thought it would be faster when I put it back together hours later. I did it because I wanted to learn how a computer was put together (I didn\u0026rsquo;t know I wasn\u0026rsquo;t really a hardware guy back then; I honestly prefer buying them off the shelf now). I also didn\u0026rsquo;t learn C and relational databases because I thought they would be profitable (although database knowledge is the gift that keeps on giving). I loved solving problems in C in the middle of the night on my hand-me-down computer. I didn\u0026rsquo;t found an ISP in the 90\u0026rsquo;s to get rich quick, I founded it to have fast Internet access and to have cool problems to figure out. Likewise, I didn\u0026rsquo;t make straight A\u0026rsquo;s in school because I expected it to help my job prospects. No one cares about my GPA. I loved the material! It was fascinating to learn about algorithms, operating systems, and, after programming so long, compilers. Somewhere along the way, it just became work like any other job. So it\u0026rsquo;s a combination of factors: having more free time now that my kid\u0026rsquo;s a little older, work leaning harder on AI for the actual code these days so I want to keep my own chops sharp on the side, a refound passion for programming inspired by a rather unlikely source, and the fact I\u0026rsquo;ve been reading every day over a year anyway, so why not make it technical. I still don\u0026rsquo;t know functional programming beyond how to apply a good map and filter, and I still haven\u0026rsquo;t tried a lot of different web frameworks. They\u0026rsquo;re all likely to be better than the Java EE/Spring hybrid monstrosity that I work on most of the time. Almost anything beats JSF.\nAnd as an aside, this will probably be my last time trying to learn \u0026ldquo;functional programming\u0026rdquo;. If I try to learn the secrets of Haskell again and bounce off, I am just going to adopt Go as my programming language of choice and write lots of simple procedural code with structs and err checks every other line. As an old school C hacker and Perl scripter before they bolted on OOP, it feels quite natural to write straightforward procedural code, but I\u0026rsquo;m trying to work outside my comfort zone even if I think the benefits of functional programming might be overpromised.\nBut I really kinda understood the point of functional programming with Advanced Functional Programming with Elixir, and all those err checks in Go grated at my nerves, so the beauty of being able to chain a bunch of calls together then deal with errors or results at the end was quite appealing to me. Monads aren\u0026rsquo;t really the Elixir way though. Your average Elixir programmer would do some simple pattern matching to catch :err and deal with it instead, but Advanced Functional Programming with Elixir featured a Haskell inspired functional programming library and monads. And while I wasn\u0026rsquo;t ultimately convinced of the utility of the Reader or Effect monads (I\u0026rsquo;m open to learning more about those in Haskell, and I will have to anyway if I spend time with it), I really liked Maybe and liked Either even more. Even Java has Option, but Either is a lot more useful. Plus parallel validations with Applicative were kinda cool. They weren\u0026rsquo;t a reason to re-learn programming, but I\u0026rsquo;ll take them along with my Either and roll with it a bit.\nConclusion So that\u0026rsquo;s it. The blog is reborn. I\u0026rsquo;ve got one project that meshes with the title of learning functional programming. I have another of trying web frameworks that has some limited overlap built in and picks up where the blog left off. I transferred my old posts over and rebuilt the site in Hugo and moved over what I could from the old Jekyll files. And I\u0026rsquo;ve written a very long coming back post plus already have a stash of book reviews in my Obsidian. So I guess I\u0026rsquo;m back and doing this for now and we\u0026rsquo;ll see where it goes. I may get tired of posting updates here and just read the books, but I like having somewhere to collect my thoughts and review what I read.\n","permalink":"https://llcawthorne.github.io/posts/a-blog-reborn/","summary":"\u003cp\u003eSo, I haven\u0026rsquo;t been blogging for about ten years. To tell the truth, I spent\nall day programming, so when I got off work, I spent my time reading history\nor philosophy or anything else not computer related. I can see from my\nprevious posts that I was experimenting with video and had started reading\nAgile Web Development with Rails. Well, I\u0026rsquo;m still a full stack web developer,\nso I could do worse than looking back at the web framework that really started\nit all. So I will read Agile Web Development with Rails 8 and get a taste of\nconvention before configuration. That doesn\u0026rsquo;t really fit with the new title\nof the blog, but it\u0026rsquo;s still something I want to do, so I will get it done.\nI was interested in functional programming and different approaches to web\ndevelopment 10 years ago, and have never fully explored either, so I\u0026rsquo;m picking\nup where I left off with a slightly updated approach.\u003c/p\u003e","title":"A Blog Reborn"},{"content":" I\u0026rsquo;m Lewis Cawthorne, a Senior Software Developer at EXL. All posts here are my own opinions and are in no way reflective of my employer. Day to day I work on the Subrosource platform: an OSGi backend, an Angular frontend, Microsoft SQL Server, AWS, HashiCorp tooling (Vault, Consul, Nomad), and increasingly, AI-assisted development with tools like GitHub Copilot, Cursor, and Claude Code.\nThis site is built with Hugo using the PaperMod theme, hosted on GitHub Pages. Like every personal site ever built, it is, and will probably always be, a work in progress.\nThe posts here are a mix of old and new. Some are notes from years ago that I moved over when I rebuilt the site, kept as-is for the record.\n","permalink":"https://llcawthorne.github.io/about/","summary":"\u003cimg src=\"images/lewis-and-vader.jpg\" alt=\"Lewis Cawthorne with Darth Vader at Disney's Hollywood Studios\" style=\"display: block; max-width: 320px; width: 100%; margin: 0 auto; border-radius: var(--radius);\" /\u003e\n\u003cp\u003eI\u0026rsquo;m Lewis Cawthorne, a Senior Software Developer at EXL. All posts here are\nmy own opinions and are in no way reflective of my employer. Day to day I\nwork on the Subrosource platform: an OSGi backend, an Angular frontend,\nMicrosoft SQL Server, AWS, HashiCorp tooling (Vault, Consul, Nomad), and\nincreasingly, AI-assisted development with tools like GitHub Copilot,\nCursor, and Claude Code.\u003c/p\u003e","title":"About"},{"content":"You can get in touch with or find me at:\nGitHub LinkedIn Facebook My Daily Fitness Journal on the Nerd Fitness Rebellion forums Or by sending an e-mail to llcawthorne@gmail.com ","permalink":"https://llcawthorne.github.io/contact/","summary":"\u003cp\u003eYou can get in touch with or find me at:\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/llcawthorne\"\u003eGitHub\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://www.linkedin.com/in/llcawthorne\"\u003eLinkedIn\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://facebook.com/llcawthorne\"\u003eFacebook\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eMy \u003ca href=\"https://rebellion.nerdfitness.com/topic/124542-llcawthorne%E2%80%99s-daily-battle-log/\"\u003eDaily Fitness Journal\u003c/a\u003e on the Nerd Fitness Rebellion forums\u003c/li\u003e\n\u003cli\u003eOr by sending an e-mail to \u003ca href=\"mailto:llcawthorne@gmail.com\"\u003ellcawthorne@gmail.com\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e","title":"Contact"},{"content":"Lewis Cawthorne llcawthorne@gmail.com\nSenior Software Developer at EXL, working on the Subrosource platform.\nDegrees Masters of Engineering, Computer Science, University of South Carolina, Columbia, SC, Dec 2014\nSpecialization: Information Security\nBS, Computer Science, University of South Carolina, Columbia, SC, Aug 2011\nMinor: Mathematics\nAS, High Honors, Midlands Technical College, Columbia, SC, May 2009\nProfessional Employment Senior Software Developer and Technical Lead, EXL, Jan 2015 - present\nLong-tenured technical contributor on the Subrosource platform, now over a decade with the team Platform lead for Subrosource Classic (the original Java EE / Oracle-based application) and a contributor on its ground-up replacement, built on an OSGi backend (started on Java 11, now on Java 25) with an Angular frontend, backed by Microsoft SQL Server, hosted on AWS, with infrastructure supported by HashiCorp tooling (Vault, Consul, Nomad) Maintain operation of Subrosource Classic and ensure it gets yearly security patches, in addition to new development work on its replacement, ahead of an eventual customer migration off the older platform Extensive experience with Oracle and PL/SQL; independently designed, wrote, and performance-tuned a large PL/SQL package, including deep dives into Oracle internals to resolve performance issues Using AI-assisted development tools day to day, including GitHub Copilot, Cursor, and Claude Code Took a leading role in an agile group with seven developers acting within a larger corporate organization to provide software and services to insurance domain customers Updated Subrosource Classic from Weblogic 10.3 to Weblogic 12 and from Java 1.6 to Java 1.8 Maintained, extended, and helped secure the Subrosource Classic Java EE 5 application on Oracle WebLogic Application Server and Java 1.6 backed by an Oracle 11g database Performed security scans with HP Fortify software and patched found vulnerabilities Developed a web application to provide insight to support technicians debugging general data import issues with JDK 8 and Java EE 7 technologies running on Glassfish 4.1 Application Server with a Vaadin GWT-based rich user interface accessing an Oracle 11g database and custom scripts to extract text log information Researched and made recommendations on ways to ease development team growth pains by better incorporating automated unit, integration, and acceptance testing Wrote, tested, and debugged a batch process based on preexisting procedural logic to on-board a new customer by cleaning, transforming, and importing 80,000 customer claim records which were split up to over half a million relational table entries; primarily handled through the creation and integration of new awk processing scripts, some modification of a C# account registration program, and PL/SQL customizations in the database to handle customer specific account logic Teaching Assistant, University of South Carolina, Aug 2012 - Dec 2014\nFall 2014: Lecture Instructor for CSCE 212 - Intro to Computer Architecture (Assembly) Summer 2014: Lecture Instructor for CSCE 146 - Data Structures Using Java (Java) Spring 2014: Lecture Instructor for CSCE 212 - Intro to Computer Architecture (Assembly) Fall 2013: Lecture Instructor and Lab TA for CSCE 101 - Intro to Computing (Java) Spring 2013: Lecture Instructor for CSCE 204 - Program Design and Development (Visual Basic) Fall 2012: Lab TA for CSCE 145 - Algorithmic Design (Java) Research Assistant, Center for Information Assurance Engineering at USC, Aug 2011 - Dec 2014\nQuantum Complexity Theory research advised by Dr. Stephen A. Fenner Analyzed algorithms which require quantum computers and how problems solvable via quantum algorithms, such as factoring, differ in structure from classical problems Studied quantum entanglement effects on classic two party game theory Investigated mutually unbiased bases for secure quantum key distribution Expanded a C program for web based analysis and graphing of lambda closure functions including a LaTeX based formula parser REU Program Coordinator, Research Experience for Undergraduates at USC, Aug 2011 - Aug 2013\nCoordinated summer housing and activities for 10 undergraduate participants Guided participants through all steps of creating and submitting an academic paper Offered proofreading and implementation advice on 10 papers from 7 different subareas Undergraduate Research Assistant, MLEG Lab at USC, Jun 2010 - Aug 2011\nCreated SMEE, the Sorting Motif Extraction Engine, a biomedical text analysis service using Python for Natural Language Processing and Django web framework Linux System Administrator, EMR Technical Solutions, Feb 2010 - Jun 2010\nSetup various server applications on three Linux servers Managed security on servers, including detection / elimination of prior intrusion Network Administrator, Wave Communications / Durocom / Volaris Online, June 1995 - Sept 2002\nLead the building of what quickly became a 3000-4000 customer Internet provider Maintained 14 high volume servers running multiple operating systems Participated in a 24-hour emergency response on call rotation Supervised a team of 20-40 technical support representatives Ultimately shared primary responsibility for a $10-million regional ISP with a co-administrator, which was acquired by a super-regional provider and then by Earthlink Database Administrator, Doulos Productions, Apr 1992 - Nov 1996\nCreated and managed a 100,000 record relational database Managed a VM386 based dumb terminal multiuser system Technology Applications and Expertise Current Focus: OSGi, Angular, Microsoft SQL Server, AWS, HashiCorp Vault, HashiCorp Consul, HashiCorp Nomad, AI-assisted development (GitHub Copilot, Cursor, Claude Code)\nSpecialized Skills: Java EE, EJB2, EJB3, JSP, JSTL, JSF, RichFaces, JTA, JPA, Layered Architectures, Agile Development, Information Security, User Testing, Full-stack Web Development, Version Control, Web Design\nMarkup/Programming: Java, Python/Django, JavaScript, JQuery, Ruby/Rails, XHTML, HTML5, CSS, CSS3, XML, XSLT, Perl, Awk, PL/SQL, Shell Scripting\nApplications: Eclipse, IntelliJ, Microsoft Office, HP Fortify Security Scanner, Google Drive, Vim, Oracle 9i-11g, Selenium, Git, Subversion, WebLogic 10.3 - 12, Glassfish 4\nOS/Environments: Mac, Linux, Unix, Ubuntu, Windows\nCertifications CNSS 4011, National Training Standard for INFOSEC Professionals\nAwards Presidential Graduate Fellowship, University of South Carolina, Aug 2012 - Apr 2014 Magellan Scholarship Winner, competitive research funding, Jan 2011 - Aug 2011 Outstanding Senior Award, University of South Carolina, Apr 2011 IBM Master the Mainframe Competition, winner Parts 1 and 2, Dec 2010 ΥΠE Scholarship Winner, competitive scholarship, Aug 2010 Societies ACM, Association for Computing Machinery GCC, Gamecock Cybersecurity Club SLC, STARS Leadership Corps ColaLUG, Columbia Linux Users Group Upsilon Pi Epsilon (ΥΠE) and Phi Theta Kappa (ΦΘK) Honor Societies ","permalink":"https://llcawthorne.github.io/resume/","summary":"\u003ch1 id=\"lewis-cawthorne\"\u003eLewis Cawthorne\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"mailto:llcawthorne@gmail.com\"\u003ellcawthorne@gmail.com\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eSenior Software Developer at EXL, working on the Subrosource platform.\u003c/p\u003e\n\u003ch2 id=\"degrees\"\u003eDegrees\u003c/h2\u003e\n\u003cp\u003e\u003cstrong\u003eMasters of Engineering, Computer Science, University of South Carolina, Columbia, SC, Dec 2014\u003c/strong\u003e\u003cbr\u003e\nSpecialization: Information Security\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eBS, Computer Science, University of South Carolina, Columbia, SC, Aug 2011\u003c/strong\u003e\u003cbr\u003e\nMinor: Mathematics\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAS, High Honors, Midlands Technical College, Columbia, SC, May 2009\u003c/strong\u003e\u003c/p\u003e\n\u003ch2 id=\"professional-employment\"\u003eProfessional Employment\u003c/h2\u003e\n\u003cp\u003e\u003cstrong\u003eSenior Software Developer and Technical Lead, EXL, Jan 2015 - present\u003c/strong\u003e\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eLong-tenured technical contributor on the Subrosource platform, now over a decade with the team\u003c/li\u003e\n\u003cli\u003ePlatform lead for Subrosource Classic (the original Java EE / Oracle-based application) and a contributor on its ground-up replacement, built on an OSGi backend (started on Java 11, now on Java 25) with an Angular frontend, backed by Microsoft SQL Server, hosted on AWS, with infrastructure supported by HashiCorp tooling (Vault, Consul, Nomad)\u003c/li\u003e\n\u003cli\u003eMaintain operation of Subrosource Classic and ensure it gets yearly security patches, in addition to new development work on its replacement, ahead of an eventual customer migration off the older platform\u003c/li\u003e\n\u003cli\u003eExtensive experience with Oracle and PL/SQL; independently designed, wrote, and performance-tuned a large PL/SQL package, including deep dives into Oracle internals to resolve performance issues\u003c/li\u003e\n\u003cli\u003eUsing AI-assisted development tools day to day, including GitHub Copilot, Cursor, and Claude Code\u003c/li\u003e\n\u003cli\u003eTook a leading role in an agile group with seven developers acting within a larger corporate organization to provide software and services to insurance domain customers\u003c/li\u003e\n\u003cli\u003eUpdated Subrosource Classic from Weblogic 10.3 to Weblogic 12 and from Java 1.6 to Java 1.8\u003c/li\u003e\n\u003cli\u003eMaintained, extended, and helped secure the Subrosource Classic Java EE 5 application on Oracle WebLogic Application Server and Java 1.6 backed by an Oracle 11g database\u003c/li\u003e\n\u003cli\u003ePerformed security scans with HP Fortify software and patched found vulnerabilities\u003c/li\u003e\n\u003cli\u003eDeveloped a web application to provide insight to support technicians debugging general data import issues with JDK 8 and Java EE 7 technologies running on Glassfish 4.1 Application Server with a Vaadin GWT-based rich user interface accessing an Oracle 11g database and custom scripts to extract text log information\u003c/li\u003e\n\u003cli\u003eResearched and made recommendations on ways to ease development team growth pains by better incorporating automated unit, integration, and acceptance testing\u003c/li\u003e\n\u003cli\u003eWrote, tested, and debugged a batch process based on preexisting procedural logic to on-board a new customer by cleaning, transforming, and importing 80,000 customer claim records which were split up to over half a million relational table entries; primarily handled through the creation and integration of new awk processing scripts, some modification of a C# account registration program, and PL/SQL customizations in the database to handle customer specific account logic\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u003cstrong\u003eTeaching Assistant, University of South Carolina, Aug 2012 - Dec 2014\u003c/strong\u003e\u003c/p\u003e","title":"Resume"},{"content":"This time I\u0026rsquo;m working on reinforcing some of the Spring and Spring Boot knowledge I\u0026rsquo;ve picked up from other videos, while seeing if I can learn a couple of new tricks while at it. I\u0026rsquo;m watching Spring Framework Essentials through my Safari Books Online membership. It\u0026rsquo;s presented by Ken Kousen, who often hosts the Groovy Podcast. He has a series of three Groovy videos in Safari Books Online that I wouldn\u0026rsquo;t mind going through sometime in the future. The video series runtime is 5 hours, 14 minutes and it has a five star rating from 35 reviewers. Not bad, let\u0026rsquo;s see what it covers.\nSo, these videos are going to focus on the core Spring Framework. So we won\u0026rsquo;t be getting back into Spring Data or even Spring MVC in this video series. It says that it will talk a little about Spring Boot, since that\u0026rsquo;s the general way to get projects started these days. \u0026ldquo;One thing that you\u0026rsquo;ll notice about the Spring Framework, is that they never met a class or package name too long.\u0026rdquo; Tell me about it. Spring makes you appreciate autocomplete. He uses gradle to manage projects, which is fine. Maven or gradle are both fine options.\nHe did a fine demonstration of basic injection in XML, annotations, and Java config setup and quick intro to aspect oriented programming that included an example of the @Around advice. Then he gave a quick introduction to Spring testing. Finally someone that doesn\u0026rsquo;t ignore testing. It turns out you can annotate you test class with @RunWith(SpringJUnit4ClassRunner) to have Spring aware tests, and you can add the @ContextConfiguration(classes = AppConfig.class so that you have a cached ApplicationContext shared between tests in the class and the ability to @Autowire any of your beans. You can even @Autowire an ApplicationContext ctx variable to inject a reference to your ApplicationContext to use in tests to fetch beans you don\u0026rsquo;t autowire. The fact that @ContextConfiguration takes a classes argument lets you have a different configuration class for tests than the running application if necessary. You can also add the @Transactional annotation to your test class to make all your tests occur in a transaction that gets rolled back after test completion. His toy app that he used to demonstrate early principles didn\u0026rsquo;t have any database interaction to show-off transactional tests, but this is the part of the course that he switches from a toy app to something a little more complicated. He also mentions that the Spring pet-clinic demo app makes good use of transactional tests.\nThe new application has a Service and a Repository interface. Instead of using Spring Data, he does all the database operations with an in-memory and a JDBC implementation. Everything is marked @Transactional at the Service level. He had to make a \u0026ldquo;transactionManager\u0026rdquo; Bean and use an @EnableTransactionManagement on his Configuration class, neither of which I recall being required when doing a Spring Boot app with @Transactional. The JDBC is using the Spring JDBC Template and is a lot cleaner than straight JDBC. The JDBC Template does a lot of work for you. For example, the following one-liner works for getting a count: int rowCount = this.jdbcTemplate.queryForObject(\u0026quot;select count(*) from t_actor\u0026quot;), Integer.class); I like the way he looks up what he is talking about in the online API, the same way you likely would when programming with the various API elements. He shows off using \u0026ldquo;test\u0026rdquo; and \u0026ldquo;prod\u0026rdquo; profiles to differentiate between an H2 in-memory database and an Apache data connection pool backed by MySQL. Each repository method with the JDBC Template ends up being two to four lines long, depending upon what he\u0026rsquo;s try to do. Pretty simple, but not as simple as not defining implementation methods with Spring Data JPA.\nYay! More testing. This time we\u0026rsquo;re testing repositories. Just set the annotations on the test class and annotate the test profile, then autowire the repository and you\u0026rsquo;re good to go. Each test is transactional, so they roll back changes at the end of each test. He uses Hamcrest matchers, so he can make assertions like assertThat(accounts.size(), is(3));, which flows a bit better than standard assertEquals. He points out that since he is using gradle he can show the really cool gradle test report. The tests he ran were all quick, even with firing up and setting up the in-memory database. First one took half a second, but the all six of them took less than a second total. He succeeded in exercising all his repository methods and making sure they worked as expected.\nI was wrong that we weren\u0026rsquo;t going into Spring Data. He reimplements his repository using Spring Data JPA for the next project. Spring Data JPA repositories are just interfaces. You get queries generated for free based upon how you name the methods in the interfaces. You can also use the @Query annotation above a method in the interface to give it a custom query if the autogenerated language can\u0026rsquo;t handle what you\u0026rsquo;re after. He defined the JpaVendorAdapter and LocalContainerEntityManagerFactoryBean manually in the Java Spring configuration file, which normally weren\u0026rsquo;t require with Spring Boot. It\u0026rsquo;s interesting to see how this is all done by hand, and it isn\u0026rsquo;t that much in total lines of configuration. He didn\u0026rsquo;t use the feature of Spring Data JPA to allow repository autogeneration of methods and just defining an interface. Instead he defined a JpaAccountRepository that implemented its various methods directly through an EntityManager. He does use @PersistenceContext annotation to inject his EntityManager. Most of the methods now are one or two lines long. He did have to add JPA annotations to his entity class, but most of them defaulted through good name selection for class and fields. Only @Entity on the class and @Id on the primary key field actually needed to be added to the domain object. He shows that you can use the same service with the JPA repository as was used with the JDBC Template repository, since he designed the methods to take the same arguments. He uses the same tests also, which makes sense as the interface and expected outputs are the same.\nI forgot to mention it earlier, but this presenter uses IntelliJ for everything. Always nice to see! Oh, he was just using JPA in the last project. The next project is where he\u0026rsquo;s adding in Spring Data to get the free implementations of DAO methods. So, it turns out he uses Spring Data for the last 12 minute segment of the presentation, and then switches to showing the same app with Spring Boot for the last 15 minutes of the presentation. The app keeps getting simpler each time he introduces more Spring features. He actually extended JpaRepository for his repository, where I am more accustomed to seeing CrudRepository or PagingAndSortingRepository extended. JpaRepository extends both. He had to change the method names in his service and tests to match the ones freely given by having an interface extend on of the Spring Data interfaces, but got to delete a lot of code that was the repository class implementation and previous repository interface which was more complicated. Interesting to see that his tests run quicker now too, taking a little under 0.4 seconds. He\u0026rsquo;s still using an H2 in-memory database for testing and setting it up with the same sql scripts. He points out that all his earlier work really was unnecessary. The final project is to show how much of his configuration he can get rid of also by using Spring Boot. It\u0026rsquo;s still interesting to know how to do it by hand, since everything we\u0026rsquo;ve seen is still happening under the hood in Spring Boot.\nSo, at the end, he claims that a Spring Boot focused course is coming. I don\u0026rsquo;t see it as available yet. He had mentioned earlier this video course would be the start of a series. I really enjoyed Ken\u0026rsquo;s presentation, and would definitely watch more in this series by him. It was a neat change seeing Spring used for non-web apps. I hope in the future videos he shows off Spring MVC though, because Spring makes some nice web apps too. He recommends the book Spring Boot in Action at the end, but I found that book fairly worthless. The source code for it didn\u0026rsquo;t match up with what was described in the text. Maybe now that I actually have a grasp on some of this stuff, it would be useful and I could figure out why the sample source code and the text don\u0026rsquo;t match up. Anyway, despite his poor book recommendation at the end, I really enjoyed this video series. It\u0026rsquo;s worth a watch if you\u0026rsquo;re looking for something to view with your Safari Books Online membership.\n","permalink":"https://llcawthorne.github.io/posts/oreilly-spring-framework-essentials/","summary":"\u003cp\u003eThis time I\u0026rsquo;m working on reinforcing some of the Spring and Spring Boot\nknowledge I\u0026rsquo;ve picked up from other videos, while seeing if I can learn\na couple of new tricks while at it.  I\u0026rsquo;m watching\n\u003ca href=\"https://www.safaribooksonline.com/library/view/spring-framework-essentials/9781491942680/\"\u003eSpring Framework Essentials\u003c/a\u003e through my Safari Books Online membership.\nIt\u0026rsquo;s presented by Ken Kousen, who often hosts the Groovy Podcast.  He has a\nseries of three Groovy videos in Safari Books Online that I wouldn\u0026rsquo;t mind\ngoing through sometime in the future.  The video series runtime is 5 hours,\n14 minutes and it has a five star rating from 35 reviewers.  Not bad, let\u0026rsquo;s\nsee what it covers.\u003c/p\u003e","title":"O'Reilly Spring Framework Essentials"},{"content":"I figured since I am a professional Java programmer that I might as well spent some time getting familiar with some Java technologies that I don\u0026rsquo;t get to use at work. With this in mind, I purchased Udemy\u0026rsquo;s \u0026ldquo;Spring Boot Intro\u0026rdquo; course for $10 when they had a sale.\nThis course moved a lot quicker than the last course I took from Udemy. It covered basic dependency injection in Spring in probably an hour or less, where the last class focused on dependency injection fundamentals for the entire time. I appreciated the faster pace, as there\u0026rsquo;s a lot of stuff to cover with Spring Boot. It handles autoconfiguring all the main projects that make up Spring\u0026hellip; Spring MVC, Spring Rest, Spring Data, Spring Security, etc.\nThis author made it really hard to code along with him. He did things like restart a project with unknown initializr settings in between videos. He also copied and pasted a lot of code, so you couldn\u0026rsquo;t really type along with him. As long as you don\u0026rsquo;t mind pausing and typing something in, it wasn\u0026rsquo;t unworkable, but it got a little old. I ended up checking out his repo of code samples and following along with them. He does have exercises at the end of each section, which are a good chance to code some stuff up on your own. He doesn\u0026rsquo;t mention specifically when he changes projects from the repo either, so it\u0026rsquo;s a little hit and miss making sure you\u0026rsquo;re looking at the right code that he\u0026rsquo;s working on.\nOne nice thing is this guy used IntelliJ instead of Eclipse. He admitted that you need the paid for version to work with Spring, but just told people to sign up for the 30 day trial. Fortunately, I still have my student license, so I had all the features to play along. It might be annoying to people that have already done the IntelliJ trial, since it makes it harder to follow along. Of course, he\u0026rsquo;s pretty hard to follow along with as it is, so using STS or Eclipse wouldn\u0026rsquo;t be that much worse. Anyway, I was excited at first that he used IntelliJ, but then he switched to Eclipse STS halfway through the videos. I kept following along in IntelliJ.\nI liked the Spring Boot way of doing apps. It felt like convention over configuration brought to the Java world, the way it autoconfigures so much stuff based upon what it finds loaded in your class path. I really liked Spring Data, which allows you to pair up standard JPA entities with Repository interfaces that automatically generate the implementation with queries based upon the names of the method defined in your interface.\nFor example, if you make a method called findByLastName(String lastName) in your interface, you get the query you would expect for free. The instructor didn\u0026rsquo;t go into this, but it also works with QueryDSL predicates to fill in the queries, which is pretty cool since I use QueryDSL at work. He also showed how to do everything by hand with JDBC, but I liked the JPA approach better. He also showed that you can drop in mongo DB and swap out Entity annotation for Document pretty easily in an app with very little changes. It was a weird choice doing JPA backed by a Microsoft SQL Server database, and since I didn\u0026rsquo;t feel like signing up for an Azure trial, I just kept using H2.\nI really liked the Dev Tools with live reload. He showed that you have to change a few settings in IntelliJ. In the registry you check compiler.automake.allow.when.app.running and in the Preferences-\u0026gt;Build, Execution, Deployment-\u0026gt;Compiler you check the Build project automatically. Then you install a browser extension from http://livereload.com/extensions/ and it will reload automatically when anything changes in your code. It isn\u0026rsquo;t that much work really to save hitting refresh all the time. He doesn\u0026rsquo;t use that in most of his projects, but I kept it turned on in all the ones I did by hand.\nI like Spring Security, but found the course\u0026rsquo;s presentation of it to be a little light. It does explain how you get free security headers, some XSS prevention, and CSRF tokens just by including Spring Security, and in his example he works up to a custom login form backed by a database (this time MySQL) of users, but he stores the passwords in plain text, so his app wouldn\u0026rsquo;t be that useful a model to look at if I ever wanted to do this for real.\nThe REST presentation was more thorough than it needed to be. It seems like every talk about REST has to go over what the different status codes mean first thing. Why not just link out to HTTP Status Cats website. I want to know how he gets his JSON formatted so pretty in the browser. I\u0026rsquo;m sure it\u0026rsquo;s a plugin, but it isn\u0026rsquo;t one I already have. Oh, he finally mentioned what it is during the REST videos. \u0026ldquo;JSON Viewer\u0026rdquo; extension for Chrome. Nice. Anyway, I thought REST frameworks were easy to setup when we were doing them the hard way (RestController annotations and services), but it turns out you can get rid of your controllers and services and directly expose your repo through a default build REST API if you don\u0026rsquo;t need a lot of custom logic. There\u0026rsquo;s even a built in HAL Browser for discovery and interaction with the API, if you choose to include it. HAL Browser dependency comes from org.springframework.data and not org.springframework.boot. That tripped me up for a minute in the exercises.\nFor the final series of lectures, he expects you to work along with him starting from an initial setup. We\u0026rsquo;ll see if this works any better\u0026hellip; Nope! He still does a lot of stuff off-screen between videos. Anyway, the final project is a blogging website. It uses bootstrap to look good, thymeleaf for the templates, spring data jpa for the database interaction, and spring security to enforce editing only by those with admin level privileges. I still need to read the docs on thymeleaf templates to feel like I know much about them, since he always provides the templates and doesn\u0026rsquo;t explain much. They look pretty simple. Extra attributes to HTML tags causes you to override content that is present in the source and do other modifications. Like \u0026lt;span sec:authentication=\u0026quot;name\u0026quot;\u0026gt;Guest\u0026lt;/span\u0026gt; will default to Guest, but will override that value with the name of whoever is currently authenticated. Judging from the upcoming titles, he\u0026rsquo;s going to throw in some validation, which is a topic he hasn\u0026rsquo;t covered in the previous sections.\nI couldn\u0026rsquo;t get his instructions for customizing validation messages to work at all. I got validation working pretty good with the default error messages at least. He claims you just need to put your custom messages in a messages.properties file, but I did that and they didn\u0026rsquo;t get picked up. I assume I have to do something to get it to look in message.properties. Everyone on stack overflow with a related problem seems to be running WARs, so those questions don\u0026rsquo;t seem to apply to my setup. I\u0026rsquo;ll dig in the documentation later and see what\u0026rsquo;s going on.\n","permalink":"https://llcawthorne.github.io/posts/udemy-spring-boot-intro/","summary":"\u003cp\u003eI figured since I am a professional Java programmer that I might as well\nspent some time getting familiar with some Java technologies that I don\u0026rsquo;t\nget to use at work.  With this in mind, I purchased Udemy\u0026rsquo;s \u0026ldquo;Spring Boot\nIntro\u0026rdquo; course for $10 when they had a sale.\u003c/p\u003e\n\u003cp\u003eThis course moved a lot quicker than the last course I took from Udemy.\nIt covered basic dependency injection in Spring in probably an hour or less,\nwhere the last class focused on dependency injection fundamentals for the\nentire time.  I appreciated the faster pace, as there\u0026rsquo;s a lot of stuff\nto cover with Spring Boot.  It handles autoconfiguring all the main projects\nthat make up Spring\u0026hellip;  Spring MVC, Spring Rest, Spring Data, Spring Security,\netc.\u003c/p\u003e","title":"Udemy - Spring Boot Intro"},{"content":"Chapters 3 through 5 focus on a little bit of theory before we get to building the tutorial application.\nChapter 3 - The Architecture of Rails Applications Chapter 3 jumps into explaining MVC. It\u0026rsquo;s a pretty simple concept. MVC stands for Model, View, and Controller. The model is responsible for the state of the application, often the data you store in a database. It\u0026rsquo;s also more than data; it enforces the business rules that apply to your data. The model is both a gatekeeper and a data store. The view is responsible for generating some type of user interface. The view\u0026rsquo;s job is done once the data is displayed. Multiple possible views of the same data are a common case. The controller orchestrates the application. Controllers receive events from the outside world, interact with the model, and display the appropriate view. The book provides a simple diagram:\nThere\u0026rsquo;s a fine introductory article on Wikipedia if the concept is new to you. One of the main advantages is that each concept or action can be expressed in a single, well-known place. Like many modern web frameworks, Rails is designed with MVC in mind. Rails first sends your request to a router, which then maps it to a method of a controller (called an action), and then the action looks at data in the request to decide how to interact with the model and ultimately it prepares information for the view, which renders the result.\nThe request contains a path (/line_items?product_id=2) and a method (GET, POST, PUT, PATCH, DELETE). By default rails takes the first part of the path, line_items, as the controller name and the product_id as the ID of a product, which it passes to the create() method of a LineItemsController if we assume this is a POST request. Different types of request are routed to different methods of the controller.\nRails handles a lot of the low level details of an MVC app, so you can focus on the core application logic. One example of this is in its ORM (object- relational mapping) libraries which map database tables to classes. If you have a class called Order, you know it maps to a database table called orders. The Order object has methods to set all the data fields in the orders table. The Rails classes also wrap our database tables with class-level methods that perform table-level operations. For example, you might want to look up an Order by ID. Code to do so might look like:\norder = Order.find(1) puts \u0026#34;Customer #{order.customer_id}, amount=$#{order.amount}\u0026#34; Or you could have a class level method that searches by a where clause and returns a collection of objects:\nOrder.where(name: \u0026#39;dave\u0026#39;).each do |order| puts order.amount end In addition to accessing field values, you can set values via the object and then save it to the database:\nOrder.where(name: \u0026#39;dave\u0026#39;).each do |order| order.pay_type = \u0026#34;Purchase order\u0026#34; order.save end So an ORM layer maps tables to classes, rows to objects, and columns to attributes of those objects. Class methods are used to perform table-level operations, and instance methods perform operations on individual rows. Active Record is the ORM layer provided by Rails. It relies on convention over configuration and starts with sensible defaults to minimize manual configuration by developers.\nAction Pack is the part of Rails that supports the views and controllers. At its simplest, the view is a chunk of HTML code that displays some static content, but you normally want dynamic content generated by templates. Rails offers templates in three flavors:\nEmbedded Ruby (ERB), which is the most common, embeds snippets of Ruby within an HTML document ERB used to construct JavaScript fragments on the server to execute in the browser to form the view an XML builder to construct XML documents using Ruby code. The controller acts as the logical center of an application, coordinating interaction among the user, the views, and the model. It\u0026rsquo;s responsible for routing URLs to actions, it manages caching, it manages helper modules, and it also manages sessions. The way Rails handles most of the interaction behind-the scenes makes controller code easy to develop and maintain.\nChapter 4 - Introduction to Ruby All of Chapter 4 is focused on a quick review of Ruby. I\u0026rsquo;d recommend a refresher at learnxiyminutes if your Ruby is a little rusty or checkout the zenspider quickref.\nThe one thing those don\u0026rsquo;t cover that is relevant is YAML (YAML Ain\u0026rsquo;t Markup Language). YAML is used to define configuration of things in Rails.\ndevelopment: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 Indentation is import in YAML, and the above snippet defines four key-value pairs.\nChapter 5 - The Depot Application Chapter 5 focuses on the design of the application that is being built in the upcoming tutorial chapters. We\u0026rsquo;re going to build a basic bookstore, based upon the Pragmatic Bookshelf website. It approaches the problem from a mindset of incremental development and starts out from basic back-of-the-napkin style sketches of functionality. It points out that Ruby on Rails shines for this style of development, because it doesn\u0026rsquo;t heavily penalize changing your mind about something mid-development. It also points out that we\u0026rsquo;ll be building tests as we go. Yay!\nTo start with, we want an outline of how the application will work at a high level. We identify two roles: the buyer and the seller. The buyer browses for products, selects some to purchase, and creates an order. The seller uses the application to maintain a list of products to sell, to determine order awaiting shipment, and to mark orders shipped. Here is a first sketch of the buyer flow:\nIt\u0026rsquo;s a pretty traditional and simple flow. There\u0026rsquo;s also the seller flow:\nIn both cases, we\u0026rsquo;re not overspecifying things we are unsure about, like details of the shipping method or payment methods. We also need to think about what the data is going to look like:\nThere\u0026rsquo;s obviously some questions left, like what goes in cart, but this is enough to get started, and we can figure out the other details once we\u0026rsquo;re in a better position of knowledge later after we\u0026rsquo;ve started. With these diagrams in hand to get us started and an imaginary customer to show our progress, we\u0026rsquo;re ready to get started on the book\u0026rsquo;s tutorial application.\n","permalink":"https://llcawthorne.github.io/posts/awdwr51-03-05-theory/","summary":"\u003cp\u003eChapters 3 through 5 focus on a little bit of theory before we get to\nbuilding the tutorial application.\u003c/p\u003e\n\u003ch3 id=\"chapter-3---the-architecture-of-rails-applications\"\u003eChapter 3 - The Architecture of Rails Applications\u003c/h3\u003e\n\u003cp\u003eChapter 3 jumps into explaining MVC.\nIt\u0026rsquo;s a pretty simple concept.  MVC stands for Model, View, and Controller.\nThe \u003cem\u003emodel\u003c/em\u003e is responsible for the state of the application, often the data\nyou store in a database.  It\u0026rsquo;s also more than data; it enforces the business\nrules that apply to your data.  The model is both a gatekeeper and a data\nstore.  The \u003cem\u003eview\u003c/em\u003e is responsible for generating some type of user\ninterface.  The view\u0026rsquo;s job is done once the data is displayed.\nMultiple possible views of the same data are a common case.  The\n\u003cem\u003econtroller\u003c/em\u003e orchestrates the application.  Controllers receive events from\nthe outside world, interact with the model, and display the appropriate\nview.  The book provides a simple diagram:\u003c/p\u003e","title":"AWDWR 5.1 - 03-05 - Theory"},{"content":"I\u0026rsquo;m still going back to finish my Agile Web Development with Rails 5.1 series. I finished reading the main project in the book a while back now. I just haven\u0026rsquo;t made time with the computer to create the demo project, and I want to have it in a repo to upload and talk about the code a little. I didn\u0026rsquo;t read the reference chapters, since they were still incomplete. I think I\u0026rsquo;ll read Agile Web Development with Rails 5 on Safari Books in its entirety, and that will give me a good perspective to see what changes with the project in the Rails 5.1 version of the book. The only thing that I noticed so far that was 5.1 specific is the ActionCable Websocket stuff they throw in, so that if a price changes on the backend it pushes the update to customers. Pretty neat to see Websockets used for something so small, instead of big examples of chat servers and what not like you commonly see.\nI\u0026rsquo;ve read several things since finishing Agile Web Development with Rails 5.1. One I might dedicate multiple blogposts to: \u0026ldquo;Practical Object-Oriented Design in Ruby\u0026rdquo;. It was really good, and I highlighted large sections of the book that are worth talking about. Some of the stuff I had seen before in places like \u0026ldquo;Clean Code\u0026rdquo; and in my Software Engineering class, but it had a lot of good direct advice on designing things properly from an object-oriented perspective. The examples were in Ruby, but it didn\u0026rsquo;t linger much on language specifics.\nSpeaking of Ruby, I\u0026rsquo;ve been refreshing my Ruby skills after spending time with the Agile Web Development in Rails 5.1 book and before delving into some other Rails books (primarily Hartl\u0026rsquo;s \u0026ldquo;Ruby on Rails Tutorial: Learn Web Development with Rails\u0026rdquo; which I read in an old version and the new rough cut of \u0026ldquo;The Rails 5 Way\u0026rdquo; ). I re-read the 10th anniversary edition of the Pickaxe , since I had a hardcopy of it on the shelf. That link takes you to the fourth edition, rather than the 10th anniversary edition. It was focused on Ruby 1.9. Then I re-read Why\u0026rsquo;s (Poignant) Guide to Ruby. It\u0026rsquo;s a little dated, but still relevant. And finally for something a little more up to date, I started reading the latest edition of \u0026ldquo;The Ruby Way\u0026rdquo;.\nI like the Pickaxe best for a fast moving introduction to the language that is worth a couple of reads, paired with detailed chapters on various topics relating to Ruby in its setting. Why\u0026rsquo;s guide is classic, and gets into some neat metaprogramming topics, although it has a lot of charmingly weird stuff in it and not so much code. \u0026ldquo;The Ruby Way\u0026rdquo; is starting to feel like a bit of a slog to make it through reading from cover to cover. It feels like it would be a handy desk reference, but from a reader\u0026rsquo;s perspective, do I really want to read how to build a GUI using five different libraries back-to-back. It was good for establishing a comparison of several different ways to do GUI stuff at least. I think I\u0026rsquo;ll try out Shoes. Anyway, so now I feel like I know Ruby again, and I\u0026rsquo;ve been using it for Code Wars to get lots of practice with toy problems.\nOh, I\u0026rsquo;ve also signed up for a MOOC that teaches Software Engineering concepts with Rails. Agile Development Using Ruby on Rails - Basics. I signed up for the matching advanced course too. So, if you want more Rails material, I have some coming up to write about at least. I\u0026rsquo;ll write my opinion of the MOOC after I get a chance to watch through the videos and try the exercises. Between the MOOC and the other Rails books I have on my reading list, I should get a couple of nice blogposts that have some code blocks in them. Now that I have syntax highlighting working, might as well use it. There\u0026rsquo;s also an Infinite Skills video that I have access to through Safari Books Online that I wouldn\u0026rsquo;t mind trying out. Hands-on with React and Ruby on Rails. I don\u0026rsquo;t have much React experience past doing the Tic-Tac Toe tutorial, but I can probably manage it as the video doesn\u0026rsquo;t claim you need React experience. Anyway, I\u0026rsquo;ll get back to reading and watching and coding stuff now, and come back with some blogposts that include code soon.\n","permalink":"https://llcawthorne.github.io/posts/misc-reading/","summary":"\u003cp\u003eI\u0026rsquo;m still going back to finish my Agile Web Development with Rails 5.1\nseries.  I finished reading the main project in the book a while back\nnow. I just haven\u0026rsquo;t made time with the computer to create the demo\nproject, and I want to have it in a repo to upload and talk about\nthe code a little.  I didn\u0026rsquo;t read the reference chapters, since\nthey were still incomplete.  I think I\u0026rsquo;ll read Agile Web Development\nwith Rails 5 on Safari Books in its entirety, and that will give me a\ngood perspective to see what changes with the project in the Rails 5.1\nversion of the book.  The only thing that I noticed so far that was 5.1\nspecific is the ActionCable Websocket stuff they throw in, so that if a price\nchanges on the backend it pushes the update to customers.  Pretty neat\nto see Websockets used for something so small, instead of big examples\nof chat servers and what not like you commonly see.\u003c/p\u003e","title":"Misc Reading"},{"content":"So, I promised I\u0026rsquo;d mention what goodies I find in the second half of Practical Vim, 2nd Edition. Here they are.\nChapter 10, Copy and Paste First, the repetition of the insert mode \u0026lt;C-r\u0026gt;{register} command later in the book was something I found useful. I think that\u0026rsquo;s a pretty handy way to paste the contents of a register. I never knew that \u0026quot;+ let\u0026rsquo;s you access the system clipboard either. If you put the two together, you can quickly paste from the system clipboard without leaving insert mode with \u0026lt;C-r\u0026gt;+. The fact that yank stores a copy of what it copies in the 0 register is pretty handy too. Nice to have an alternate way to access the last yank if I\u0026rsquo;ve clobbered it.\nChapter 11, Macros Most of the macros chapter was fairly new to me. I knew the basics of how to record and playback macros, and have used them before when in native vim and not using an emulator. But I\u0026rsquo;ve never given macros intense thought or tried to be terribly clever with them. He goes into the idea of crafting resilient reusable macros in some depth in the tips focused on them and covers a handful of macro best practices. As he puts it, \u0026ldquo;The golden rule is this: when recording a macro, ensure that every command is repeatable.\u0026rdquo;\nThe author sums up macro advice with the phrase \u0026ldquo;Normalize, Strike, Abort\u0026rdquo; The first question to ask when crafting a macro is, \u0026ldquo;where am I, where have I come from, and where am I going.\u0026rdquo; Make sure the cursor is positioned so the next command does as expected where expected. You shouldn\u0026rsquo;t use the mouse when recording a macro, so make sure to take advantage of the full range of available motion commands to maneuver to the right location to strike. If a motion fails while a macro is executing, Vim will abort the rest of the macro. This is a feature! You don\u0026rsquo;t want to execute your command when you aren\u0026rsquo;t in the right location. Motions can act as a simple test as to whether or not the macro should be executed. Remember that search is a motion too. You can do a lot with a macro that uses the n key to go to the next search item and perform an action. Once no matches remain, n will fail and the macro will stop.\nTip 67 points out how a simple two key macro can be useful to move and perform the dot command multiple times. You can\u0026rsquo;t repeat with dot, and if you could the number would either repeat the move multiple times or repeat the dot multiple times in the same place, so a simple macro of a movement command and dot is a clever trick tie a move and repeat together and replay it multiple times. Again, you can count on the motion failing at the end if you choose the right motion, so you don\u0026rsquo;t have to worry about the exact count. The example is as follows:\n{start} x = \u0026ldquo;(\u0026quot;+a+\u0026rdquo;,\u0026quot;+b+\u0026quot;,\u0026quot;+c+\u0026quot;,\u0026quot;+d+\u0026quot;,\u0026quot;+e+\u0026quot;)\u0026quot;;\nAnd we want to change it to:\n{goal} x = \u0026ldquo;(\u0026rdquo; + a + \u0026ldquo;,\u0026rdquo; + b + \u0026ldquo;,\u0026rdquo; + c + \u0026ldquo;,\u0026rdquo; + d + \u0026ldquo;,\u0026rdquo; + e + \u0026ldquo;)\u0026rdquo;;\nAnd it can be achieved with the following keystrokes:\nf+ s + \u0026lt;Esc\u0026gt; qq;.q 22@q That\u0026rsquo;s much simpler than adding the spaces around the + marks by hand. Since the f+ movement will fail after we are out of +\u0026rsquo;s, it is safe to run the macro 22 times. The author admits to being lazy like this often. 22 is his go to repeat number, since 2 is the same key as @ to run the macro. That\u0026rsquo;s a great example of making use of \u0026ldquo;Abort\u0026rdquo;.\nAppending keystrokes to macros works just like appending yanks to registers. qA will append commands on the end of the macro in register a. That\u0026rsquo;s a small but handy tip for getting more from macros. The next tip covers how to apply a macro to a series of files, either with :argdo normal @a or by manually advancing with :next to act across the argument list. The example he uses is a pretty handy one of wrapping several classes in a module declaration and adding proper indentation. The next tip seems handy, but I doubt it\u0026rsquo;s general enough use for me to remember it. It covers how to prepend an incrementing line count to multiple lines. The final tip of the chapter covers the fact that you can put a macro from a register, then edit the macro text, then yank the macro back to the register. An interesting option for editing macros! One note is to be careful to use a character-wise yank like \u0026quot;ay$\u0026quot;, or else you might get an extra \u0026lt;CR\u0026gt; at the end of your macro.\nChapter 12 - Matching Patterns and Literals First off, I learned the handy tidbit that using \\c in a search pattern causes it to ignore case, and \\C to be case sensitive, regardless of ignorecase settings. You can put them anywhere in the pattern, including just tacking them on the end. I like the default smartcase where if you include an uppercase letter it is case sensitive, otherwise not.\nThe \\v switch anywhere in a regex makes it \u0026ldquo;very magic\u0026rdquo;, or more like what you might be used to from Perl, Python, or Ruby. It makes all characters assume a special meaning except for \u0026ldquo;_\u0026rdquo;, letters, and numbers, so you don\u0026rsquo;t need to escape all your braces, brackets, and parentheses. It makes the difference between #\\([0-9a-fA-F]\\{6}\\|[0-9a-fA-F]\\{3}\\) and \\v#([0-9a-fA-F]{6}|[0-9a-fA-F]{3}) to match CSS color codes, a regex that can be made slightly even better using the \\x hex class as \\v#(\\x{6}|\\x{3}). The \\V or verynomagic option makes a search only search by the literal meaning of symbols provided, even ., *, and ?. Only the \\ character has special meaning in a verynomagic search. So ultimately, both the \\v and \\V search options are terribly useful and worth remembering. A good example of the \\V option is searching for \u0026ldquo;a.k.a.\u0026rdquo; with /\\Va.k.a. instead of /a\\.k\\.a\\. I think the argument has won me over well enough to use \\v most of the time and \\V on special occasions.\nAnother handy fact for regular expressions is that in verymagic search mode, the \u0026lt; and \u0026gt; keys match word boundaries. So a search for \\v\u0026lt;the\u0026gt; will find all the \u0026ldquo;the\u0026rdquo; occurrences without any \u0026ldquo;their\u0026rdquo; or \u0026ldquo;these\u0026rdquo; being matched. It goes on to cover some ways to handle search field terminators in the final tip of the chapter.\nChapter 13 - Searching, 14 - Substitution, 15 - Global Commands I didn\u0026rsquo;t find anything in these two chapters particularly worthwhile, except the fact that you can leave the search part of a substitute command blank to use whatever the last successful search was as the pattern. That decouples finding the right search pattern from the overall substitute command, and you normally want to search first anyway to make sure you got your pattern right before making changes. The search and replace across a project tip was possibly useful. Everything about the global command was new to me and worth playing with.\nChapter 16 - Index and Navigate Source Code with ctags This whole chapter is about ctags and was all new to me. It looks like an excellent way to get the ability to jump to definitions in vim. Apparently I\u0026rsquo;ve been living under a rock, since I was unaware of this feature. This looks like a key step into making Vim into a development environment instead of just an editor.\nChapter 17 - Compile Code and Navigate Errors with the Quickfix List The quickfix and location lists seem handy, assuming you map navigating them to something more convenient than typing :cnext and :cprev. I\u0026rsquo;ll have to checkout the unimpaired plugin he mentions that makes the quicklist navigable by [q and ]q. It has a number of other handy mappings, so it\u0026rsquo;s worth checking out instead of just putting the one set of mappings in my vimrc. I think I\u0026rsquo;ll use the Tip 108 that has you make :make run JSLint and populate the quickfix list with any linting errors. I didn\u0026rsquo;t fully understand how to do it from the tip, but this github project looks useful: vim-nodelist.\nChapter 18 - Search Project-Wide with grep, vimgrep, and Others There\u0026rsquo;s so many neat random things in this book. Today I learned that there\u0026rsquo;s a version of grep optimized for programmers called ack. Ack. To relate it back to vim, the book explains how to make the vim :grep command use ack instead, but then tells you not to, since there is an ack plugin for vim ack.vim that will use it with the :ack command.\nChapter 19 - Dial X for Autocompletion There\u0026rsquo;s plugins for better autocompletion than what\u0026rsquo;s built in. It looks like you can complete based off ctags with \u0026lt;C-x\u0026gt;\u0026lt;C-]\u0026gt; or use \u0026lt;C-x\u0026gt;\u0026lt;C-i\u0026gt; to complete based off your imports in various languages. Generic autocompletion is based off \u0026lt;C-n\u0026gt; and is probably best of the built-ins. You use \u0026lt;C-n\u0026gt; and \u0026lt;C-p to choose next or previous.\nChapter 20 - Find and Fix Typos with Vim\u0026rsquo;s Spell Checker This one starts out simple, with how to use the built in spell checker. First think I learned is that z= on a misspelled word will bring up suggestions and [s and ]s let you jump between misspelled words. I was able to try those out successfully while writing this blog post. zg adds a word to the spell file, which worked great to add \u0026ldquo;blog\u0026rdquo;. Apparently, you can fix misspelled words without leaving Insert mode with \u0026lt;C-x\u0026gt;s to enable autocomplete misspelled mode. It will jump you back to the last misspelled word and offer suggestions from the dictionary. Pretty handy!\nSummary Overall, I think I picked up more tips than I can reasonably integrate into my workflow at once from my first reading of Practical Vim, Second Edition. That\u0026rsquo;s why I put a lot of them here on my blog, to remind me to try them out. I believe there\u0026rsquo;s still enough that I didn\u0026rsquo;t mention to make the book worth another read, or at least a re-read several spots in it. I highly recommend it if you are already comfortable using Vim and want to pickup tricks to take your Vim workflow to the next level.\n","permalink":"https://llcawthorne.github.io/posts/practical-vim-2/","summary":"\u003cp\u003eSo, I promised I\u0026rsquo;d mention what goodies I find in the second half of\nPractical Vim, 2nd Edition.  Here they are.\u003c/p\u003e\n\u003ch2 id=\"chapter-10-copy-and-paste\"\u003eChapter 10, Copy and Paste\u003c/h2\u003e\n\u003cp\u003eFirst, the repetition of the insert mode \u003ccode\u003e\u0026lt;C-r\u0026gt;{register}\u003c/code\u003e command later\nin the book was something I found useful.  I think that\u0026rsquo;s a pretty handy\nway to paste the contents of a register.\nI never knew that \u003ccode\u003e\u0026quot;+\u003c/code\u003e let\u0026rsquo;s you access the system clipboard\neither.  If you put the two together, you can quickly paste from the system\nclipboard without leaving insert mode with \u003ccode\u003e\u0026lt;C-r\u0026gt;+\u003c/code\u003e.  The fact that yank\nstores a copy of what it copies in the \u003ccode\u003e0\u003c/code\u003e register is pretty handy too.\nNice to have an alternate way to access the last yank if I\u0026rsquo;ve clobbered it.\u003c/p\u003e","title":"Practical Vim, 2nd Edition - Second Half"},{"content":"Practical Vim is an excellent resource for tips and trick for using vim. It focuses on core vim features, and doesn\u0026rsquo;t spend any room talking about plugins. Aside from a few hints to how .vimrc settings might affect certain commands, it doesn\u0026rsquo;t spend any time telling you what to put in your .vimrc. It does have an appendix about vimrc settings, in case you need some new ones. The book is laid out as a series of 123 mostly standalone tips, although they do follow a procession of least to most difficult within their respective section. The tips are split between 20 sections. The book doesn\u0026rsquo;t attempt to go into Vimscript. Overall, I found it a useful collection of mostly non-obvious tips for using vim, and I feel like it has made me more capable in using my editor of choice.\nThe author recommends skipping around rather than reading the book from beginning to end, however, I still found the book quite readable. The tips vary in difficulty from very basic (Ex: Tip 47 is \u0026ldquo;Keep Your Fingers on the Home Row\u0026rdquo; and covers h, j, k, and l) to fairly advanced (Ex: Edit the Contents of a Macro). I really enjoy the way the author doesn\u0026rsquo;t repeat any content readily available in the manual. In the electronic copy, he links any manual references to a website with the vim manual. For people reading along, he provides the proper keyword to use with :h in order to lookup the topic via vim help. This allows him to not spend a lot of time on prerequisite info and get directly to useful tips.\nSome tidbits that I\u0026rsquo;ve found useful so far are the keystrokes that he mentions being available in Insert mode. I never paid attention to the fact that you can use \u0026lt;C-w\u0026gt; to delete back one word without leaving insert mode, \u0026lt;C-r\u0026gt;{register} to quickly paste the contents of a register, and \u0026lt;C-v\u0026gt;u{1234} to insert unicode character #1234, all without leaving insert mode. In both the previous examples, the selection in curly brackets is replaced with just a register or just a four digit number, the curly brackets are not typed literally. I generally like hitting my keys one at a time while in vim, but those are a couple of useful chords to use in insert mode. I\u0026rsquo;m not sure I\u0026rsquo;ll use the unicode one often enough to remember it, but the other two are pretty easy to remember and of general use. There is no tip like \u0026ldquo;Here are some keystrokes for Insert mode.\u0026rdquo; but the author instead worked providing these keystrokes into the explanation of how to do something. The \u0026lt;C-r\u0026gt;{register} keystroke was provided in the \u0026ldquo;Paste from a Register Without Leaving Insert Mode\u0026rdquo; tip which focused on it and \u0026lt;C-v\u0026gt;u{1234} was from the \u0026ldquo;Insert Unusual Characters by Character Code\u0026rdquo; tip, but the \u0026lt;C-w\u0026gt; keystroke was provided in the more general \u0026ldquo;Make Corrections Instantly from Insert Mode\u0026rdquo; tip.\nI learned a lot that I didn\u0026rsquo;t know before in the section on Command-Line Mode. As the author puts it, \u0026ldquo;Ex commands strike far and wide.\u0026rdquo; I was unaware of how the range worked with ex commands and of the variety of ex commands available. There are commands to delete, yank, put, copy, move, join, normal (execute Normal mode commands on a specified or range of lines), substitute, and global (execute and ex command where a pattern matches). I\u0026rsquo;ve used substitute a decent bit, but never remember knowing about the others and how you can make them all work flexibly with a range without having to move the cursor there first. It\u0026rsquo;s especially convenient that you can use V to switch into visual line mode and select some lines, then it will prepopulate the range of lines into your : for executing an ex command. You can also use % to target the whole file with a command, which is how I\u0026rsquo;m accustomed to working with substitute. As an example, :%normal A; will append a semicolon to every line in a file or %normal i// will comment out every line in a file given a language where // starts comments. You can even write a script of ex commands and load it into vim with :source {filename}.\nI also learned that in you can use :edit %:h to load the working directory of the currently active buffer as a parameter to edit, and then tab complete it to the name of another file in the same directory. The book recommends you alias %% to %:h since this is so handy. That remap made it into my vimrc. You can even open a file in a nonexistant directory and then use :!mkdir -p %:h to create the directory so you can save the file.\nThe only obvious problem I had with some of the content is that some of it (like the ex commands) is too vim specific to work with vim emulators. Anymore, I spend a lot more time using IdeaVIM in IntelliJ than I clock with real vim, but that\u0026rsquo;s largely a personal problem. The author doesn\u0026rsquo;t avoid forward references, which is only a problem if you\u0026rsquo;re trying to read the book through rather than skip around as recommended. Also, the author sometimes punts further explanation to VimCasts. VimCasts is an excellent resource, and the author of this book is the man behind the site, but I like having explanations in the book I bought rather than having to look to outside video for them. In his defense, he only does it for some of the more graphical tasks like splitting windows and such. Also, around midway through the book when it gets to motion keys, it feels like backtracking to such simple topics to have a Tip 47 that covers h, j, k, and l keys and keeping your hands on home row. This leads to a number of other rather simplistic motion tips that are not new to anyone that\u0026rsquo;s used vim very long. Fortunately these are all kept to one chapter, Chapter 8. The fact that these complaints are all pretty nitpicky goes to show that overall, I didn\u0026rsquo;t find many problems with this book.\nIn general, I especially enjoy how the author explains his thinking behind the use of certain commands. He\u0026rsquo;ll sometimes show how to do something in multiple ways that use the same number of keystrokes, and then explain why one way better fits the general vim mindset (which often means its better for re-use via the . command). He does a lot of this early on in the book, but the tips later in the book he tends to show the one way to perform an operation.\nI\u0026rsquo;m only halfway through the book now, but this post is getting long enough. I\u0026rsquo;ll go ahead and post what I\u0026rsquo;ve written about the first half of the book, and add another post later if I find some awesome tips worth mentioning in the latter half of this book.\nSecond Half\n","permalink":"https://llcawthorne.github.io/posts/practical-vim-1/","summary":"\u003cp\u003ePractical Vim is an excellent resource for tips and trick for using vim.\nIt focuses on core vim features, and doesn\u0026rsquo;t spend any room talking about\nplugins.  Aside from a few hints to how .vimrc settings might affect certain\ncommands, it doesn\u0026rsquo;t spend any time telling you what to put in your .vimrc.\nIt does have an appendix about vimrc settings, in case you need some new ones.\nThe book is laid out as a series of 123 mostly standalone tips, although\nthey do follow a procession of least to most difficult within their\nrespective section.  The tips are split between 20 sections.  The book\ndoesn\u0026rsquo;t attempt to go into Vimscript.  Overall, I found it a useful collection\nof mostly non-obvious tips for using vim, and I feel like it has made me\nmore capable in using my editor of choice.\u003c/p\u003e","title":"Practical Vim, 2nd Edition - First Half"},{"content":"Well, I promised I would review Command Line Power User the other day when I did the Mastering Markdown video, so here it is. This is probably a better video series to give me an opinion of his teaching skills, since it isn\u0026rsquo;t something I know entirely and is actually a little over an hour of video. Each video is longer also, so it probably won\u0026rsquo;t annoy me so much when the video player scrolls down to where I can\u0026rsquo;t see the video after switching files.\nThe first video is seven minutes of basics that are really basic. He advised it was skippable, and I should have taken his advice. He recommends installing iTerm 2 in OS X, which is what I use already on my Macbook. He recommends cygwin for Windows, but I tend to prefer babun on Windows. I\u0026rsquo;m watching these on the Macbook anyway. He recommends installing zshell and oh-my-zsh, which I already use and enjoy. So we\u0026rsquo;re about to where I learn some stuff.\nThe fifth video is about colors. It has some annoying flicking going on. Fortunately that went away. I was wrong about when I would learn something. He\u0026rsquo;s just focusing on how to edit your zshrc in video six. Ooo, in video seven I learned you can CMD+click links in terminal to open them in browser; that\u0026rsquo;s new. Being able to use take to make a directory and create it at the same time is new to me also. Next video is covering command history, which is a pretty standard zshell feature. At least it\u0026rsquo;s short.\nVideo nine is about zsh plugins. I never remember to use my plugins often enough, but I have a lot enabled. I didn\u0026rsquo;t like most of the plugins he showed off, but it\u0026rsquo;s useful to get people thinking about looking at the plugins to find something they\u0026rsquo;ll find useful. It reminds me to lookup commands of some of the ones I have installed. Video ten is about z, which is unrelated to zshell and completely new to me. It\u0026rsquo;s pretty cool. It tracks frequently and recently used directories and lets you switch to them via z regex where regex is a partial match for the directory name. It will switch across multiple directories with the one command easily. I see from the video that I could\u0026rsquo;ve installed it via homebrew rather than by hand, but it\u0026rsquo;s already installed manually now. It has some handy options that are covered in the manpage. The final tip is about trash, which is like rm, but it puts what is deleted in your Trash. I think I\u0026rsquo;m accustomed enough to rm not to worry about that, but those might be words I regret someday.\nOverall, I think there was a lot of useful stuff if you aren\u0026rsquo;t already familiar with zshell and oh-my-zsh. It was a little long for the little bit that I got out of it, but I picked up a couple of useful tips. Overall, his teaching style is reasonable. I didn\u0026rsquo;t feel like falling asleep during either of his videos, and he doesn\u0026rsquo;t come off like he\u0026rsquo;s just directly reading from notes or anything. I might try the JavaScript 30 series when I\u0026rsquo;m in the mood to code some JS, since it\u0026rsquo;s free also. It should be a bit more substantial. Hopefully it doesn\u0026rsquo;t start out as slow.\n","permalink":"https://llcawthorne.github.io/posts/command-line-power-user/","summary":"\u003cp\u003eWell, I promised I would review\n\u003ca href=\"http://www.commandlinepoweruser.com/\"\u003eCommand Line Power User\u003c/a\u003e\nthe other day when I did the\n\u003ca href=\"http://www.masteringmarkdown.com/\"\u003eMastering Markdown\u003c/a\u003e video, so here it\nis.  This is probably a better video series to give me an opinion of his\nteaching skills, since it isn\u0026rsquo;t something I know entirely and is actually\na little over an hour of video.  Each video is longer also, so it probably\nwon\u0026rsquo;t annoy me so much when the video player scrolls down to where I can\u0026rsquo;t\nsee the video after switching files.\u003c/p\u003e","title":"Command Line Power User"},{"content":"First I\u0026rsquo;d like to say sorry the images are a little big. Not used to screencaps on this retina Macbook.\nSo, I fixed my mistake from last time. I had originally installed ruby via homebrew, but now that I\u0026rsquo;ve read up on rbenv, it seems a lot nicer than the old rvm, and I might want multiple versions of Ruby on my home PC. So I uninstalled Ruby 2.4 and went with brew install rbenv and then used it to install the latest Ruby. I see why the book authors prefer it over RVM now. It\u0026rsquo;s a lot less invasive than the old RVM.\nAnyway, on with Chapter 2, \u0026ldquo;Instant Gratification\u0026rdquo;. I went ahead and completed the code for this chapter and the exercises. Both were fairly trivial. I checked it in at demo51. If you clone that and run bin/rails server from the directory, you\u0026rsquo;re greeted by the site at http://localhost:3000/. You get a lot for very little with Rails. The site you get just from running rails new demo51 looks like this:\nIt also looks like the default server has changed from WEBrick to Puma now. But a page with a picture isn\u0026rsquo;t all that impressive. I must say that I find it pleasant how fast the server starts. I\u0026rsquo;ve become used to my Java EE servers with multiple minute startup times before you can see changes, but not only does this server start fast, it loads changes on the fly when in development mode, so you seldom have to restart it. What is also impressive is how easy it is to modify with a new route. What is slightly intimidating is that the rails new command actually generated forty-six files spread across thirty-four directories. The nice thing is that everything is in its proper place, and hopefully by reading this book and working with the applications a bit more we\u0026rsquo;ll come to understand the logic behind it.\nThe whole application in this chapter is a Hello World modified with a timestamp to show something dynamic. To do this, we need to generate a new controller. Going to the directory of our app and running bin/rails generate controller Say hello goodbye will generate a controller named Say with methods (in Rails terms, these controller methods are called actions) hello and goodbye that will respond to requests to /say/hello and /say/goodbye. It puts the say controller in demo51/app/controllers/say_controller.rb. This is the controller that contains methods for all the /say/ routes. Its starting code that was generated is simply:\nclass SayController \u0026lt; ApplicationController def hello end def goodbye end end Those methods obviously don\u0026rsquo;t do much. Because it inherits from ApplicationController, our SayController automatically gets all the default controller behavior. Even though the controller methods don\u0026rsquo;t have any logic, they still return a site when you navigate to the URL, because by convention they are associated with certain views.\nThe route informs of the file it is currently serving app/views/say/hello.html.erb, which was also automatically generated when we created our controller with the command above. If we edit the file it points us to, we find what looks like a normal html file body:\n\u0026lt;h1\u0026gt;Say#hello\u0026lt;/h1\u0026gt; \u0026lt;p\u0026gt;Find me in app/views/say/hello.html.erb\u0026lt;/p\u0026gt; This is the view that was generated by our command. The views for the SayController we created by default are placed in the app/views/say directory, and there is a view for each of the hello and goodbye methods. The book has us change this view to instead say:\n\u0026lt;h1\u0026gt;Hello from Rails!\u0026lt;/h1\u0026gt; If we refresh our browser window (without restarting the server), we see the new output:\nSo far, we\u0026rsquo;ve learned the place two things go. Controllers go in app/controllers and views go in app/views. The book shows it with the diagram:\nThe book goes on to add the time display to the page directly, then refactor it to have the time generated by the controller and displayed in the view. We\u0026rsquo;ll just skip to that. We modify say_controller.rb to generate the time:\nclass SayController \u0026lt; ApplicationController def hello @time = Time.now end def goodbye end end and modify the view to display the variable set for it by the controller:\n\u0026lt;h1\u0026gt;Hello from Rails!\u0026lt;/h1\u0026gt; \u0026lt;p\u0026gt; It is now \u0026lt;%= @time %\u0026gt; \u0026lt;/p\u0026gt; The time is data, so it is supplied to the view by the controller. The book forewarns us we\u0026rsquo;ll see a lot more of this once we introduce models. It goes on to explain the step-by-step process of what the server goes through when responding to a request, at a very high level. We then customize our goodbye page, but you can checkout the git repo if you want to see that or the results of completing either of the chapter\u0026rsquo;s two exercises. The one remaining item of interest it does in the app is add a link from the Hello page to the Goodbye page and vice versa. It does this using built in helper methods rather than hardcoding URL\u0026rsquo;s. The new hello.html.erb looks like:\n\u0026lt;h1\u0026gt;Hello from Rails!\u0026lt;/h1\u0026gt; \u0026lt;p\u0026gt; It is now \u0026lt;%= @time %\u0026gt; \u0026lt;/p\u0026gt; \u0026lt;p\u0026gt; Time to say \u0026lt;%= link_to \u0026#34;Goodbye\u0026#34;, say_goodbye_path %\u0026gt;! \u0026lt;/p\u0026gt; The first parameter in the call to link_to() is the text to be displayed in the hyperlink, and the next parameter tells Rails to generate the link to the goodbye action of the say controller.\nFinally in this chapter, they display what happens when things break. As the authors put it \u0026ldquo;the true test of the developer friendliness of a framework is how it responds when things go wrong.\u0026rdquo; First, they ask what would happen if we misspelled Time.now as Time.know in our controller. Rails not only tells you the exact spot of the error, it also asks if you meant to type \u0026ldquo;now\u0026rdquo; and offers an interactive debugging console:\nAnd before you start worrying, the web console is only shown if you\u0026rsquo;re on the same machine as the web server and running in development mode, so there shouldn\u0026rsquo;t be any chance of anyone getting into it in production unless you specifically whitelist more ips and run the server in development mode. Likewise, if you attempt to go to http://localhost:3000/say/h3llo instead of /say/hello, you get:\nIt gives you a list of possible routes along with what controller and action they are associated with and a helpful search box to trim it down.\nAltogether, the app presented here is totally trivial, but in this chapter they did manage to cover:\nHow to create a new Rails application and how to create a new controller in that application How to create dynamic content in the controller and display it via the view How to link pages together How to debug problems in code or the URL Looks like the next chapter covers a bit of MVC theory, and chapter 4 is a Rails review. I\u0026rsquo;ll probably comment on both in one quick post. Then in Chapter 5, we dig into building a bigger application.\n","permalink":"https://llcawthorne.github.io/posts/awdwr51-02-instant-gratification/","summary":"\u003cp\u003eFirst I\u0026rsquo;d like to say sorry the images are a little big.  Not used to\nscreencaps on this retina Macbook.\u003c/p\u003e\n\u003cp\u003eSo, I fixed my mistake from last time.  I had originally installed ruby via\nhomebrew, but now that I\u0026rsquo;ve read up on rbenv, it seems a lot nicer than the\nold rvm, and I might want multiple versions of Ruby on my home PC.  So I\nuninstalled Ruby 2.4 and went with \u003ccode\u003ebrew install rbenv\u003c/code\u003e and then used\nit to install the latest Ruby.  I see why the book authors prefer it over\nRVM now.  It\u0026rsquo;s a lot less invasive than the old RVM.\u003c/p\u003e","title":"AWDWR 5.1 - 02 - Instant Gratification"},{"content":"Well, for something a little different, I decided to write my opinion of a free video course. Since I\u0026rsquo;m writing my blog in markdown, I figured why not review it with something other than the Kramdown cheatsheet. Wes Bos has a number of video courses, some free and some paid for. His Mastering Markdown course is one of the free ones. It\u0026rsquo;s really only a single 23 minute video, so not much of a course, but since he just came out with a Learn Node course and has another longer free course of Javascript projects, I figured why not try the little course to get a feel for his teaching style and see if I want to invest any more time and/or money in more of his courses later. His other free courses if you\u0026rsquo;re interested include Command Line Power User which has some Z shell tips that I might check out, since I\u0026rsquo;m sure I\u0026rsquo;m not making the most of it, and JavaScript 30 which is 30 days of building 30 things in vanilla JS (which promises no frameworks, no compilers, no libraries, and no boilerplate). Unless this one is terribly, I\u0026rsquo;ll probably sit through the command line one after this. The JavaScript 30 one I\u0026rsquo;ll only invest time in if I like these two. Well, without further ado, here\u0026rsquo;s my opinion of Mastering Markdown.\nGood to see that he isn\u0026rsquo;t opinionated about editors. He says use whatever editor you\u0026rsquo;re most comfortable with, even vim. He uses Sublime Text though and recommends a package for it, if you use it. I went ahead and installed it in my copy of Sublime Text. It\u0026rsquo;s called MarkdownEditing and has a lot more features than the built in Sublime Markdown package. I spent almost as much time reading the Package Control Messages as the runtime of these videos, but oh well, sometimes I open stuff up in Sublime, so I might as well get it working alright. I took this chance to toggle some settings in vim-markdown while I was thinking about it.\nIt\u0026rsquo;s a little annoying that his video player jumps down to the video list when it advances videos. Each one, I have to scroll back up after it advances to see the video again. Probably wouldn\u0026rsquo;t be so bad on my big monitor instead of the laptop screen. It\u0026rsquo;s made even more annoying by how short the videos are. Video quality is good, and it is nice that it saves the fact that I\u0026rsquo;ve set the speed up to 1.25 when it switches videos. I learned something about footnote links that I had forgotten, and a cool feature that lets you highlight a code block as a diff, so it wasn\u0026rsquo;t time wasted. He talks a little fast anyway, so I probably wouldn\u0026rsquo;t need the speed increase for something that I didn\u0026rsquo;t already know.\nOverall, I thought the video was OK. I\u0026rsquo;ll try the Command Line Power User course too and see what I think of it. Currently I just use zshell with oh-my-zsh and a couple of plugins enabled, so maybe I can learn some more zshell tricks.\n","permalink":"https://llcawthorne.github.io/posts/mastering-markdown/","summary":"\u003cp\u003eWell, for something a little different, I decided to write my opinion of a\nfree video course.  Since I\u0026rsquo;m writing my blog in markdown, I figured why\nnot review it with something other than the Kramdown cheatsheet.\n\u003ca href=\"http://wesbos.com/\"\u003eWes Bos\u003c/a\u003e\nhas a number of video courses, some free and some paid for.  His\n\u003ca href=\"https://masteringmarkdown.com/\"\u003eMastering Markdown\u003c/a\u003e course is one of the free\nones.  It\u0026rsquo;s really only a single 23 minute video, so not much of a course, but\nsince he just came out with a Learn Node course and has another longer free\ncourse of Javascript projects, I figured why not try the little course to get\na feel for his teaching style and see if I want to invest any more time\nand/or money in more of\nhis courses later.  His other free courses if you\u0026rsquo;re interested include\n\u003ca href=\"https://commandlinepoweruser.com/\"\u003eCommand Line Power User\u003c/a\u003e which has some\nZ shell tips that I might check out, since I\u0026rsquo;m sure I\u0026rsquo;m not making the most\nof it, and \u003ca href=\"https://javascript30.com/\"\u003eJavaScript 30\u003c/a\u003e\nwhich is 30 days of building\n30 things in vanilla JS (which promises no frameworks, no compilers, no\nlibraries, and no boilerplate).  Unless this one is terribly, I\u0026rsquo;ll probably\nsit through the command line one after this.  The JavaScript 30 one I\u0026rsquo;ll\nonly invest time in if I like these two.  Well, without further ado, here\u0026rsquo;s\nmy opinion of \u003ca href=\"https://masteringmarkdown.com/\"\u003eMastering Markdown\u003c/a\u003e.\u003c/p\u003e","title":"Mastering Markdown"},{"content":"So, what do I have to blog about? I\u0026rsquo;m always trying out new stuff and reading books, so I figure I\u0026rsquo;ll talk about that. I happen to have just gotten a beta copy of Agile Web Development with Rails 5.1 and since my Ruby and Rails experience from my résumé is a little rusty, I figure I\u0026rsquo;ll read that and blog about the experience. Starting this site using Jekyll has made me think about Ruby lately anyway. It\u0026rsquo;s been many years since I\u0026rsquo;ve read \u0026ldquo;Agile Web Development with Rails\u0026rdquo;, and I think it was the version that covered Rails 1.2, so this should be a pretty new experience for me; both a great refresher and an introduction to what is new in the Rails world these days.\nThe obvious question is why rails when I could play with the hot new Javascript framework. Well, I\u0026rsquo;ve played with React some, along with Ember, and Angular. I might go back to messing with them and blog about the results later. Right now, I\u0026rsquo;m just in a Ruby/Rails mood. I\u0026rsquo;ve always liked how the Ruby community seems to emphasize good programming practices that carry over to any language you work in, and I recall the Agile Web Development book being a good source of sound programming advice. As a side note, I understand that the book now includes information on doing a Javascript front-end with a Rails backend, so I\u0026rsquo;ll get in some Javascript before I\u0026rsquo;m through.\nThe introduction is well paced. The parts I feel worth mentioning are its argument that \u0026ldquo;Rails Simply Feels Right\u0026rdquo;, which I am inclined to agree with. I\u0026rsquo;ve always thought of Rails as the cadillac of web frameworks. There\u0026rsquo;s a lot of ways to do the same old CRUD in other frameworks, it\u0026rsquo;s just rails has polish and a certain thoughtfulness of layout that makes it all click. It achieves a level of conciseness thanks to \u0026ldquo;Convention over configuration\u0026rdquo;, adhering to the philosophy of DRY (Don\u0026rsquo;t Repeat Yourself), and the natural conciseness of the Ruby programming language (a trait that I miss a lot now in my job, where my Java code tends to include a lot of boiler plate by necessity).\nThe introduction shares a link to the guiding philosophy of Rails, the Rails Doctrine. It can be argued that the Rails Doctrine is what makes Rails continue to be a strong choice as a web framework, even though it\u0026rsquo;s no longer the new darling on the block, and as an aside is also one of the reasons I favor Ember of the Javascript frameworks, since the Ember community were obviously heavily influenced by the Ruby/Rails community. The number one item on the Rails Doctrine is \u0026ldquo;Optimize for programmer happiness\u0026rdquo;. This is lifted straight from Ruby, but is still something that many languages don\u0026rsquo;t put among the considerations, much less as a guiding principle. I forgive them for taking a shot at one of my other favorite language mottos, Python\u0026rsquo;s \u0026ldquo;one and preferably only one way to do something\u0026rdquo;, which I also believe has it\u0026rsquo;s place. But I get their meaning that having a choice of ways to express a solution and being able to choose among them adds a certain bit of artistry to the craft of programming.\nI really appreciate the 2nd principle of the Rails doctrine, \u0026ldquo;Convention over Configuration\u0026rdquo;. Right now, my primary day job is working on an app that\u0026rsquo;s been around for 15 years, and it seems for every problem encountered the people came up with a way from scratch for how to handle it. There\u0026rsquo;s no conventional way to do anything. But as the author says, \u0026ldquo;Part of the Rails’ mission is to swing its machete at the thick, and ever growing, jungle of recurring decisions that face developers creating information systems for the web.\u0026rdquo; Sane defaults make a lot of things possible with little effort, as is shown by the demo app in the next chapter. Just like the Principle of Least Surprise, it begs the question of \u0026ldquo;Sane (or least surprise) to who?\u0026rdquo;, but in general the framework itself is built with enough consistency that once your steeped in its general way of doing things, they make sense as a whole. I endorse the idea that freedom from choice is sometimes exactly what is needed, rather than freedom of choice to do it a different way. \u0026ldquo;A place for everything and everything in its place. Constraints liberate even the most able minds.\u0026rdquo; This is the same type of consistency that Python\u0026rsquo;s motto helps provide, but with some wiggle room left for expression in implementation.\nI could go on analyzing tenets of the Rails Doctrine, but let\u0026rsquo;s get back to the book. I will argue that I sometimes feel \u0026ldquo;monkey patching\u0026rdquo; is more power than programmers need, even if it allows some cool tricks. But I haven\u0026rsquo;t used it much. It just seems a nightmare that you might end up having to look at someone\u0026rsquo;s legacy code down the line where they completely misused it and nothing makes sense. But then again, I like having sharp knives in my kitchen too. I just don\u0026rsquo;t have to cook after many other chefs. Even good programmers sometimes make questionable decisions when pushed for time assuming the language allows certain shortcuts. It\u0026rsquo;s the sharp knives offered by Ruby and Rails that sometimes make me want to stick to the easy consistency of Python and Django, even if they require a little more boilerplate to accomplish similar tasks.\nI did promise to get back to the book. It points out also that \u0026ldquo;Rails is Agile\u0026rdquo;. It\u0026rsquo;s too easy to forget the core tenets of Agile development; they become easily lost to a focus on the ceremonies of Agile. The book restates the four preferences of the Agile Manifesto:\nIndividuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan As someone who works at an organization that is permanently mid-transition between doing things waterfall and approaching them with more agility, I like to remember the core philosophy of the Agile Manifesto and ask if the particular procedure we\u0026rsquo;re seeking to follow embodies those ideas. It\u0026rsquo;s too easy for the core ideas to get lost in the ceremony of scrums and sprint planning meetings and the artifacts of burndown charts.\nWho is this book for? It\u0026rsquo;s aimed at application programmers who want to build and deploy web based applications. It\u0026rsquo;s fine if you\u0026rsquo;re new to Rails, and it might be fine even if you\u0026rsquo;re new to Ruby. My Ruby is rusty enough that I had to review at Learn X in Y Minutes, but that\u0026rsquo;s a good sign I should be alright. I have a whole catalog of Exercism problems that I worked in Ruby to review with too, in the worst case. This book is more about how to get things done, and doesn\u0026rsquo;t attempt to act as a detailed reference book. There\u0026rsquo;s online API references for that type of stuff.\nThat was just the introduction! We\u0026rsquo;ll be a bit quicker now. Especially since the first chapter is all about getting setup. It has useful instructions for a variety of platforms, including working from a vagrant box or using the cloud9 online IDE. I figure that I like having a recent version of ruby around at the command line anyway, so I followed the OS X instructions and used homebrew (which I already had installed). I\u0026rsquo;m tempted to try Cloud9 sometime, especially since a quick Google tells me that it does have Vim keybindings. Maybe some other time. It looks like in addition to rails, we need yarn and chromedriver. I don\u0026rsquo;t have yarn installed yet, as I\u0026rsquo;ve just used npm for packages, and I\u0026rsquo;m looking forward to using chromedriver from Ruby. I use selenium and chromedriver at work to do end-to-end testing of some of my applications, so I\u0026rsquo;m used to working with chromedriver in Java. I needed to uninstall rvm to get the new version of ruby on my OS X box. It seems that rbenv is the book\u0026rsquo;s preferred way for managing multiple Ruby\u0026rsquo;s these days.\nOn an unrelated note, when did OS X get the ability to remap Caps Lock to Escape without addons? I always used to use Seil and Karbiner, but they quit working in the latest version of OS X. I was about to try Karbiner Elements, but when I checked modifier keys under Keyboard in System Preferences, I saw that it had Caps Lock there and an Escape option. Sorry to toss this in the middle of everything else, but it\u0026rsquo;s really been bugging me in Vim to not have my Caps Lock act as Escape. Unless I stay on a Ruby kick, the next book I review might be Practical Vim. I believe I saw the second edition was on Safari Books the other day. Sorry for the aside, but I got distracted while waiting for homebrew to update all my packages.\nBack to the book. After covering installing in the environment of your choice, along with some advice for when/if things go wrong, we get to Chapter 2, \u0026ldquo;Instant Gratification\u0026rdquo;. In this chapter, we\u0026rsquo;ll make a quick demo app to get our feet wet with Rails. I\u0026rsquo;ve put the demo app with completed exercises up at demo51. I\u0026rsquo;ll cover Chapter 2 next blogpost, this one is already getting pretty large.\n","permalink":"https://llcawthorne.github.io/posts/awdwr51-01-introduction/","summary":"\u003cp\u003eSo, what do I have to blog about?  I\u0026rsquo;m always trying out new stuff and reading\nbooks, so I figure I\u0026rsquo;ll talk about that.  I happen to have just gotten a\nbeta copy of\n\u003ca href=\"https://pragprog.com/book/rails51/agile-web-development-with-rails-5-1\"\u003eAgile Web Development with Rails 5.1\u003c/a\u003e\nand since my Ruby and Rails\nexperience from my résumé is a little rusty, I figure I\u0026rsquo;ll\nread that and blog about the experience.  Starting this site using Jekyll\nhas made me think about Ruby lately anyway.  It\u0026rsquo;s been many years since I\u0026rsquo;ve\nread \u0026ldquo;Agile Web Development with Rails\u0026rdquo;, and I think it was the version that\ncovered Rails 1.2, so this should be a pretty new experience for me; both a\ngreat refresher and an introduction to what is new in the Rails world these\ndays.\u003c/p\u003e","title":"AWDWR 5.1 - 01 - Introduction"},{"content":"Finally got around to putting something together for my github.io site other than what the generator spit out. I went ahead and took advantage of the fact that they let you layout your site with Jekyll to play with some \u0026ldquo;new to me\u0026rdquo; tech. I can write up the posts in Markdown, so maybe it will be easy enough that I actually start blogging here.\n","permalink":"https://llcawthorne.github.io/posts/first-post/","summary":"\u003cp\u003eFinally got around to putting something together for my github.io site other\nthan what the generator spit out.  I went ahead and took advantage of the fact\nthat they let you layout your site with \u003ca href=\"http://jekyllrb.com\"\u003eJekyll\u003c/a\u003e to play\nwith some \u0026ldquo;new to me\u0026rdquo; tech.  I can write up the posts in Markdown, so maybe it\nwill be easy enough that I actually start blogging here.\u003c/p\u003e","title":"Lewis Cawthorne Launches Site"}]