Archive for July, 2009

Programming with Concurrency

Monday, July 27th, 2009

New high-speed computers will have more and more cores as the years go by, and the ramp-up has started and is going very quickly.  To take advantage of those processors, some programs will need to use interesting (complicated and novel) concurrency.

But the history of concurrent software is littered with approaches that just turned out to be too hard to use, and the software was slow to develop and very hard to debug.  Now that we’re all in the same boat, how do we solve the software problem?

Many language designers think that the answer lies in pure (side-effect free) programming.  The best known, and quite practical, languages that are pure are Haskell and Erlang.

But many new languages are arriving based on the idea that you should use mostly side-effect-free code, and then when side-effects are needed, use transactions.  This is at least a trend if not a movement or revolution.

When Guy Steele came back from the JAOO Conference, I asked him for a quick report, and he sent me this (very slightly copy edited, used with Guy’s permission):

I was stunned by the end of the first day of JAOO 2008 when I realized that Anders Hejlsberg had given a plenary talk on C#, I had given a talk on Fortress, Bill Venners had given a talk on Scala, and Erik Meijer had given a talk on functional programming, and we had all delivered approximately the same message to this object-oriented crowd: the multicores are coming—no, they’re here—and the only plausible way to deal with them in the long run is to rein in the side effects inherent to the OO point of view and move as much as possible to a functional programming style with mostly-immutable data structures and implicit parallelism.

I am very excited by the new Clojure language, which is a dialect of Lisp based on exactly these same principles.  Rich Hickey apparently wasn’t at JAOO, but would have found friends there!

Normally I don’t try to learn a language unless I’m about to actually program in it.  But it’s worth learning a language when you pick up fundamental new ideas that might be helpful (or just interesting).  Haskell is like that (thanks, Alan Bawden, for letting me know).

If you might have to write highly-concurrent programs in the future, I recommend that you keep your eyes on all this.

“Yes” Concert was great; Adrian Belew is coming!

Sunday, July 26th, 2009

I enjoyed the Yes concert last night very much. I made some new friends, who told me that Adrian Belew is coming soon. And when I got back to my car, there was a sheet of paper under my windshield wipers about the Belew concert. (This must be the first time I ever got one of those sheets under the wipers that I actually appreciated!)

The Yes concert was very much like the last one I had been at, at the Hampton Court Casino Ballroom. Jon Anderson is still ill, and is replaced by Benoit David, who is superb and sounds uncannily like Anderson. Rick Wakeman no longer tours, and is replaced by Oliver Wakeman, his son. Wakeman fils was not so impressive last time, but he seems to have gotten more virtuosic since then, although still not as great as pere. The other three are classic members of Yes: Steve Howe, Chris Squire, and Allan White.

The playlist for the two-hour set was:

  • Siberian Khatru
  • All Good People
  • Tempus Fugit
  • Astral Traveler
  • And You And I
  • (Steve Howe, solo acoustic guitar)
  • Owner Of A Lonely Heart
  • Machine Messiah
  • Roundabout
  • Heart Of The Sunrise
  • Starship Trooper

I only like the songs from the 1970′s, although I am warming up to Owner Of A Lonely Heart somewhat. I could do without Tempus Fugit, Astral Traveler, and Machine Messiah. But the rest were great.

I hope someday they go back to doing the more ambitious works, such as Close To The Edge, The Gates of Delirium, and anything from Tales From Topographic Oceans. I’ve seen them about eight times in the last eight years, and I’ll keep going: it just never gets old for me!

The opening act, is their guitarist as well. (Howe played both Asia’s one-hour set and Yes’s two-hour set, and did solo guitar when the rest of Yes was resting. Squire said that now that James Brown is gone, Howe is the hardest working man in show business. That may not be literally true, but I think it was very fitting to acknowledge how much Howe was performing. He’s a truly great guitarist, and his powers have not diminished one bit; he’s now 62 years old!

The first couple of songs by Asia weren’t too interesting to me, although they might have been, had I known the music, and had the vocals been mixed high enough that you could hear them.

But then they performed Fanfare for the Common Man (more or less in the style that it was recorded by ELP in 1977.

And then, to my surprise, they performed In The Court Of The Crimson King. I had not realized that Asia’s lead singer, John Wetton, had been a member of King Crimson, though not on that album. Many of the famous progressive rock musicians of the 1970′s moved between groups (Yes’s personnel is not uncommon; for a good time, look at the lineups of Jethro Tull!)

I had never been at this venue before. The South Shore Music Circus is a big circus tent, entirely theater-in-the-round, with a stage that rotates slowly so that everybody gets all the views. Had I been sitting up front, I would have been very, very close to the musicians! Next time, I’ll get my tickets as soon as they go on sale. The downside is that it’s rather hot and stuffy, or at least it was in yesterday’s weather, but the weather was hardly extreme by Boston-area standards. But you can get up and walk around outside the tent and still hear fine, if you want to cool off. I did this during some music that I didn’t care about as much.

I have been a fan of Adrian Belew for many years now. I’ve seen him live at the Paradise in Kenmore Square doing songs from his first album, Lone Rhino, in 1982 with my friend Jim Davis. (From the eponymous song: “I know the zoos protect my species / They give me food, collect my feces / But I can’t help it, I miss the past / I’ll never again see my good old mud bath…”). In 1990, I saw him at the Orpheum in Boston, doing the tour for the album Strange Angels. He’s done lots of amazing work with many great musicians, as documented in Wikipedia. He can make an electric guitar sound like any of a wide array of animals, beautifully. Here’s his own web site.

He’s performing at the Narrows Center for the Arts on Saturday, Sept. 5. Doors open at 7 and the show starts at 8, “followed by meet-and-greet” (!). It’s at 16 Amawan Street in Fall River. Tickets from Brown Paper Tickets, the wonderful people who do tickets for our family opera company.

This information is all from the flyer left on my car. The flyer came from a magazine I had never heard of, Limelight Magazine, which looks very interesting! Here’s their story about the Adrian Belew concert, which is actually “The Adrian Belew Power Trio” with Eric and Julia Slick, on drums and bass respectively (I think they’re siblings).

They are also playing the previous night, at the Natick Center for the Arts.

Don’t miss Birdsongs of the Mesozoic and No Static!

How To Invest

Thursday, July 9th, 2009

Have you been looking for a good book about how to invest your money?  I have a big collection of such books, but most aren’t required reading.  Here’s my short list for anyone who has recently become interested in personal finance and investing.

First, read “The Only Investment Guide You’ll Ever Need; Expanded and Updated Throughout” (the latest edition) by Andrew Tobias, for the Big Picture of personal finance.  This takes the wide-angle view about how to deal with money.  In particular, it will help answer your first issue about investment, namely, how much money should you be investing in the first place?  It’s very easy and fun to read; Tobias is about as engaging a writer as you could imagine.  If you can’t get this edition, get the “Revised and updated”, probably almost as good.

Second, read “Unconventional Success: A Fundamental Approach to Personal Investment”, by David F. Swensen, 2005. This book answers your second question: given how much I’m going to invest, how much should I put into each asset class.  The book points out that deciding how to divide your money among asset classes is the most important investment decision you can make.  It’s something you can control and customize for yourself.  Security selection and market timing are much harder games to win, especially since you’re playing a zero-sum game against people who spend their entire lives doing nothing else.

He also explains why most mutual funds are bad news, and how to find the ones that are good news. In particular, pay attention to his high recommendation of Vanguard, which explains clearly why they’re so great.  I take this opportunity to thank John C. Bogle and Burton Malkiel, the individual investor’s best friends, for creating Vanguard and its valuable and innovative products.  (I have no connection with Vanguard at all; I’m just a satisifed customer.)

Swensen goes over a wide range of asset classes (different kinds of stocks, bonds, real estate, as well as exotics like hedge funds and venture capital), taking a hard look at each one and why you should or should not invest in them.  It’s written somewhat dryly sometimes, but it’s well worth reading anyway.

You can stop now; you’re all set.  However, if you insist on being interested in security selection, or just like this stuff (I do):

Your third book is “A Random Walk Down Wall Street” by Burton Malkiel.  Be sure to get the latest edition, as Malkiel carefully updates this book periodically; there is a Ninth Edition coming out soon (so the hyperlink above might not be the best one; look around).  Before you think about security selection (e.g. deciding which stocks to buy) you must, must, must understand the concept of efficient market (random walk) theory.  Markets are not efficient, but the best way to look at them is to start with the model of an efficient market and then look at how real life differs from that.  Malkiel covers some of the same ground as the first two books, with his own take on the issues.  Very readable and fun, just like Tobias.

In earlier editions, Malkiel proposed the concept of index funds: a mutual fund that would never underperform the Standard and Poor 500 because it would actually invest in the Standard and Poor 500!  This was such a good idea that it was implemented, and nowdays you can find index funds for all kinds of indexes.  The management fees (which matter a lot to you) are very low, since the buy/sell decisions are pretty much automatic.  Google for “bogle malkiel” for more about all this.

Here are some others, but please read the above three first and only go into these afterward:

“What Works on Wall Street” by James O’Shaughnessy, 1997.  (Thanks to Rick Tompkins, who told me about this book about ten years ago.) A hard and scientific look at how stocks have behaved in the past, and what stock selection strategies have worked over the very long haul.  Lots of data but quite easy to read and understand.  I have read many of the source materials of this kind, such as articles in the Journal of Financial Analysis (it’s so great that anyone can walk right into the MIT libraries!), and everything he says is consonant with the best research, as best I can tell.  If you are convinced, there are mutual funds based on his principles, formerly the O’Shaughnessy funds, currently known as the Hennessey Funds (Cornerstone Growth and Cornerstone Value), in which he puts his money where his mouth is.  I did very well with one of these for some years. However, the big problem is that it’s not clear that the strategy still works.  Things change, and the record of their funds has not been so great lately.

“The Intelligent Investor” by Ben Graham, the classic 1949 book on value investing.  A lot of the details are no longer up to date, but it’s a good explanation of the concept of value investing.  Warren Buffet, currently the world’s second richest man, was Graham’s principal disciple.  I think the biggest problem with following his advice is that these days, accounting allows so much adjustment of “income” that the “bottom line” means a lot less than it used to.  (See Jack Welch’s record of steadily-increasing quarterly earning at General Elecric for quarter after quarter; I mean, come on!)

If you get through those and want to know more, tell me what you want to know more about and I’ll recommend more in the comments.  Please add comments with your own favorites, along with explanations of why they’re worth reading to someone who has read the above books.  Thank you!