Book of the Week 13: The Pragmatic Programmer

This week I’ll be covering a topic in the engineering field: the non-technical aspect of the technical field. As this is a topic that’s rarely covered (that doesn’t involve everyday soft skills such as communication and time management), I’m excited to share my review of this exclusive book.


4099Rating: 5/5

Verdict: A non-technical, technical book in software engineering; rarely done let alone rarely done well, but this book does it. Best audience is for professionals who have just started out in their career.

Having worked in the industry for a year now, I feel like now or a few months earlier would have been the perfect time to tackle this book. Andrew Hunt covers many topics that may be – or should be – commonplace to the experienced engineer, including orthogonality, design by contract, and software entropy. Despite the topics being rather introductory, I do see most of my coworkers breaking such practices, even those with over a decade of experience, so there is definitely merit in skimming through this book no matter your skill level.

In addition, despite the topics being introductory, I would suggest against reading this book if you are not yet in the work force (which includes internships). I feel that personally, having my current project in mind when reading each principle gave me a concrete image of these abstract ideas, making them easier to remember.

This book may leave you thinking “I already know all of this!” Everything is rather familiar. However, even though you may know it all, do you actually follow all the practices regularly? Most likely the answer is no, but EVEN IF the answer were yes, reading this book helps you as an experienced programmer gain perspective (see my earlier review Made to Stick and the Curse of Knowledge) of those newer to the industry. Use your knowledge to help those around you!

 

As usual, I’ll break up the contents by their chapters, briefly explaining the concepts from each section.

A Pragmatic Philosophy

Hunt’s definition of a “pragmatic programmer” is actually rather simple and self-explanatory, really, the things you hear everyday even outside the engineering world. Regardless, before anything else, a pragmatic programmer shall keep the following in mind above all else:

  • Take responsibility for your code. This isn’t high school.
  • Software entropy: Don’t neglect bad decisions (code, design, etc); stay on top of everything. The later you tackle problems, the faster they build up and the more difficult it becomes to clean things up.
  • Be a catalyst for change. Set an example.
  • Don’t just focus on your task; remember the big picture.
  • Always be learning. Diversify your “knowledge portfolio.” At work, take advantage of the project and work environment as much as possible. Outside of work, invest in reading books (both technical and non-technical), learn a new computer language etc.
  • Communication is, as always, key.

A Pragmatic Approach

Hunt now starts diving into the code by introducing several principles to keep in mind:

  • DRY principle: Don’t Repeat Yourself.
  • Orthogonality: Keep sections independent and decoupled (Hunt doesn’t mention this, but essentially the S in the SOLID principle). This doesn’t apply to only code.
  • Code with reversibility and flexibility in mind.
  • Iterate quickly and often.
  • Prototype to learn.
  • Learn how to estimate; iterate on estimating with the code.

The Basic Tools

Many beginners overlook the power of the tools provided to them. IDEs, debuggers, etc. Hunt enlightens the reader with the benefits of investing a little time for learning tools to increase their productivity tenfold:

  • Learn the strengths of using plain text such as XML.
  • Learn the strengths of the command shell.
  • Specialize in a single editor and learn as much as you can about it.
  • Always use source control. Not only in code.
  • Learn how to debug: fix the problem, not the blame. Be able to explain the problem to someone else – “rubber ducking.” Don’t assume anything – prove everything.
  • Learn the strengths of text manipulation languages.
  • Write code that writes code.

Pragmatic Paranoia

Hunt extensively preaches to code defensively. Code in defense against your own mistakes. Assume that the next person reading your code – even if it’s yourself – knows nothing.

  • Design with contracts: understand preconditions, postconditions, and class invariants, and design them before you tackle the code.
  • If the program breaks the contract, make the program crash early. The later the program crashes, the more potential bugs you may need to sift through, and the more the program may be working in an invalid state.
  • Use exceptions for exceptional cases. Remember that exceptions are expensive.
  • Finish what you start. Remember to deallocate when necessary.

Bend, or Break

The project must be as flexible as possible, or else it won’t survive in the long run. Hunt explains concepts on just how to do this, extending upon his concept of orthogonality and decoupled code from “A Pragmatic Approach”:

  • Make as much of the program configurable as you can, from screen sizes to algorithms.
  • Put abstractions in code. Keep details in metadata. Metadata keeps the program flexible.
  • Always design for concurrency. Keep linear thinking to a minimum, and keep in mind how to maximize parallelism.
  • Separate views (the displaying of data) from models (the data itself).

While You Are Coding

This section finally dives directly into code implementation, whereas all the previous sections were more abstract ideas to take into consideration:

  • Recognize when a program is implemented by coincidence. Program deliberately (with an understanding of all requirements, with a full design in mind, with no assumptions – but if you do make assumptions, document and test them).
  • Understand the basics of Big-O notation. Estimations will take you far.
  • Don’t hesitate to refactor. Refactor early, and refactor often. If any of the principles in this book are violated, refactor. If something is out of date, refactor. Keep software entropy in mind. Refactoring is necessary since requirements and designs are never static.
  • Don’t refactor and add functionality at the same time.
  • Ensure you have good tests and run tests often before refactoring.
  • Make code easy to test. Keeping the bullet point design with contracts in “Pragmatic Paranoia” in mind. Design to test.
  • Never use code you don’t understand. It will be difficult to debug and maintain if you don’t. If it’s difficult to understand it takes time for you to understand it, take the time to understand it, then refactor if possible.

Before the Project

What you do outside of code, before you code, is at least just as important as coding itself. Hunt emphasizes the need for taking care of prerequisites with the bullets below:

  • Seek out requirements. Don’t just let them come to you; deliberately gather as many requirements as possible before you start designing, let alone implementing.
  • Work with a user to think like a user.
  • Keep requirements abstract. Abstract requirements are more extensible and understandable to implement.
  • Maintain a glossary for your project. This glossary could be used for both front-end and back-end developers for a single source of truth.

Pragmatic Projects

How are “pragmatic” projects run? Hunt’s tips on making teams run as smoothly as possible:

  • Organize around functionality, not job roles. Remember that functionality does not necessarily mean end-user use cases.
  • Automate as many mindless tasks as possible. Manual procedures are slow and error-prone.
  • Test early, test often, test automatically. Test the tests. Once again, keep in mind software entropy.
  • Test for state coverage, not code coverage. Just because every line of code is covered in tests does not mean every possible state is. Unfortunately, no tool can determine every state for you, so this is where designing with contracts comes into play. Design those contracts as aggressively as possible.
  • Find bugs once. Time spent on finding the same bug multiple time is time wasted. Document found bugs, fix the code, fix the unit tests, fix everything to ensure that this bug will not appear anymore.
  • Build documentation with your code, don’t just use documentation as an add-on. Keep all of these programming principles in mind when it comes to documentation. Treat documentation with equal care.
  • Sign your work. Anonymity can lead to sloppiness because nobody will know you cased the problem. Be proud of the work you do, and take responsibility for the work you do.

So despite the topics of this book being so introductory, why a full five stars? Simple: How many other books are like this, let alone do it so well? Even with my lack of experience and my initial judgment saying that this felt too familiar, I had already gotten great feedback from code reviews saying that my code is a lot cleaner, as if “I had gained an extra year of experience overnight” (verbatim!).

This book breaks things down so well because the concepts are actually quite abstract, but Hunt makes the abstractions so concretely understandable (another shout-out to Made to Stick) that any programmer can benefit from this book regardless of experience.

This post may be helpful with everything being so concise, but regardless the book definitely deserves its own read. These principles will truly sink in once you dive into Hunt’s explanations, and those principles will last throughout your software engineering career.

Book of the Week 12: Good to Great

An immensely popular business book with over 70,000 ratings on Goodreads. What makes this book so great? Following last week’s review on what makes ideas great, this time I was interested in seeing if there were any similarities between great ideas and great companies.

Using the SUCCESS model explained last week, Jim Collins in this week’s book uses simple (they’re really nothing too groundbreaking), concrete (using examples from the companies themselves), credible (using empirical data from his research among over 80 companies) stories (also using examples from the companies themselves) with some unexpected facts (for example, a CEO of a “great” company being humble instead of having the stereotypical ego) to convince us that these specific traits will make any company great.

The SUCCESS model works. Let’s see how that applies to making riches.


76865Rating: 3/5

Verdict: Content is well worth the read. Heavily researched, but with an arbitrary methodology. Explanations feel verbose.

Jim Collins provides a concrete five-year study of multiple companies who have sustained a stock market value of a given percentage (150%) above the average market. From there, he reverse engineers the remaining companies by discovering commonalities among their practices, given the empirical data he had discovered.

Continue reading “Book of the Week 12: Good to Great”

Book of the Week 11: Made To Stick

Two superheroes, two teams, fighting each other to the death. Each superhero has firm beliefs in what they are fighting for. There is no true villain. Who do you cheer for?

Captain America: Civil War is such a great movie thanks to not only its great writing and humor, but also to the principles in this book.

Every day I’m constantly thinking about ideation. What makes ideas creative? What makes ideas survive for years? What makes ideas bad? After reading through this book, you’ll see not only how Civil War became such a great hit but also just how easy spotting a great idea really is, once you’re exposed to the concepts in this book. Let’s check it out.

Disclaimer: I’ll be using this superhero blockbuster as my example throughout this post, and while I’ll try to hold back on spoilers, some details may spill just enough to ruin it for you. You’ve been warned!


69242Rating: 5/5

Verdict: Clearly the authors took their own advice into making this book such a success.

SUCCESS – if you could only remember one word from this book, it would be this. Chip and Dan Heath establish the six key qualities of ideas that truly last: simple, unexpected, concrete, credible, emotional, and stories. Add an extra ‘s’ for good luck and you get “success.” Each principle explained below:

Continue reading “Book of the Week 11: Made To Stick”

Book of the Week 10: When Breath Becomes Air

You’re constantly pushing yourself to be the best you can be, every day. You go to the gym when you could have gone straight home to unwind on Netflix right away. You put in that extra hour studying for the exam. You’ve been doing this for years, your entire life, just to reach your greatest goal.

And in an instant, everything you’ve worked so hard for gets taken away.

A book unlike my previous reviews, usually in self-help or business, this quick memoir of a neurosurgeon easily became a bestseller during its release early this year, claiming a solid 4.37/5 rating on Goodreads with over 24,000 ratings. After spotting this book in a Barnes and Noble and looking up its stats, I decided to give this a shot, and oh was it so worthwhile.


25614898Rating: 5/5

Verdict: Quick, impactful memoir providing a rare perspective on insights in the medical field, in life and death, in chasing your passions, and in forming meaningful relationships with everyone you meet. Absolutely emotional in every regard.

Paul Kalanithi loved the little intricacies in the laws of science, particularly in how the brain works and how it’s able to enable every action we perform. He equally loved the world of literature as it provides access to human meaning and brings the aforementioned laws of science into communion.

Continue reading “Book of the Week 10: When Breath Becomes Air”

Book of the Week 9: Soft Skills: The software developer’s life manual

This (insert length of time not being a week)’s book features a well-rounded approach to life… specifically for software developers. I’m in the software field (and just starting out too so what better time!), I read, and I’m striving for a balanced life, so of course the sheer title of this book caught my eye!


23232941Rating: 3/5

Verdict: Lots of useful points throughout the book, but too broad and too introductory.

John Sonmez has quite a resume. Aside from being a developer, he dived into the realms of bodybuilding competitions, real estate, online course content creation, and writing – both in blogging and in this book. While he doesn’t brag about these achievements in the beginning or on the cover to attract your immediate attention, you see him bringing up these chapters of his life as he gives himself credibility to this holistic message. If you’re a software developer and you could only read one book in your life, this would probably be it.

Continue reading “Book of the Week 9: Soft Skills: The software developer’s life manual”

Book of the Week 8: Pour Your Heart Into It

An exciting business memoir yet still an easy read about the origins of Starbucks. Just gonna jump into it.


626601Rating: 5/5

Verdict: Fantastic read for anyone, really: future CEOs, anyone in the business industry, for those who are interested in the history of Starbucks, or for those who simply want to better themselves.

CEO and author Howard Schultz talks about a myriad of life situations that had shaped Starbucks into what it is today. This book is seriously a gold mine; I’ll have to reread this book soon to make sure I truly get everything downloaded.

Continue reading “Book of the Week 8: Pour Your Heart Into It”

Book of the Week 7: The Only Pirate At The Party

It’s been too long, a full three months! I’ve been keeping up with my weekly readings, but not so much at all with these reviews, ahhh! I’ll be trying to make it a priority as I catch up with the books I’ve read throughout the past months.

This week, one I had been waiting on for quite a while. I’m excited to get this review started!


25330544Rating: 5/5

Verdict: Fun, inspiring, genuine. Her personality shines so strongly through her words, similar to the way she speaks on her social media and interviews. A quick autobiography that’s definitely worth the read!

Lindsey Stirling has always been one of my top role models ever since the first year of her inception on YouTube. Dancing violinist playing EDM and dubstep, as well as video game covers? EASILY sold. The fact that her sheer introduction crosses the boundaries the creativity already had me sold. I pre-ordered this book as early as last summer, and it finally got to my house last month on its first day of release. I was so excited!

Continue reading “Book of the Week 7: The Only Pirate At The Party”