Book Review – A Philosophy of Software Design by John Ousterhout

“A Philosophy of Software Design” by John Ousterhout is a short and thought-provoking book about practical software development.

Key Concept

The book starts with a bold claim – the most critical job of a software engineer is to reduce and manage complexity.

Mr. Ousterhout defines complexity as “anything related to the structure of a software system that makes it hard to understand and modify the system.”

This definition serves as a motivating principle for the book. The author explores where complexity comes from and how to reduce it in a series of short chapters, which often include real-world code examples.

My well-thumbed copy of the book

Summary

The book starts with identifying the symptoms of complexity:

  1. The difficulty in making seemingly simple changes to a system.
  2. Increasing cognitive load – i.e., a developer’s ability to understand a system’s behavior.
  3. The presence of “Unknown unknowns” – undocumented and non-obvious behavior.

Mr. Ousterhout states that there are two leading causes of complexity in a software system:

  1. Dependencies – A given piece of code cannot be understood or modified in isolation
  2. Obscurity – When vital information is not apparent. Obscurity arises due to a need for more consistency in how the code is written and missing documentation.

To reduce complexity, a developer must focus not only on writing correct code (“Tactical Programming”) but also invest time to produce clean designs, and effective comments and fix problems as they arise (“Strategic Programming”).

The book provides several actionable approaches to reducing complexity.

Some highlights:

  • Modular design can help encapsulate complexity, freeing developers to focus on one problem at a time. It is more important for a module to have a simple interface than a simple implementation.
  • Prevent information leakage between modules and write specialized code that implements specific features (once!).
  • Functions (or modules) should be deep – and developers should prioritize sound design over writing short and easy-to-read functions.
  • Consider multiple options when faced with a design decision. Exploring non-obvious solutions before implementing them could result in more performant and less complex code.
  • Writing comments should be part of the design process, and developers should use comments to describe things that are not obvious from the code.

The book concludes with a discussion of trends in software development, including agile development, test-driven development, and object-oriented programming.

Conclusion

“A Philosophy of Software Design” is an opinionated and focused book. It provides a clear view of the challenges of writing good code, which I found valuable.

Mr. Ousterhout provides actionable advice for novice and experienced developers by focusing on code, comments, and modules.

However, the book is also relatively low-level. The book contains little discussion around system design, distributed systems, or effective communication (outside of good code and effective comments).

While books such as “The Pragmatic Programmer” provide a more rounded approach to software engineering, I admire that Mr. Ousterhout sticks to the core concepts in his book.

The Psychology of Money – Morgan Housel

The Psychology of Money

I read Morgan Housel’s “The Psychology of Money” towards the end of last year. I found it an insightful book that took a more personal and nuanced look at money and building wealth. It is not a “how to get rich quick book.” 
Its core advice is to take advantage of compounding and take a reasonable approach to risk — hardly rocket science. However, it explores some of the more common pitfalls and anti-patterns when people think of money. 
While I would strongly recommend everyone to read the book — it is fantastic, here is a quick summary of my notes from reading (and enjoying) the book. I hope you find it helpful!


A more personal view of money

People think of money as an abstract. We think about and are taught about money like we are taught physics. We assume that money is governed by rules and laws. Yet, psychology, with its study of emotions and nuance, may offer a better way to think about money.

Most people make financial decisions by taking the information that they have access to and plugging it into their mental model of how the world works. But these mental models are driven profoundly by personal experience.

Mr. Housel’s book takes a personal and intimate approach to understand how money works and illuminates some of the difficulties we face when making money decisions.


How to get rich and stay rich

Compound growth is the key to growing wealth. There is plenty of material available that describes viable strategies for becoming wealthy. However, Mr. Housel states that there is only one way to stay wealthy — “some combination of frugality and paranoia.”

If one can stick around for a long time without wiping out or being forced to give up, the power of compounding comes into play and helps generate wealth.

The key to a successful investment strategy is to not risk what you have and need for what you don’t have and don’t need.


The importance of sensible optimism

Successful investors take an optimistic view that, in the long run, the odds are in their favor, and over time things will balance out to a good outcome even if what happens in between is filled with misery.

But the optimism must be balanced with a healthy dose of paranoia. This means accepting nuance and understanding that the key to exploiting long-term optimism is survival.

It is critical not to get swept up in short-term momentum or get giddy about short-term gains or losses. The most effective long-term strategy is to not get overly influenced by short-term events.


Understanding wealth

When most people think about becoming a millionaire, they think of the ability to spend a million dollars. However, the true meaning of wealth is the ability to deploy money towards living a life that lets you do what you want, when you want, with who you want, where you want, for as long as you want. So, true wealth is financial assets that haven’t yet been converted into consumption.

The ability to save is also critical to building wealth. Savings are a hedge against life’s inevitable ability to surprise the hell out of you at the worst possible moment. The most potent way of increasing savings is not to raise your income but to raise your humility.


Making reasonable financial decisions

Financial decisions making is thought of as making coldly rational decisions in the light of available information and knowledge of the past. However, history is primarily the study of unanticipated events.

Therefore, relying on history as an unassailable guide to the future is risky. It is important to consider the past but to look at it in terms of generalities.

So, one must not be overly influenced by history and take a reasonable and pragmatic approach when making financial decisions. Having savings gives a buffer to absorb short-term volatility. Having a realistic and flexible approach to financial decisions makes it likely to stick with your investment strategy in the long run.


The role of skill and of luck

Money constantly changes returns. If an asset has momentum, a group of short-term traders will assume it will keep moving up. We have seen this play out in recent times with the GameStop saga.

It is not an unreasonable strategy for the short term. Executing such short term strategy doesn’t really require much skill but does need some luck in timing the strategy just right. Plenty of traders both lost and made huge amounts of money trying to time their GameStop trade. It was all about momentum.

The mistake we are susceptible to is focusing solely on what we want to do and have the ability to do. We ignore the plans and skills of others whose decisions might affect our outcomes. We also focus too much on the causal role of skill and neglect the role of luck. This makes us overly confident in our beliefs.

Books of 2016

I had a target of reading 50 books in 2016. I didn’t quite manage to make it. I managed to only read 24. A dismal performance indeed. I read a couple of wonderful books and discovered some great new writers. I also managed to break out (well a little bit) from the cozy comforts of science fiction.

Perhaps I will make 50 in 2017!

BEST BOOK READ IN 2016

Paul Kalanithi’s memoir “When Breath Becomes Air” is lyrical, inspiring and heart breaking. Without a doubt the best book I read last year.

FICTION

I loved “Death’s End“, the epic, satisfying conclusion to the “Three Body Problem” trilogy by Cixin Liu.

Kenneth Liu’s short story collection “The Paper Menagerie” is excellent. You can read the titular story here.

NON-FICTION

Katherine Boo’s “Behind the Beautiful Forevers: Life, Death, and Hope in a Mumbai Undercity” is an unflinching, honest account of a year spent in a Mumbai slum.

Jacky Vance’s “Hillbilly Elegy: A Memoir of a Family and Culture in Crisis” is a memoir of growing up poor and white in the midwest. It made me think again about the assumptions I made about American politics.

DISAPPOINTMENTS

I disliked the much hyped “Chaos Monkeys: Obscene Fortune and Random Failure in Silicon Valley” by Antonio Garcia Martinez. The author’s overblown, sarcastic style really put me off an otherwise fascinating topic (for me).

HONORABLE MENTIONS

I enjoyed Neil Stephenson’s “Seveneves” and Alistair Reynolds’ “Revenger“. Both excellent science fiction books.

 

Review: Death’s End by Cixin Liu

Death's End (Remembrance of Earth’s Past, #3)Death’s End by Liu Cixin
My rating: 5 of 5 stars

Death’s End is the final instalment in Cixin Liu’s “Three Body Problem” series. I read a lot of science fiction and I am not exaggerating when I say that this series is amongst the best I have read.

The scope, scale and ambition of Mr. Liu’s work is such that even writing a review for his books feels like a daunting task. So I am not going to bother, and am just happy to be a giddy fan boy.

The Three Body Problem series deals with the Fermi Paradox; more broadly, it is a meditation on what it means to be human and our place in a huge and uncaring universe. The books take us from revolutionary China to the far, far future. Mr. Liu (and his translators) blend Chinese culture and truly mind bending science to create an intoxicating world that I have enjoyed being immersed in and thinking about.

Death’s End stands alone as a great book and it is a brilliant conclusion to the Three Body problem series. Cixin Liu has sold millions of books in China and his reputation as a science fiction superstar is justified. Ken Liu (The Three Body Problem and Death’s End) and Joel Martinson (The Dark Forest) have done sterling work translating his books for a wider audience. Don’t wait, pick up The Three Body problem and be prepared to be blown away.

** The trilogy is called “Remembrance of Earth’s Past”. Apparently in China the series is better knows as the Three Body Problem series, and I think that makes more sense to me. So I refer to it as Three Body Problem..

View all my reviews

Review: Ninefox Gambit by Yoon Ha Lee

Ninefox Gambit (The Machineries of Empire, #1)Ninefox Gambit by Yoon Ha Lee
My rating: 4 of 5 stars

I read a lot of science fiction. I find reading science fiction diverting, stimulating and usually a lot of fun. I finish most books in three to five days depending on my schedule and what else is going on in my life. I struggled with Ninefox Gambit. It took me 3 weeks to finally finish it. I abandon books if I am not having fun after two or three sittings. I am glad I didn’t give up on Ninefox Gambit.

We are thrown right in the deep end at the beginning of Ninefox Gambit. Cheris is a soldier and a gifted mathematician. She serves the Hexarchate; six factions or guilds that govern her part of the universe. Each faction is responsible for a facet of life within the Hexarchate. Cheris is a part of the Kel, the military faction. Ninefox Gambit starts with Cheris involved in a bloody skirmish. We get some idea of how combat works in the Hexarchate. Kel soldiers are able to use exotic weapons by deploying in a formation that uses the effects of the Hexarchate “calendar”.

I know. I was baffled too. We get given no indication of what the calendar is or how a formation works. I knew there was something important going on, but I felt too lost to be able to follow what was happening.

I put away my Kindle and picked up another book. Yet, I kept thinking of Cheris and the world of Ninefox Gambit. So I picked up where I had left off and powered through. I am glad I did, because we are swiftly introduced to General Shuos Jedao – disembodied, disgraced and quite possibly insane. Jedao is immortal and imprisoned by the Kel hierarchy after causing a brutal massacre 400 years ago. He may or may not be crazy but is a brilliant military tactician and is used by the Kel when his expertise is required.

An important world (the wonderfully named Fortress of Scattered Needles), is taken by heretics who install their own calendar in rebellion against the doctrines of the Hexarchate. The Fortress is protected by unassailable defences and lies in a strategic sector. Cheris is chosen as Jedao’s anchor – together they command the Hexarchate’s forces as they attempt to subdue the rebellion and retake the fortress.

We get to learn a lot more about the world through conversations between Cheris and Jedao as well as short vignettes from other characters caught up in the action. There are plots within plots and a lot of political intrigue. There are games with exotic rules and flashbacks to Jedao’s life and the events that led up to his immortality and imprisoning. There is also violence, and lots of blood and gore.

At times, Ninefox Gambit reads like conventional military science fiction. Exotic weapons (deadly fungus anyone?), spies and shouty sergeants. Yet, all of this action makes sense in the context of the structure of the Hexarchate. The world is governed through a combination of indoctrination and brute strength. Cheris and Jedao are the tip of the spear that is intended to destroy the rebels.

If you are still with me, you probably know that Ninefox Gambit relies on the reader being somewhat familiar with the tropes of science fiction and fantasy. I (and other readers on Goodreads) were reminded of Anne Leckie’s Imperial Radch trilogy. There are similarities – we have an unreliable narrator in Cheris and a brutal regime attempting to suppress a rebellion. Just like the Radch trilogy, Ninefox Gambit is deeper and a lot more interesting than your run of the mill military science fiction.

Yoon Ha Lee has built a compelling, and challenging, universe – one that I hope will be explored in further volumes in the “Machineries of Empire” series.

View all my reviews

Review: Revenger by Alastair Reynolds

RevengerRevenger by Alastair Reynolds
My rating: 4 of 5 stars

Review based on a copy sent to me by NetGalley

Revenger appears to be the first instalment in an intriguing new science fiction series by Alastair Reynolds. This fast paced, character driven novel is an enjoyable departure from the dense, exposition-heavy space opera that Alastair Reynolds has been writing for the last 20 years.

We follow the story of Arafura Ness, a teenager with a sheltered life and a love of books as she ventures out from her father’s home in search of adventure with her more outgoing (and reckless) older sister Adrana.

Arafura comes from Mazarile, one of thousands of planetoids and habitats in a ruined Solar System that has seen multiple civilisations come and go. The economy is based on finding and exploiting artefacts from previous, more advanced civilisations. We have space ships with salty, and cynical crews sailing solar winds, exploring abandoned habitats looking for treasure. Arafura and Adrana start their adventure in one of these ships. Things go awry pretty quickly and the sisters are separated. The main plot of the book follows Arafura as she attempts to find her sister.

We get many hints to the shape and structure of the universe of Revenger. However, the book is written from the point of view of a teenager coming to grips with a chaotic and violent world and there are no dull expository passages.

There are a few other characters: mainly crew mates of Arafura and Adrana, but the story is very much Arafura’s. The dialogue can be a bit awkward at times, but I enjoyed following Arafura’s journey. The story builds to a violent and bloody climax. I didn’t find the violence gratuitous and it made sense in context of the plot and the wider world of Revenger.

Fans of Alastair Reynold’s work will find much to enjoy here: a strong female character, strong action scenes and a fantastic world to explore. The book has also been clearly written to attract readers of the burgeoning “Young Adult Fiction” genre, and I think it will be a great read for those readers who are looking for more science in their YA fiction.

View all my reviews

Buy Revenger from Amazon (affiliate link):

Review: Oryx and Crake by Margaret Atwood

Oryx and Crake (MaddAddam, #1)Oryx and Crake by Margaret Atwood
My rating: 3 of 5 stars

“Oryx and Crake” is a beautifully written book set in a dystopian future where genetic engineering has gone wrong.

The book follows two plot lines. “Snowman” finds himself alone; slowly starving to death and doubting his sanity in a world that has been devastated by plague. His days are spent scavenging and hiding from mutant pigs (“pigoons”) and nasty wolf / dog hybrids (“wolvogs”). There are also the “Crakers”, gentle, genetically engineered humans that seem to be designed for this post-apocalyptic world. The Crakers see Snowman as a sort of mentor. We find more about Snowman’s relationship with the Crakers as the book progresses.

The second plot strand is set in the past. This is before the plague when Snowman was known as Jimmy. Corporations run fabulously appointed enclaves (called Compounds). Jimmy grows up in one of these compounds, alienated from his scientist father and coming to terms with being abandoned by his mother. The world outside the compounds, the “pleeblands”, is rife with poverty, crime and those people who are not lucky enough to work for one of the compounds.

Jimmy meets Crake, a strange and brilliant teenager while in high school. We follow their lives through to adulthood. The world, as described by Ms. Atwood, is teetering on the brink. Almost everything is available for sale, and the Compounds follow some ethically and morally questionable business practices. We come to understand how Snowman’s world came about. We also meet Oryx, a woman who both Jimmy and Crake fall for and who has a compelling and tragic story herself.

“Oryx and Crake” is the first installment of the “MaddAdam” trilogy. While I enjoyed reading the book and marvelled at Ms. Atwood’s writing; it was clear that Ms. Atwood does not approve of genetic engineering and does not hold the capitalistic motive in high regard. This results in a slightly laboured and cynical book. I might change my mind after reading the other two books in the MaddAdam trilogy. But for now, “Oryx and Crake” gets an average rating.

View all my reviews

Buy Oryx and Crake from Amazon (affiliate link):

Review: When Breath Becomes Air by Paul Kalanithi

When Breath Becomes AirWhen Breath Becomes Air by Paul Kalanithi
My rating: 5 of 5 stars

What gives life meaning?

Is it love, faith and family or is it making a difference, striving to make the most of one’s talents in the time on hand. These questions loom large in Dr. Paul Kalanithi’s memoir When Breath Becomes Air.

At thirty-six, Paul was the chief resident in neurosurgery at Stanford. He held degrees in literature and in the history and philosophy of medicine. He was about to graduate to become a neurosurgeon and neuroscientist when he was diagnosed with an aggressive form of cancer.

When Breath Becomes Air is written in two parts. The first part describes why Paul decided to become a neurosurgeon while the second part describes his transition from being a doctor to a patient as his health deteriorated.

Paul was a second generation immigrant, his parents were Indian doctors and he spent his formative years in a sun-kissed (and rattlesnake infested) town in Arizona. His mother, despairing at the state of the local school system, had Paul and his brothers read widely – a story familiar to many second generation immigrants. This led to a love of literature that stayed with Paul throughout his life and has a major influence on this memoir.

At Stanford, Paul majored in English literature and Biology.

“I was driven less by achievement than by trying to understand, in earnest: What makes human life meaningful? I still felt literature provided the best account of life of the mind, while neuroscience laid down the most elegant rules of the brain.”

Frustrated with academia, Paul turned to medicine. He specialised in neurosurgery, an especially challenging field. Paul describes the pressure of being a neurosurgeon – the hours are long and the pace unrelenting; an incision off by a few millimetres could lead to “locked-in” syndrome.

Paul loved his job and it’s attendant challenges. He struggles with his perceived lack of empathy and describes how the challenges of his job strained his marriage. He describes, in elegant prose, a doctor’s role in helping those who are facing horrendous decisions.

“We had assumed an onerous yoke, that of mortal responsibility. Our patient’s lives and identities may be in our hands, yet death always wins.”

Paul’s career and plans for the future – a career as a neurosurgeon and neuroscientist; having a family and financial stability were all put on hold by the diagnosis of terminal cancer. He lost weight, and as his health deteriorated, he was put on a variety of medical and physical therapies.

A new biological treatment led to some improvement and allowed Paul to go back to work. He was back in the operating theatre following intensive and painful physical therapy. He and his wife Lucy decided to have a child. When asked whether having a child would make his death more painful, “Wouldn’t that be great?”

Paul suffered a remission, and, in the end, had no choice but to give up work and attempt more aggressive treatments.

In the final, moving, pages of When Breath Becomes Air – Paul knew time was running out,

“Everyone succumbs to finitude.. Most ambitions are either achieved or abandoned; either way, they belong to the past. The future, instead of the ladder towards the goals of life, flattens out to a perpetual present.”

The book finishes with Paul spending time with his daughter Caddy and wondering what she would make of her absent father.

Lucy Kalanithi, in a moving epilogue to Paul’s memoir, describes Paul’s final days. We find out that the book is unfinished – Paul’s health deteriorated too fast for him to complete When Breath Becomes Air. Yet, we also hear about his drive to finish the book; struggling to find the right words through a fog of drugs and pain.

I was in tears when I finished the book. I suspect most people would be.

As a young man, Paul found meaning in literature, as a doctor in helping and healing his patients, and finally, as a dying man, he found meaning in spending time with his infant daughter, his family and in God. What I found were humanity and inspiration.

View all my reviews

Buy When Breath Becomes Air from Amazon (affiliate link):

Review: Mr. Mercedes by Stephen King

Mr Mercedes (Bill Hodges Trilogy, #1)Mr Mercedes by Stephen King
My rating: 3 of 5 stars

Mr. Mercedes by Stephen King starts off with a horrendous crime. A man drives a large Mercedes into a group of people waiting to go into a jobs fair. It is an effective, if gruesome start to our story. There are two main POV characters. We spend time with Bill Hodges, a decorated police detective, now retired and slowly going to seed. We also get to know, perhaps a bit too well, the Mr. Mercedes from the title. He is a man with issues, a freudian delight. The two, protagonists, linked by the crime from the opening chapter, taunt, circle and torture each other throughout the book.

There isn’t any mystery as such. We know exactly who the killer is. The book is about the thrill of the game of cat and mouse that Bill and Mr. Mercedes play. It is difficult to tell who exactly is who is the hunter and who is the hunted – and this is the joy of the book. We are joined by a number of other characters. Bill is assisted by his neighbour Jerome, a precocious and talented teenager and Holly, a brilliant, if neurotic woman with a link to the original crime.

The plot moves along nicely, with the tension building to an explosive finale.

So why the three stars?

If I were to compare Mr. Mercedes to a restaurant, it would be Pizza Express. You know exactly what you will get as soon as you enter the door. The experience is predictable, but enjoyable and is good value. Faint praise perhaps – but this is not a challenging book. It is enjoyable, and I found it hard to put it down, but I doubt it will stay with me for any longer than a Pizza Express meal does.

What I liked:
– The setting: The book is set in an unnamed mid-western town at the tail end of the Great Recession. Jobs are scarce, and people work multiple jobs to make ends meet
– The pace: Things move fast in this book. The book covers events in a two week period, and a lot of stuff happens!
– The humour: Stephen King has always a been a funny writer. Even in this vanilla thriller, there are nuggets of comedy that made me laugh out load.

What I didn’t like:
– The characters: The bad guy is a cliche – a loner with mommy issues and technical skills. Each character has problems. Vivacious divorcee – check; precocious minority teenager – check; Neurotic middle aged woman with mental problems – triple check!
– The plot: Things happen (death, love, murder) very quickly and characters make decisions that do not make sense given what we know about them.

Mr. Mercedes is the first of the “Bill Hodges” trilogy, with “Finders Keepers” the second and a third in the pipeline.

View all my reviews

Buy Mr. Mercedes from Amazon (affiliate link):

Review: The Long Way to a Small, Angry Planet by Becky Chambers

The Long Way to a Small, Angry PlanetThe Long Way to a Small, Angry Planet by Becky Chambers
My rating: 4 of 5 stars

I read “The Long Way to a Small, Angry Planet” (TLW) in one sitting on a long flight. At the time, it felt like a particularly enjoyable story arc from Star Trek TNG or perhaps a binge session of Firefly. A week or so later, I keep thinking about the book, about the characters and about the patched up freighter and far flung moons with their plucky and weird colonists that inhabit TLW.

After the first chapter, I thought the book would centre around Rosemary and her journey from desperate runaway to some sort of ass kicking space warrior-scribe. I was wrong. The book is not just about Rosemary but about the entire crew of the Wayfarer and there is little in the way of ass-kicking. The pacifist captain, the rambunctious techs, mysterious navigator(s) and all the other colourful (literally in a few cases) characters that inhabit TLW have depth and agency.

The plot revolves around a long journey undertaken by the Wayfarer, a sort of space highway construction ship, to the Small Angry Planet of the title. Along the way, we visit markets, colonies, and planets while getting to know the crew and how the universe of the book works. The structure of the book may be conventional, yet it has a lot of say about gender, identity, violence and coming to term with one’s past. TLW is open about its politics: the captain of the Wayfarer is a pacifist, the doctor comes from a species that chose voluntary extinction after a decades of brutal warfare, and my favourite character has to consciously tone down her affection for her human crew mates because we are so weird about public displays of affection. Even the most curmudgeonly character has redeeming features.

TLW may not seem appealing if you like your science fiction to be of the military variety, or if you are a fan of hard science fiction from the likes of Alistair Reynolds. It certainly is different to the usual science fiction books I read, but I found it rewarding. Ms. Chambers clearly cares deeply about the Universe and the characters she has created. There is none of the nihilism and little of the violence that can be off putting about a lot of modern science fiction. TLW is character driven and while there are a few expository data dumps, things never get tedious.

I look forward to more books by Ms. Chambers and am glad that she is currently working on a companion piece that is set in the same Universe as TLW. A strong recommend from me.

View all my reviews

Buy The Long Way to a Small, Angry Planet from Amazon (affiliate link):