Auto Ads by Adsense

Booking.com

Thursday, October 28, 2021

Review: A Philosophy of Software Design

 Over time, I've learned to be very suspicious of thick programming books. The thicker they are, the more likely it is that they be crammed with worthless code listings, and pages after pages of diagrams and pontification that's worthless. Thin books like K&R tend to be much more useful. When Steve Grimm recommended A Philosophy of Software Design, I was very happy to discover that it was a thin book.

You probably know many of the things Ousterhout points out, but even if you do, you've probably never seen them articulated this way before. For instance, he mentions that you should aim for API designs that have depth. His expression of "depth", however, might be different in principle from what you've heard before, which is that you should have few APIs/interfaces that are composable in ways that provide maximum functionality and abstraction.  He explicitly compares the UNIX file "open" type system calls vs the Java InputStream set of classes and finds that the InputStream type much to his distaste --- using it requires creating multiple classes stacked on top of one another, leading to verbosity, while the UNIX api just requires an "open."

There are many other common design mistakes that Ousterhout points to, including avoiding pass through methods, avoiding decorators, putting different abstractions for different layers of an API design, and taking on as much configuration complexity as possible as part of the design of the lowest layer of the API, rather than exporting it as tunable knobs at higher levels. In particular, he also points out that the error API like exceptions and return codes are part of a system's interface, and that programmers and designers need to think carefully before exposing them as part of a design --- if you can eliminate an error code, you've simplified the design considerably, and it's worth implementation complexity to do so.

I loved the sections of commenting ("write the comments first" is counter intuitive advice that might be worth trying), and naming hygiene, where he describes a bug that took him 6 months to find because a the same variable name was used to hold both physical blocks and logical blocks, and that one piece of code that confused the two slipped by multiple code reviews and inspections while silently corrupting files in a file system. These are design issues that can only be learned through hard fought experience, and Ousterhout has the scars to prove it.

I also enjoyed his perspective on object-oriented programming, agile development, and test-driven development. (Spoiler: he thinks that test driven development is bad because by writing the unit tests first, you've unconsciously made the cost of changing a design during development higher, thereby making it more likely that you'll try to patch a bad design than radically refactor it)

The book does have limitations. For instance, a lot of the complexity in modern APIs are because of the need to support legacy applications. Ousterhout has no experience with this (and neither do his reviewers, many of whom are Google engineers), and so doesn't comment on it, but it's a major issue in any company that's built a platform or is building a platform, since usually those are built in a hurry and only after success do you realize that you screwed up (the failures never need to be fixed since they have no customers). Many modern programming environments and systems make it easy to pull in libraries and dependencies from open source or other repositories, but this explosion of dependencies actually makes it really hard to debug and fix code. Ousterhout doesn't comment on that either, since most of his designs were base layer operating system type code. Another source of complexity I've found in modern systems is a penchant for putting behavioral controls in config files rather than in code. For instance, many Java logging systems assume you'd want to control logging in a properties file, which I've found to be backwards --- the logging systems should expose a programmer API, and if the application needs a config file to control behavior then there should be libraries available to do that reading and configuration, but making it hard to control behavior through an API actually makes it harder. SpringBoot (where you can spend all your time debugging inscrutable config files) is another example of this sort of misdesign.

No matter the limitations, this is a great book and well worth your time to read if you're an engineer. It's a great discussion of microarchitecture (not systems design) and good API design as well as good programming practices that makes you think. Recommended.

Update: The above was a review of the first edition of this book. There's now a second edition, and Prof Ousterhout has kindly published the additional chapters as a PDF on his web-site.

Monday, October 25, 2021

Review: Measure What Matters

 Measure What Matters is John Doerr's slides about OKRs turned into a book. OKRs (Objectives and Key Results) are given credit in the book as a management tool for companies like Intel, Intuit, Google, and many others for organizing their workforce around a common set of objectives, and driving for continual improvements. They are getting credit for eliminating politics and getting cross functional teams to work together.

Perhaps if I'd been more indoctrinated in the OKR process I would have avoided many career mistakes at Google. For instance, hiring, mentoring, and other important activities were never part of the organization's OKRs, so in retrospect I should have spent zero time on it and focused on my OKRs. Similarly, if you help someone save their job (by moving them out of the PIP process through mentoring or intensive teaching), you were not working on anybody's OKRs. An organization as big as Google really doesn't care.

To me, this is the biggest indictment of OKRs: by the time morale and cohesion of employees has deteriorated to the point where it's important enough to become an OKR, you've already lost. It's too late to stop an exodus of talent. OKRs almost never deal with this until it's too late, which is why you get the Silicon Valley death spiral.

At the back of my mind also is that the book doesn't actually provide any counter-factuals. For instance, there could be companies that have succeeded without OKRs as well, and it could be that Google succeeded not because of OKRs, but because it was in such a great market and had such a great business model that it would have succeeded anyway. Notice, for instance, that OKRs didn't help Google Video win over YouTube. It was having $1.6B in the bank that allowed Google to buy YouTube and then leverage that property into success. But in a business book, you're not allowed to write about alternate hypothesis to the tool you're trying to push.

Furthermore the kind of stuff that's discussed as distractions and innovations (the book makes the point that most innovation happens bottom up, rather than top down, but doesn't discuss the possibility that a laser focus on OKRs would actually usually prevent such innovation) usually turn out to be valuable, but difficult to measure, and probably never on anybody's OKR radar. I once had a conversation with Bill Coughran about OKR myopia and his response was, "The founders worry about becoming quarterly and short term focused after an IPO. I fail to see how the company could become any more short-term focused."

If you work any any company that fully adopts OKRs are an operating principle, this book is essential for your personal and business success. But if you're in the position of thinking about adopting this, just remember that the plural of anecdote is not data.

Thursday, October 21, 2021

Review: The Joy of Sweat

 The Joy of Sweat is an appropriate book to read during the summer, with high temperatures, and especially on a camping trip where you forgot to bring the shower on a hot day. In it, you will learn some interesting facts like the fact that it only takes 15 minutes for what you eat and drink to become detectable in your perspiration: 

It turned out that it took less than 15 minutes for the tracer to transit through his stomach, be absorbed by the intestine, get filtered through the liver and kidney, enter his bloodstream, lap through his circulatory system to reach the veins in his skin, diffuse through his dermis toward the sweat glands, and then escape out of the millions of pores on his skin. (kindle loc)

It's astonishing how leaky we are as far as being water bags are concerned. The book then takes a look at how other animals cool themselves. Vultures, for instance, defecate on their legs and then increase their blood flow to take advantage of evaporative cooling, so no matter how icky you think your sweat is, be grateful you're not a vulture.

After that initial bout of facts, the book then takes a fairly big detour into  various ancillary topics such as fingerprints, body odor, and whether or not you can smell somebody's fear:

Some law enforcement visionaries have also proposed installing chemical detectors at airports that respond to fear odor. These could alert authorities about an anxious would-be terrorist. In reality, such a device is more likely to buzz continually, given the large number of people at airports who innocently fear flying. (kindle loc 963)

There's a section on how different people are when it comes to sweat, including some uncommon conditions, such as when certain people sweat so much that pencils slide right off their hands, and they have to change 3-4 T-shirts a day. What's interesting to me is that when drops of sweat appear on your body, that means that you're being inefficient --- sweat that doesn't immediately evaporate does nothing to cool you down, but judging by how frequently I sweat even with a little bit of activity, it seems strange that the body hasn't evolved ways of detecting the surrounding humidity and saving water rather than just extravagantly releasing it in excess. I guess humans evolved in an environment where water was plentiful, and the penalty of spending too much water pales in comparison to the penalty of not sweating enough.

There's a description of people who were born without sweat glands and the implications thereof:

 Pajkic was born without sweat glands. This means his skin is very dry and extremely resistant to electricity. His sweat-free skin acts like a huge piece of rubber, a characteristic that supplies him with an apparent superpower: He seemingly can’t be electrocuted. Pajkic discovered this skill as a teenager, when he touched an electric fence and did not get electrocuted. In 1981, Pajkic withstood a shock of thousands of volts of electricity. More recently, he has upped his game to 1 million volts. In 2001, he boiled a cup of water in 1 minute and 37 seconds by passing electricity across his body—a feat that landed him in the Guinness Book of World Records. (kindle loc 3154)

Wow, so superheroes exist! Though "insulator man" doesn't quite have the ring of "Electro."

For entertainment, this book is tops. For practical advice for the athlete or the profuse sweater, less so. But I recommend it anyway.

 

Monday, October 18, 2021

Haypress Campground

 Bowen seemed to really like Point Reyes and the various trips we'd made there. Every so often I'd check recration.gov and everything in the area would be taken. Then one day I found the Haypress Campground available. I'd never been there before, and was intrigued, and what the heck, the $5 reservation fee was reasonable.

The weekend we were due to go, a mass of bad air from the various fires in California visited the Bay Area. Purple Air didn't have coverage of the campground, however, so we elected to go, bringing our TemTop to check the air quality to decide whether we would stay the night.

Full Trip Photos

Arriving at the campground, I as astonished as to how crowded it was. We had to park an extra quarter mile from the trail head as a result, and it took me a while to get both kids bikes off the car, load up the trailer (which last saw use when Bowen was 3), and then load the first bunch of camping equipment onto it.

The campground looked far different from the photos. For instance, from the pictures you might think that there were places to hang a hammock. You'd be wrong. All the trees were awkwardly positioned and difficult to get to. Many photos made the campground looked like it was shadeless, but in fact, it was positioned in such a way that most of the campground was shaded from mid morning on, and before that the frequent marine layer would make shade unnecessary.

I made another trip to fetch lunch materials and various sleeping materials, but still had dinner to bring over. I decided that we'd wait until 4pm, check the TemTop, and then decide to commit. In the mean time, we had time to go to the beach!









Going to the beach was a mistake. It was hot, and shadeless. It was a good thing we ate in the shade at the campground before going. An hour in the sun and I was cooked. I told the kids that I was going to take a walk, but the kids had also had enough, and so we all went back to the campground together. There, Boen finished the rest of his lunch, and I read until 4pm. The AQI had fluctuated between  70-110, but at 3pm, it took a dive down to around 70 and stayed there, so I rode to the car, and exchanged the lunch cooler for the dinner box, taking the opportunity to move the car much closer to the entrance of the park for easier loading the next morning.

Getting back, Bowen was hungry, so I made dinner, using up as many canisters of backpacking fuel as possible. By then it was starting to get cool, and I suggested watching the sunset to Bowen, who agreed. Boen decided to stay in the tent.


This second ride proved to be spectacular. First, we chose not to ride to the beach, opting to climb up to the Ridge. Secondly, we had evening light, and it was nothing short of beautiful.















We did discover to our dismay that the descent back to Tennessee valley was either on the Fox trail (marked forbidden to bikes) or all the way to Muir Beach, risking an after dark visit to the Miwok trail. We opted to take the illegal trail, which turned out to be wide as a fire road and was only marked illegal for bikes because it was steep and inexperienced cyclists (Bowen not being one of them) would probably crash.

We got back to camp to find Boen already fast asleep. We woke him up to brush his teeth, then unpacked all the sleeping bags and got everyone to sleep. I noted that the AQI was now in the 20s, a far cry from the 160s that Mountain View was at this morning.




The morning arrived with a thick marine layer and clean fresh air, and it wasn't cold at all! I made some coffee but the kids weren't up for breakfast, so I made a first trip to drop all the sleeping bags and then came back and packed everything up and brushed everybody's teeth, and then we were out! Such an easy trip! No bears to worry about, and a pleasant escape from bad air.

Thursday, October 14, 2021

Review: Beyond Entrepreneurship 2.0

 A recent work event had prep work that included reading Beyond Entrepreneurship 2.0, a book I read way back in 1995 because Reed Hastings (who is indeed mentioned in the book's introduction) was enthusiastic about and told me I should read. Jim Collins was the same guy who also wrote Built to Last and Good to Great and How the Mighty Fall.

The trap of non-fiction business books is that they go out of date and because of selection bias. For instance, almost every company in Good to Great (Circuit City, Wells Fargo, Sallie Mae, GE) faced a decline soon after the publication of the book, some going out of business, while others facing criminal charges, etc. Collins would defend his book as documenting the companies that became great, but of course, it also illustrates that we don't actually know how a company is actually "built to last", since so many didn't.

Similarly, Beyond Entrepreneurship named Jim Gentes, the founder of Giro as a man capable of articulating his vision and mission, but of course, Giro is itself no longer an independent entity. It has long since been sold to another company.

That's not to say that the book is valueless, or that the second edition of this book, despite being full of self-promoting stories, adds nothing. For instance, there's now a chapter on how important people are to an organization. (Seriously?!) But the book talks about generalities (you need to put the right people in key positions), but nothing on how to go about doing it. It's clear when talking about people, the book means managers. But that's too general, since if you're in the tech industry, key technical people also matter, but the book is too general to deal with it, despite covering the rise of HP and IBM (both companies whose best days seem behind it).

There's a section on values and how they related to the company's purpose and mission. That's great. But there's the problem of survivorship bias. It isn't that companies with values/purpose/missions succeed, it's that every company has them, or at least pay lips service to them, so maybe it's the same as saying "all successful people have a brain." To its credit, the book takes pains to point out that many people talk about values/purpose/mission but don't align their systems to provide a consistent message, or its managers don't behave as though those values have meaning. But to be honest, from the recent reveals about say, corporate sanctioned sexual harassments at Google, it's clear that when given a choice between a good business model and ethics, choose the good business model if you want to be "built to last."

The rest of the book consists of platitudes such as "turn the flywheel", and make sure you surround yourself with honest people:

You need at least a few people around you who aren’t afraid of you and who aren’t concerned with politics. This is where detached and objective outsiders (consultants and directors) are invaluable. You also need honest people inside—people who are so honest and direct they are almost uncomfortable to have around. You don’t have to like them. You just need to listen to them. (kindle loc. 3295)

But the book doesn't tell you how to do that either.

I'm much reminded of the fantastic interview with Jim Keller when he says:

IC: I think I remember you saying that before you went into your big first management role, you read 20 books about management techniques, and how you ended up realizing that you'd read 19 more than anybody else.

JK: Yeah, pretty much. I actually contacted Venkat (Venkatesh) Rao, who's famous for the Ribbonfarm blog and a few other things to figure [stuff] out. I really liked his thinking about organization from his blog, and he had a little thing at the bottom where it says to click here to buy him a cup of coffee, or get a consulting or a consult, so I sent him an email. So we started yakking, and we spent a lot of time talking before I joined AMD. He said I should read these books and I did. I thought everybody who’s in a big management job did that, but nobody does. You know it was hilarious - like 19 is generous. I read 20 more management books than most managers have ever read. Or they read some superficial thing like Good to Great, which has some nice stories in it, but it's not that deep a book management-wise. You'd be better off reading Carl Jung than Good to Great if you want to understand management.

There you go. The reason to read a ton of management books is that you need to get exposed to lots of different viewpoints, no matter how bad most of them are, before you can make any decent amount of generalizations. This book by itself won't make you great.

 

Monday, October 11, 2021

Review: Numbers Don't Lie

  Numbers Don't Lie was something recommended by a Bill Gates newsletter. The praise was effusive, and I like numbers so I checked it out of the library. The book reads like a series of blog posts, each topic being short and covering a short topic, and if you read them separately you might not notice anything odd.

But I read it over a series of just a few days, and one thing really jumped out, which is Smil's anti-environment agenda. For instance, he would take the time to talk about how impractical electrical power was for container ships, which pretty much require diesel fuel to cross oceans. But he would ignore the obvious big picture story, which is that reorganizing the global economy to be less carbon intensive would imply placing a carbon tax high enough to make the need for such large container ships less necessary: instead of shipping things on giant containers across the ocean, you might use rail transport instead and make more things locally, which is actually more resilient than outsourcing everything to China anyway, as the recent pandemic showed.

Don't get me wrong. His facts and numbers aren't wrong. For instance:

For every dollar invested in vaccination, $16 is expected to be saved in healthcare costs and the lost wages and lost productivity caused by illness and death. (Kindle Loc 308)

in just the last two years the country [China] emplaced more cement (about 4.7 billion tons) than the US did cumulatively throughout the entire 20th century (about 4.6 billion tons)! (Kindle Loc 2531)

But while numbers don't lie, providing numbers without surrounding context and interpretation is a form of insidious lying. By all. means read this book, but be very very wary about the implications Vaclav Smil wants to provide of the facts in this book, many of which are deliberately out of context and anti-environmental.

Thursday, October 07, 2021

Review: Horizon Zero Dawn

 Horizon Zero Dawn came with really good reviews. It is, however, one of those cases where the gaming press preferences run pretty counter to my own. The game's setting is a post-apocalyptic Earth where robot dinosaurs roam the earth and your player character finds a bluetooth headset early on that allows her to augment reality sufficiently to detect weak spots, examine their programs, and eventually gathers the weapons necessary to attack, takeover, or ride them.

I dutifully played the game on normal difficulty for a while, and did actually a large number of quests and got through 2/3rds of the game when for whatever reason I had to put it down for a while. I didn't start playing again until after I'd gotten a PS5, but had forgotten how to play. It was too difficult to play on normal after such a break, so I turned down the difficulty to story mode and just kept plowing through the quests to get to the finish.

What I've discovered is that the game's combat systems are way too intricate: you have only 4 weapon slots but you have more weapons than you can use in those 4 slots. Add to that the game's dinosaurs have a lot of different weaknesses, etc., so you're forever scrounging supplies so you can craft the right ammo to take them down. Even in story mode I'd run out of blaze canisters, until I discovered one day that the rewards from quests were in "treasure chests" sort of like loot boxes that you can open to extract the contents, and those actually have blaze canisters in some of them. Still, I ended up having to find a merchant to get enough so I couldn't run out.

The art for the game is gorgeous, and the story is decent. But the quests are kinda one-note, without the story telling in say, The Witcher 3, with its plot twists and misdirection. By the time I finished the game I understood the story but was not in a hurry to listen to any of the audio clips. I finished the game out of obligation but did not feel obliged the pursue the DLC. I guess I'm not going to be first in line when the sequel comes out later this year.

Monday, October 04, 2021

Review: Red Comet - The Short Life and Blazing Art of Sylvia Plath

 I've actually never read anything by Sylvia Plath, but her name kept coming up over and over again in various contexts, mostly non-fictional, as someone who was brilliant and depressed, or who was an example of how when you took away an easy means of suicide, people stopped actually committing suicide. So when I saw that Red Comet was easily checked out of the library as an ebook I gave it a shot.

The book turned out to be huge, taking more than 1000 pages and taking me more than 3 weeks to finish. For me, it was compelling reading because I knew the ending --- which had been documented in so many places that it wasn't a spoiler. Secondly, it was a fascinating look at a woman who defied convention, set the course of her life, got everything she wanted, yet discovered that she could not hold on to it, which eventually wrecked her.

The thing is, Plath isn't a likable person (at least, not to me). Sure, she was brilliant from childhood, winning poetry prizes and writing prizes, and becoming a nationally published author by the time she got to college. And far from the stereotype of the unsocial, introverted writer, she got around, getting tons of dates despite getting matched by her mother (her father passed away while he was young, from untreated diabetes). Her depression, however, plagued her even from when she was young:

Sylvia was compassionate toward others but bore herself little mercy. She often mistook her depression for weak-willed complaint. How could she feel so terrible when thousands of girls would give anything to switch places with her? Didn’t she realize how lucky she was? What did she possibly have to complain about? Her self-contempt fed her depression in an unrelenting circle of anguish that continued to baffle her. “I have much to live for,” she wrote in her journal that winter, “yet unaccountably I am sick and sad.” (pg. 160)

Despite this, she was a high functioning person until she got what she wanted, a prized position at a major magazine in New York City as a summer intern. She discovered, much like many software engineers who joined major tech companies only to discover that the reality is that both major tech companies and literary women's magazines are essentially giant vehicles to deliver ads:

 Nearly all of the bulky, 380-page August 1953 issue of Mademoiselle, which Plath edited that June, comprised fashion ads or fashion photo shoots featuring thin white women (pg. 240)

The result clash between her expectations and the reality of New York City led her to her first major episode of depression and attempted suicide, followed by an even more mentally and emotionally recovery in a mental hospital, where the  ECT therapy of that time was not very well managed and led to her horror of psychiatric hospitals for the rest of her life, which you could blame for her eventual suicide.

Fast forward to her post-graduate Fullbright scholarship to Cambridge, she had already articulated her goals: (1) to make money as a writer/poet, determining her fate, (2) to marry someone and have children, but that person had to be supportive of her career, and help out enough that she could achieve (1). She eschewed the doctor her mother had matched her up with, since a square, socially conservative doctor in a upper middle class lifestyle would dictate that she would spend all her time dealing with family instead of writing, and searched for wilder, more bohemian types who would presumably be less concerned with the social strictures of that time. She found Ted Hughes.

Her wedding was meant to be a surprise “gift” to Aurelia, but in fact it was Sylvia’s checkmate. Ted knew he was the antithesis of the all-American Wellesley boys Aurelia had quietly encouraged her daughter to marry. He described himself that day as “the Swineherd / Stealing this daughter’s pedigree dreams / From under her watchtowered searchlit future.”163 He was not wrong. Ted’s joblessness worried Aurelia and would remain a source of grievance for years to come. She did not trust him to care properly for her daughter, who was more vulnerable than he knew. (pg. 448)

Hughes was her equal in literary achievements, and the book is very sympathetic to him during the early phase of their marriage. The author (Heather Clark) never failed to point out that he was very active in child rearing, dealing with their first daughter in the morning so she could write, and then swapping places with her so he could write. They even shared writing studies, "hot-desking". In return, she applied her considerable promotion talents to helping him get noticed, published, and win awards. 

Ted had “commissioned” her his “official agent,” she joked, but it was true; he would owe his career to her. She typed Hughes’s poems in Whitstead’s sunny backyard as he sat beside her, revising his now famous poem “The Jaguar.” She felt his work was, like him, “fierce, disciplined with a straight honest saying,” and predicted that “the world will be a different place” once he began publishing.134 (pg. 444)

Here's the thing, once Hughes became successful (and the social strictures of the day meant that he had an easier time being recognized than she did), she started facing the flip side of that success.

Sylvia “wasn’t at ease” with Ted’s BBC work, she said, because “there were a lot of women at the BBC, and those were the kind of women who went to bed.” They had a “loose” reputation at the time, she said, though such a claim sounds sexist now. Plath was married to the most famous young poet in England. “She was not crazy,” Suzette said, to think that a successful BBC producer might find Ted attractive—or he her—while Sylvia folded diapers.  (pg. 633)

When the inevitable happened (remember, she'd deliberately picked a husband who would not be bound by social strictures!),  the fall was quick. Even here she wouldn't blame Hughes, but instead blame the other women he'd had affairs with.

fame gave Hughes sexual and professional opportunities to expand at exactly the time Plath wanted him, as he saw it, to contract—to settle into a predictable, domestic life. Plath had suggested as much when she told Dr. Beuscher that movie stars had nothing on handsome male poets. (pg. 753)

OK, I mentioned that I didn't like Plath as a person. Here's why: all through her life, she'd received enormous financial support from her mother, who was making money doing as many as two jobs at once, allowing Plath to live a life on her own terms --- she'd had a teaching position at Smith at one point but gave it up because it interfered with her writing --- and this was before she had kids! But she would be harsh and mean to her. Near the end of her life, she finally realized:

Plath told friends she did not want to raise two children on her own as her widowed mother had. She was appalled that, for all her efforts to live a different kind of life, she had ended up in the very same situation as Aurelia, but worse—rejected, unemployed, far away from friends and family. (pg. 858)

This was in the 1950s and 60s, when it was possible for a single woman in America to make good enough money to support her adult daughter, and when magazines paid so much that a top notch poet could almost make a living wage. Plath lived in England, where healthcare costs were covered by the state. Hughes and her were at the top of the field. Hughes had frequent BBC productions that paid well, as did Plath. But if you contrasted her approach with Stephen King's where he and his wife taught school while writing novels on the side, you realized that she was taking giant risks, and her social safety net (her mother and Olive Higgins Prouty) was what allowed her to frequently live beyond her means. (And yes, she did resent Hughes turning down money-paying positions because he, like her, never wanted to feel that he was working for a living)

If you treated this biography as a novel, the lesson would probably be: "Be careful what you ask for, because you might get it." I thought the book was overlong, and it felt like Heather Clark quoted way more from Hughes than she did from Plath, but it was definitely compelling reading.

“Fame will come. Fame especially for you. Fame cannot be avoided. And when it comes You will have paid for it with your happiness, Your husband and your life.” (pg. 475)