Pragmatic Book Club: Chapter 4
2 min readSep 15, 2022
Chapter four, pragmatic paranoia. Now we’re getting into some more abstract and academic topics. Things we could think about introducing into our own codebases, even.
Section 23: Design by contract
- A completely unnecessary quote from the problematic Woody Allen. Great.
- Has anyone ever written clojure or elixir? Can you share a bit about how contracts form part of the language?
- What would it take for us to introduce design by contract to Customer Products?
- How do engineers at the FT reach a consensus on anything?
- Would we need to change all of our existing code?
- Would it be worth the effort?
- Type is a form of c
- [From the book] If DBC is so powerful, why isn’t it more widely used?
Section 24: Dead programs tell no lies
- Is this mantra something you consider when writing code or reviewing other people’s?
- Do you agree or disagree that with what the authors are saying about catching/re-raising exceptions on page 113?
- The authors only give the reasons why not re-raising is better, what are the reasons you might want to catch and re-raise?
Section 25: Assertive programming
- Do we use console.assert()?
- When I read around this topic it seems like in a lot of places people are missing what is pointed out by the book assertive programming should not be used to validate user input.
- Why should asserts not be used for handling user input? Because the program shouldn’t terminate when a user inputs something incorrectly, as they will do often(?)
Section 26: Balancing Resources
- This topic was pretty interesting to me, but it divided the book group. Some people felt it was not relevant to their day-to-day work. We predominantly write Node, and we use a lot of libraries. So the kinds of resource allocation issues this section talks about are often abstracted away and dealt with in those libraries.
- Good MDN article about memory
- Good Katie Fenn talk about garbage collection in Node
- Blog post from me from 2015 about a CPU usage bug I encountered and fixed in a mustache gem (Just to demonstrate that, rarely, we do encounter resource issues, even when writing front end code…)
- Anybody got any fun horror stories about resource allocation going wrong?