Showing posts with label Books. Show all posts
Showing posts with label Books. Show all posts

2024-07-13

Goto is flow control!

I'm reading The Legacy Code Programmer's Toolbox: Preactical Skills for Developers Working with Legacy Code by Nathan Boccara. I'm not far enough in to have a settled opinion of the book, but I think I'm far enough along to describe it a "promising" at least.

Anyway, I'm in the first section of the book where he talks about understanding code you've just encountered. And I've already hit my second "Well, why didn't I think of that?" moment1 where he suggests filtering functions to only display the flow control as a way of getting to know them. Fantastic idea and I feel like a dunce for leaving that option on the table for years, but I have a bone to pick with his implementation in the example he provides.

His example works on a piece of C++ code from an open source project, and he filters for

  • if
  • else
  • for
  • while
  • do
  • switch
  • case
  • try
  • catch
which probably seems like a good list at first glance, but the function the very first flow control token in the example function is a label! And yeah, that means there is a goto further down.

Now, I almost never use goto, and when I do it's usually to jump to some clean-up or post-processing operation from nested scope. This one jumps beck outside a loop to do some re-initialization. Who knows if that is justified. Maybe it spares some extra nesting or multiple condition variables or something.

Whatever, I just think we ought to include goto and labels as part of the set "flow control" to filter on. And the same can be said for break, continue, and return.

Now maybe the author has a reason for the omission and just didn't tell us, and I'm guessing it makes little difference to the utility of the procedure, but I just had to get it off my chest. We now return you to your regularly scheduled life.


1 Thanks, Nathan!

<

2023-08-28

The invention of fanfic

I've been reading The Hobbit to the child for bedtime story recently. Bit of a slog at times because (a) she falls asleep in the most surprising places in the text, (b) frequent stops to discuss new vocabulary and previously unknown customs, and (c) lengthy interruptions to hear how she things the story should proceed. That latter bit came to a head tonight as we neared the end of Chapter 8. She believes that the story would be better if we dispensed with the spiders and added some unicorns and has decides to make up her own, improved version.

2022-08-11

Loving and Hating the Same Book

I bought a book in an airport not so long ago. As usual with airport news-stands the pickings were somewhat slim and I opted for something I might not have chosen from a broader menu. This is a rather long book that is claimed by the self-designated and self-concious literary establishment, though it is arguably science fiction as well.

It kept me harmlessly engaged for the rest of that rather long travel day, but after we returned home I got distracted by other reading. I hate to leave stories unfinished, however, so I've returned to it, and I'm experiencing the same mixed emotions I had on the plane.

Considered in the small, I'm blown away. Sentence after sentence, paragraph after paragraph the writing rolls on carrying me along wih it. Each element is put together with skill and craftmanship. Mere middling examples plucked from the text as good as the best I've ever written. Word selecion is precise, cadence is smooth, mood and ambiance permiate the language. Details dropped in like grace notes place the action in time and place or evoke he personallity of characters. Damn it's good.

But in the large, I'm somehow ... bored. Every time I turn a page I am disappointed that I haven't reached the end of the chapter. I struggle to hang on to any semblance of plot arc.1 I despair over how little of the book is behind me. I long for a couple paragraphs of clarity instead of literary stylings.

The book in question is Thomas Pynchon's Gravity's Rainbow. It's widely considered a masterpiece despite being a little dense. If I do manage to slog through to the end I may have some more thoughts, but for now I just note my paradoxical love and hate for the writing.


1 Well, to judge from descriptions of the work online, this is a particular offender in this regard; having more characters, more seprate threads, and just more events than is typical even for "literary" fiction.

2022-07-30

Why didn't I think of that description?

For the last couple of weeks I've been making my way through A Brief History of the Earth (subtitle "Four Billion Years in Eight Chapters") by Andrew H. Knoll. Brief shout-out to the author for including the (anti-)neutrino among the products associated with beta decay in his discussion of radiometric dating.

Nice book so far (I've reached the last chapter). I had a rough appreciation for much of the subject matter coming in, but it is clear that there has been much progress since the last time I read up on the discipline. Some open questions have been answered outright, and many details have come into focus where rough outlines existed before. All very cool.

One detail of the writing, however, is worthy of special mention. The bibliography for each chapter is divided into two sections: "Approachable Readings" and "More Technical References". I sorely wish I'd thought to use "approachable" as a description of pop-sci material more often in the past.

2021-08-23

Objective knowledge is ... subjective?

I recently finished Jonathan Rauch's The Constitution of Knowledge: A Defense of Truth. I found most of the book pretty depressing: it relentlessly examines the ways in which trolls, propagandists, well meaning activists, and shameless bullshitters have been succeeding in attacking the foundation of collective certainty that is the legacy of the enlightenment and subsequent advances. It does make the effort to end on a optimistic note with a exhortation to action in the defense of objective truth.

I recommend it; but hang onto your sense of purpose in the world: it's a rough road.

But I want to point out an oddity in the author's conception of the world (one freely admitted in the text, by the way). One of several guide-stars it the text is what Mr. Rauch calls "the reality-based community" and the rules under which it operates (which he dubs "The Constitution of Knowledge").

We should stop to note that Mr. Rauch's conception of this community encompasses a pretty broad swath including not only scientists but also many other scholars, journalist, intelligence analysts, various members of evidence-based judicial systems, and some governmental and no-governmental policy wonks. Basically everyone who approached the creation of knowledge using The Constitution of Knowledge as a foundation.

One of the key rules of the "knowledge" produced by these systems is that anyone else honestly and diligently following the same rules and using the same base of existing facts should come to the same conclusions. A condition you know you've reached when a strong consensus emerges in the community itself.1

But that leaves us in the epistemological interesting positions of having "objective" knowledge be the product of consensus (among a suitably trained set of investigators), which is at some level a subjective entity.2

The reason this doesn't bring the whole structure down in ruins is the allegation that the processes is what generates the reliability. Have trained in a physical laboratory science I have recourse to highly repeatable experiments for much of the grounding of my discipline,3 but the idea that persuasion through open, earnest, and largely no-personal argumentation is the legitimate route to authority works more broadly that the experimental sciences.


1The author presents a number of examples.

2 Indeed, the author talks about the ways consensus forming can fail or be subverted.

3 Even in physics you get into places (like quantum foundations) where interpretational issues become important in the way we teach, relate, and apply the things we know.