Beautiful Code

Posted by Brian Fri, 11 Mar 2011 02:38:00 GMT

Beautiful Code Edited By Andy Oram & Greg Wilson


Beautiful Code is a collection of essays from programmers working in a number of different areas, from language design, to operating systems, to enterprise application development. If you are a programmer, chances are good that at least a couple of essays in here will appeal to you.

First, the good. Some essays are great. Yukihiro Matsumoto, the creator of Ruby, has arguably the best (and shortest) essay in the collection, concentrating on what makes code beautiful and how those factors influenced his design of Ruby. Elliote Rusty Harold’s contribution on lessons learned creating XML verifiers is also a standout. He goes through several implementations, learning from each to improve the performance of the next, all while maintaining correctness across all cases. Charles Petzold’s description of on-the-fly code generation for image processing is dense, but interesting. As a sometimes Python programmer, Andrew Kuchling’s discussion of the design trade-offs in the design of Python’s dictionary implementation was much appreciated and gives insights into performance optimizations you can make with your application if needed.

Unfortunately there is also a fair amount of bad. One issue is that the book is simply too long. The editors mention they got a more enthusiastic response from contributors then they expected. They may have felt compelled to include all or most of the responses. But beyond the length, some of the essays are just bad. For example, Douglas Crockford’s “Top Down Operator Precedence” essay dives right in without actually explaining the algorithm. It is explained piecemeal throughout the code, but you never get a good feel for exactly what is going on. Other contributors have the view that whatever skills they need to do their work is essential to being a true software engineer. For example, Bryan Cantrill writes that postmortem debugging with core dumps “is an essential part of our craft - a skill that every serious software engineer should develop.” Quite honestly, only a very narrow niche of software engineers are serious then. Other authors take similar narrow views at times, whether it is the author of math libraries feeling that everybody needs to care about high performance computing or C programmers feeling that every real programmer should implement their own dynamic dispatch code in C at some point in their careers.

Beautiful Code is worth the read, but don’t hesitate to skim over the essays that don’t interest you. I probably would have enjoyed it more if I didn’t force myself through most of the them. (Also see Jeff Atwood’s review for a good explanation of why the title of the book is misleading.)

Posted in  | no comments

2010 Books In Review

Posted by Brian Mon, 10 Jan 2011 02:04:00 GMT

Well, my goal this year was to cut back my reading and I somewhat succeeded. I only read 44 books in 2010, but I saved a lot of time by not writing reviews for most of them. Here’s the list for the year, with links to the ones I have written a review for at this time.

  1. Open Sources 2.0 Edited By Chris DiBona, Danese Cooper, and Mark Stone
  2. The Mythical Man-Month By Frederick Brooks
  3. The Innovator’s Dilemma By Clayton Christensen
  4. Predictably Irrational By Dan Ariely
  5. The Cluetrain Manifesto By Rick Levine, Christopher Locke, Doc Searls, and David Weinberger
  6. The Greatest Benefit to Mankind: A Medical History of Humanity By Roy Porter
  7. Ender’s Game By Orson Scott Card
  8. Guns, Germs, and Steel: The Fates of Human Societies By Jared Diamond
  9. The Future of Ideas: The Fate of the Commons in a Connected World by Lawrence Lessig
  10. The Stand By Stephen King
  11. Biobazaar: The Open Source Revolution and Biotechnology By Janet Hope
  12. The Drawing of the Three: The Dark Tower #2 By Stephen King
  13. The New Complete Joy of Homebrewing By Charile Papazian
  14. The Complete Stories: Volume 1 By Isaac Asimov
  15. Neuromancer By William Gibson
  16. Count Zero By William Gibson
  17. Mona Lisa Overdrive By William Gibson
  18. In Defense of Food: An Eater’s Manifesto By Michael Pollan
  19. The Waste Lands: The Dark Tower #3 By Stephen King
  20. The Dilbert Principle By Scott Adams
  21. Wizard and Glass By Stephen King
  22. Wolves of the Calla By Stephen King
  23. The Song of Susannah By Stephen King
  24. ‘Salem’s Lot By Stephen King
  25. The Dark Tower By Stephen King
  26. The Red Thread of Passion By David Guy
  27. The Cathedral & the Bazaar By Eric Raymond
  28. NurtureShock By Po Bronson and Ashley Merryman
  29. Capitalism, Socialism, and Democracy By Joseph Schumpeter
  30. Sex at Dawn By Christopher Ryan and Cacilda Jetha
  31. Innovation Happens Elsewhere (Did not finish)
  32. Effective C# By Bill Wagner
  33. More Effective C# By Bill Wagner
  34. Programming in Scala By Martin Odersky
  35. Foundation By Isaac Asimov
  36. Foundation and Empire By Isaac Asimov
  37. Second Foundation By Isaac Asimov
  38. Dr. Kinsey and the Institute for Sex Resarch By Wardell Pomeroy
  39. Pain: The Fifth Vital Sign By Marni Jackson
  40. Programming Perl, 3rd Edition By Larry Wall, Tom Christiansen, & Jon Orwant
  41. Joel on Software By Joel Spolsky
  42. Listening To Prozac By Peter D. Kramer
  43. Songs of Distant Earth By Arthur C. Clarke
  44. Speaker for the Dead By Orson Scott Card

Posted in  | Tags  | 1 comment

The Drawing of the Three

Posted by Brian Mon, 05 Jul 2010 23:22:00 GMT

The Drawing of the Three (The Dark Tower #2)
By Stephen King


I really need to get better at writing these as I read the book. I think at least apart of the problem is that I don’t take any notes when reading fiction and that is what the majority of my reading has been the last few months. I finished this months ago and am now on the 5th book in the series, Wolves of the Calla. The Gunslinger had felt like a 300 page prologue so I wasn’t quite sure what to expect here. I ended up being pleasantly surprised.

King’s style is again quite visual and I had no problem with visualizing each setting in considerable detail. The gun fight with Balazar’s men is especially vivid. Also, King starts sprinkling in more language from Roland’s world in a highly effective manner. The light sprinkling serves to accentuate the the line between Roland’s world and ours while giving more weight to the terms. Simply stating that it was destiny instead of “ka” would not focus the reader as intently on Roland’s view of his quest.

The series is starting to show some minor cracks with where I am in my reading, but at the conclusion of The Drawing of the Three everything fits together very neatly. Highly recommended.

Posted in  | Tags ,  | no comments

The Stand

Posted by Brian Tue, 22 Jun 2010 00:34:00 GMT

The Stand
By Stephen King


I am once again falling incredibly far behind on my reviews. The deficit currently stands at nine books. Time to get back on track.

I started reading The Dark Tower series last year. After reading The Gunslinger my brother recommended that I read The Stand before continuing any further, as it tied into later books in the series. (I’ve since learned that many Stephen King books tie in, but I am unsure how many I will read.)

Let me just say right off the bat that I am a sucker for movies or novels about the apocalypse. I’m like a kid in a candy store when it comes to the collapse of civilization. Needless to say The Stand was right up my alley. I ended up picking up the uncut edition from the library, weighing it after 1000 pages. As far as length goes, that puts it about on par with Cryptonomicon, which I read last year. Fortunately Stephen King is a much easier read than Neal Stephenson. Dense The Stand is not. If you can call a book about the death of 99.4% of the population breezy, then this is it.

You can read all about the plot of The Stand elsewhere. I just want to muse a little on Stephen King’s place in literature. Before reading The Gunslinger last year I had not read anything by King since Cujo in middle school and had since dismissed him (for no good reason) as popular tripe. Starting to read The Dark Tower series (and now The Stand) has been a revelation. Yes, as he describes it, he often suffers from diarrhea of the typewriter, but I find myself not minding. He’s a terrific visual writer and his work reads much shorter than it’s heft would indicate. Compared to a lot of my usual reading his work qualifies as quite relaxing. Maybe I am enjoying it because it is such a change of pace for me. Most of my fiction reading is fantasy or science fiction. King mixes elements of each with horror and general fiction to create some very readable work. Anyways, I’m very much looking forward to finishing The Dark Tower (I just finished The Waste Lands last night). And since The Dark Tower ties into so many of this other works maybe I’ll just keep going.

Posted in  | no comments

The Future of Ideas

Posted by Brian Mon, 31 May 2010 19:01:00 GMT

The Future of Ideas: The Fate of the Commons in a Connected World
By Lawrence Lessig

“Technology, tied to law, now promises almost perfect control over content and its distribution. And it is this perfect control that threatens to undermine the potential for innovation that the Internet promises.” - Lawrence Lessig

In our cultures rush towards the salvation of the unfettered free market promised by the right we often lose sight of a couple of key points. First, one of the key pillars of that free market espoused by the right is a system of intellectual property law that itself is brought into being through government regulation. They preach that this system of patents, copyrights, and trademarks is absolutely essential to ensure that inventors and artists have incentive to create. Second, the biggest driving force behind the economic growth of the past fifteen years comes from a resource that purposely avoided using the patent system. As Lessig reminds us in *The Future of Ideas” “the core of the internet was… code built outside the proprietary model.”

If you are interested in the balance that must be found between proprietary ownership and the commons on the Internet then this book is for you. Lessig guides the reader along the founding design principles of the net and how business is seeking to subvert those principles today in order to gain control of what has been an open network to this point. What is meant by “open” though? It goes to the idea of net neutrality which is currently being hotly debated by the FCC, which is seeking to preserve it, and large media companies and ISPs, who wish to abolish it. Net neutrality simply states that all content flowing across the network must be treated equally. For example, Comcast owns the largest cable TV system in the country and also supplies internet to millions. In order to protect its cable monopoly Comcast may want to limit internet video traffic across its network, effectively using their monopoly in old media to stop new competitors from emerging. An explicit system of net neutrality would legally prevent this.

Lessig also proposes sweeping reforms of the copyright system. Currently our system of limited copyright protection for the promotion of the arts and sciences has been perverted by large media. The Copyright Term Extension Act extends copyright in many instances to over 100 years. This does nothing to encourage production of new works of art, instead working to strengthen current monopolies by preventing anything from ever entering the public domain. In The Future of Ideas he proposes a 5 year copyright that can be renewed up to 15 times. This is still a longer term than I would like (Lessig has since modified his stance to support even shorter terms).

The topic Lessig takes on is vast and one the vast majority of the public never thinks about, something that large media companies use in their favor. If you are interested in tackling the subject yourself this is an excellent place to start.

Lessig practices what he preaches as well. You can download The Future of Ideas for free here.

Posted in  | no comments

Guns, Germs, and Steel

Posted by Brian Sun, 16 May 2010 03:29:00 GMT

Guns, Germs, and Steel: The Fates of Human Societies
By Jared Diamond


I first heard about this book in spring 2005 when I took an American military history class in college and the professor showed the documentary based off of this book in class. It didn’t have much to do with the rest of the course, but he felt that Jared Diamond’s work was important enough to show anyways. The book lingered on my To Read list ever since, but I finally got to it. It was well worth it.

In Guns, Germs, and Steel Jared Diamond sets out to explain why one culture dominates another without resorting to the usual racist arguments. The Wikipedia page goes into sufficient detail so I won’t dwell on the specifics. What I do want to discuss is the skills that Diamond possesses that allowed him to write such a wide ranging book and what can be extrapolated from that.

Most of the last century saw a dramatic increase in scientific specialization. The sheer amount of information coming in as scientific advancement progressed at an ever increasing rate simply requires it. For the most part, if you want to carve yourself a name among a scientific community you need to specialize. A biochemist specializing in a single bacteria is common in that field. This has come at the expense of being able to synthesize information across many different fields though. A towering figure the likes of Newton is impossible today. In Newton’s time it was possible for him to keep abreast of most scientific discoveries of the day, regardless of what field we would today categorize them in. The need for these figures has not diminished though. They are needed more than ever and that to me is what makes Diamond so special. During his career he has been active in Physiology, Biophysics, Ornithology, Environmentalism, Ecology, Geology, Evolutionary Biology, and Anthropology. For a researcher today to move across so many fields is incredible and it is this diversity that gives him the unique lens to write such a comprehensive book in such a convincing fashion.

A couple of other thoughts. I have heard some rumblings about the length of the book by those who feel it was a magazine article extended to 400 pages. While he can be repetitive, with a subject this large I would prefer the author to be repetitive and thorough, looking at the problem from many different angles, instead of glossing over too much. I felt that Diamond walked the line very well with regards to length. It would have been easy to have such a large topic grow to 1000 pages. In doing so he avoided many of the problems found in The Greatest Benefit to Mankind, which devolves into an overwhelming catalog of facts.

Finally, it was hard for me to read this without thinking of Isaac Asimov’s *Foundation” series, specifically his concept of psychohistory, which he used to predict the collective actions of very large groups of people. Diamond does not go nearly that far, but reading anything about large sweeps of history that attempts to give an explanatory model makes me think of Asimov. And anything that makes me think of Asimov is a must read.

Posted in  | no comments

The Greatest Benefit to Mankind

Posted by Brian Tue, 27 Apr 2010 01:39:00 GMT

The Greatest Benefit to Mankind: A Medical History of Humanity
By Roy Porter


In college I took a history class called Changing Concepts of Health and Illness that was taught by the best professor I ever had, Theodore Brown. He brought immense knowledge and passion for the topic to bear in an engaging fashion that made me look forward to going to every class. The main text for that class was The Greatest Benefit to Mankind, but we only covered about somewhere from one-third to a half of it. Ever since then it has sat on my bookshelf until I finally got around to reading the whole thing. Unfortunately, without Professor Brown’s teaching to go with it, the book shows itself to be overwhelming in its efforts to be comprehensive.

Roy Porter sets out to provide the reader with a comprehensive history of medicine from a Western perspective. The problem is that the topic is simply too large to handle in the manner he attempts. When covering a topic this large there must be some sort of narrative or flow to propel the reader forward. In this case though Porter has written in a very dry, encyclopedic style. Names are thrown at the reader so fast they just become a blur. In many sections multiple names are thrown out and then one is referred back to and it is difficult to remember who did what.

I can’t help compare this book against Jared Diamond’s Guns, Germs, and Steel, which I just finished this weekend (review forthcoming). Diamond took on a similarly daunting task of tracing the why’s of 13,000 years of history, but he did it in a narrative way. He clearly set forth his goals to the reader and followed through. When taking on a monumental subject you must give the reader goals to be reading for. Guns, Germs, and Steel would have been nowhere near as successful if we had wrote it in Porter’s style.

The Greatest Benefit to Mankind is probably best served in the way Professor Brown used it: as a supplement to a conversation on Western medicine. It serves very well as reference material, helped by its enormous index. Don’t read the whole thing though.

Posted in  | no comments

Ender's Game

Posted by Brian Sun, 04 Apr 2010 20:27:00 GMT

Ender’s Game
By Orson Scott Card


Ender’s Game has been on my reading list for years, but I just got to it last month. It is considered a classic of science fiction and propelled Card into the upper echelon of sci-fi authors. I wanted to concentrate on the controversies surrounding the novel here, but it seem that many of those include details from later books in the series. I would rather read those before reading about the controversies in detail and forming an opinion. Instead I will simply share some thoughts on the foreword to the version I read form Orson Scott Card.

In that foreword he briefly discusses the treatment of the gifted in our society, mainly the assumption that children are not capable of complex thoughts. I have always found this view to be ridiculous. Of course Card takes this to the opposite extreme by having Ender’s siblings manipulate humanity from a young age, leading to one ruling Earth and another leading the first expedition to an alien planet. However, there is a vast middle ground between those two extremes that most children fall into and it important to recognize that there is vast spread in that middle ground. Our current education system mostly ignores these differences though.

I’m not going much of anywhere with this and I’m having a serious case of writer’s block so let me just say that Ender’s Game is a fabulous morality tale told through the eyes of children and the adults manipulating them. Card’s writing consciously avoids needlessly complicated language, something he disdains. Card’s portrayal of Ender as sympathetic character may be tough for some to swallow, but it will certainly make you think.

Posted in  | Tags ,  | no comments

The Cluetrain Manifesto

Posted by Brian Tue, 30 Mar 2010 22:07:00 GMT

The Cluetrain Manifesto
By Rick Levine, Christopher Locke, Doc Searls, and David Weinberger


Well I started writing this review once and lost all my work when I was about three quarters done. Consequently I have no motivation to write a detailed review again. My initial one dug into what parts of the The Cluetrain Manifesto had come true and which had not over the past decade. Since I am lazy you get the CliffsNotes of the CliffsNotes version.

The Cluetrain Manifesto was written at the beginning of the rise of the internet and basically boils down to markets are conversations. Companies that wish to proclaim and hold their customers at arms length will suffer as real conversations come to dominate. To a certain extent this has come true. Many small businesses are built entirely around this concept, but it is arguable whether many ever lost authentic conversation to begin with. With respect to large businesses this has been applied as just another avenue of market research, support, and advertising. It hasn’t supplanted the traditional proclamations from on high or mass market advertising campaigns.

If you want a view of the early optimism of the power of the internet this is a great read. Today that optimism is tempered with fear of big business and governments continue to dream of locking down the internet to further their own ends. The writing style is purposely aggressive. In many ways the authors are almost belittling the old guard. I for one am always up for that.

Posted in  | no comments

Predictably Irrational

Posted by Brian Wed, 03 Mar 2010 23:13:00 GMT

Predictably Irrational: The Hidden Forces That Shape Our Decisions
By Dan Ariely


Predictably Irrational was the right book at the right time for me, making it one of the best books I have ever read. In it Dan Ariely discusses the findings of behavioral science and how they contradict the assumptions of classical economics.

Classical economics assumes that the actors in a market are completely rational and will always act to maximize their personal gain. Behavioral economics breaks from these assumptions by putting them to the test and, as any honest person can attest, finds that they simply are not true. We are not rational beings. What is being discovered is that we are irrational in consistent and predictable ways though.

Ariely primarily highlights our irrationality through experiments. Each chapter discusses an experiment he or his colleagues have ran to test some aspect of our supposed rational actions. For example, he discusses the influence of sexual arousal on the choices we make. Participants in the study answered a series of questions about their sexual activities and preferences. They were asked to estimate what their preferences would be when aroused. Then the questions were repeated when they were highly aroused to see if they correctly predicted. The results were clear: people can’t estimate how their behavior will change when aroused. The most interesting question referred to condom usage. When unaroused the vast majority of participants said they would take the time during a sexual encounter to put on a condom. However, when they answered the same question aroused, the number plummeted. He then extrapolates that perhaps these types of experiments should be taken into account when advocating abstinence only education.

Another experiment analyzed the effect of a placebo pain killer. Two groups of patients were told they were being given a new pain killer, but one group was told that it cost $2.50/dose and the other group was told it was only $0.10/dose. Those told it was more expensive were more likely by a significant margin to feel that it worked. Experiments such as these can have a profound effect on health policy.

In a way this is a return to the economics of Adam Smith, who classical economists often trumpet as a free market champion. What they either don’t realize or simply ignore is that Smith wrote The Theory of Moral Sentiments in 1759, which, as Ariely reminds us, “notes that emotions, feelings, and morality are aspects of human behavior which the economist should not ignore (or, worse, deny).” Classical economics gives us many useful tools, but they must prove their mettle in a reality that accepts the fact that we are irrational beings.

Posted in  | Tags  | no comments