Friday, November 20, 2009

Programming Tools

Every time I think about programming tools, I get really annoyed. If you've been programming for a while, you probably started off with the basic PRINT statement as your debugging tool way back when micro-computers were too small and insufficiently powerful to run anything as sophisticated as a debugger.

When Turbo Pascal 3.0 came out for the PC, it was a revelation, at least for me. You could have a programming environment that could not only compile at lightning fast speeds, but it too, was restricted to debugging via print statements --- debuggers only became available starting from Turbo Pascal 4.0.

When I got to college and had access to UNIX machines, having a debugger was a revelation. You could single-step through code, print variables, set break points (and even conditional break points), walk up and down the stack, and if you recompiled the code, you could restart the program and the debugging would automatically pick up the new binary. I got out of the habit of writing print statements.

As an intern at Geoworks, I became even more spoiled. Geoworks had an in-house debugger called swat, and the basic development environment was a SUN workstation connected to a PC via a serial cable. You would then cross-compile on your SUN (using a distributed compiling environment), download the code via the serial cable to the PC, and swat would run on your workstation while talking to a debugging stub on the PC. Swat was ridiculously sophisticated --- to this day, I still have not used a debugger that works as well. (The author, Adam de Boor, like most of the smart people I've ever met, now works at Google) First of all, it had an extension language built into it (tcl). But secondly, the programmers working on GEOS had a very tool-oriented ethic: every time a new data structure was added, they would also write a swat extension that understood how the data structure was laid out in memory. This enabled you to type "heapwalk" at the swat prompt, and the debugger would then walk through memory and dump out all the data structures in human-readable, human-formatted form! If you had a linked list, you could tell it to walk the linked list and dump every element in it. If it was a linked list of a certain object, you could tell it to dump out the actual objects while walking through the list, rather than just dumping the pointer. Even though GEOS was written entirely in assembly (yes, even the applications --- how do you think everything fit into 512KB?), it felt more sophisticated than any high level language except Lisp.

When I graduated school and worked at Pure Software, we took a lot of pains to make sure the purify would work. Stack traces, etc., would work with whatever debugger you used, and variable names always remained intact. This was despite incremental linkers and other techniques that Purify applied to binaries under inspection. To this day, no other UNIX vendor or free software tool has deployed an incremental linker.

When I started having to do Windows development again, the IDEs such as Visual C++ felt like a step backwards --- they had a lot of pretty visuals, but none of them were extensible, so you couldn't teach it about your new data structure, or get it to walk a list. Nevertheless, I still didn't need to write PRINT statements. When I ended up writing VxDs for a living in 1995, I had a much more primitive environment, and it was painful, but I quickly learned to abstract away most of the issues and not rewrite VxDs as much as possible.

Enter the internet server age, and I feel like it's 1986 again, and I'm programming ona PDP-11 using RSTS/E BASIC. Today, any kind of cloud programming that requires harnessing multiple machines essentially relies on RPCs. One would think that with all the knowledge we have from building old debuggers and such systems, we would be able to do things like single-step through a procedure from one machine to a remote machine, and still be able to do stack dumps, walk stack traces, and print data structures. The sad truth is, we can't. In fact, in many environments, you can barely attach a debugger to a remote process, and in some cases if you do attach a debugger and then detach it, the process immediately exits. Symbolic variable names? Thanks to C++ name mangling, I can barely decipher error messages from the compiler, let alone use a symbolic name in a debugger. Combine that with threads, remote systems, and other such setups, and pretty soon you're back to debugging using PRINT statements. You might dress it up and call it "logging" (and I know I've been guilty of doing that myself), but really, it's debugging via PRINTs, and as someone who calls himself a software engineer, whenever I put in yet another LOG statement I feel ashamed, both for myself and for my profession --- we had such beautiful tools in the 80s and 90s, but they are all wasted in the internet era. Yes, I'm well aware that people have written RPC analyzers --- but again, they're all after-the-fact analysis tools --- not nearly as useful as being able to "stop the state of the world and examine the state at leisure", which was what swat and the other tools were capable of doing.

What's responsible for this state of affairs? I think the big one is the decline of the market for programming tools. After Borland died, there was no longer an effective programming tools company that had the kind of end-to-end reach that could provide a development environment that was sophisticated. Microsoft all but stopped evolving its programming tools. Since it was impossible to compete against the free gdb/gcc/g++ tools (and now the free Eclipse), it became a case of "don't beat them, join them." Without end-to-end control of a development environment, it's hard to build a debugger that would do the right thing --- Microsoft could probably do that for its environment, as can Apple, but neither are power-houses in client/server/distributed computing. Google and Yahoo could invest in their distributed debugging infrastructure, but have chosen to invest resources elsewhere. The net result: I don't feel like our programming tools have done anything but gone backwards, despite all the progress we've made in other areas.

Labels: ,

Some conversations are too funny not to post

Back when she was at Google, X used to work out with me every so often. Not being a motivated health nut, as soon as she left, she lapsed, but recently tried to get started again:

X: I'm thinking about seeing my doctor because everytime after i work out my chest area hurt. I'm not sure if it's my heart or if i'm pulling muscle and just exercising wrong.
Me: Do you feel nauseous? That can happen if you work too hard.
X: i don't feel nauseous. i just feel a tight feeling near my chest but i don't think it's my heart
me: What are you doing when you feel the tight feeling? running? lifting weights?
X: no, stretches, light weights. really light tho, lighter than what we used to do.
Me: oh, that just means your bra is too tight
X: REALLY?!?!?!??! .... OK, I'll cancel my doctor's appointment.

Labels:

Monday, November 16, 2009

Review: Dark City, Director's Cut

I was first introduced to the movie, Dark City by Steve Grimm, who told me that it was one of the best movies ever made, only marred by the movie studios who stuck in a narration at the start that spoiled everything. He loaned me the New Line Platinum edition DVD, and told me to stick it into my DVD player and skip the first chapter.

I went home, and did exactly that, and my brothers and I were captivated by the movie. The story was well-told, the actors portrayed what felt like a very real world but in a surreal environment, and the visuals quite unlike any movies I had seen up to this point. When I saw that the director's cut was out, I bought it, despite my fear that somehow knowing the plot would make the movie less watchable.

It turned out that the director's cut is only very subtly different from the original theatrical release. The opening narration is gone (a mistake admitted by the director), and some scenes have been extended for more character development, but to be honest it was so long ago since I saw the theatrical release that I no longer remember what scenes were there as opposed to not.

Regardless, the story is still compelling, moving forward quickly enough to keep your interest, but not so fast as to lose you. William Hurt plays his role with verve, and Jenny Conelly has a luminosity in her scenes that has only grown since. All in all, 90 minutes very well spent.

Highly recommended. (Note: this movie is R-rated, not for any particular scene, but the intensity might be a bit much for young viewers. Lisa had a nightmare afterwards)

Labels: , ,

Sunday, November 15, 2009

Review: Stop Acting Rich

At this point, has there anyone who hasn't read about The Millionaire Next Door? When one of my brothers read that book he told me that the saddest thing about reading the book was that he had to learn to be a cheapskate like me.

Stop Acting Rich is a follow-up, in the fashion of Hollywood studios who can't help milking a movie Franchise over and over again until every marginal dollar has been made.

The book makes several points:
  • Many people who drive expensive cars and live in rich neighborhoods are themselves not rich. The few who are, tend to come from a special type of household and childhood that they are trying to banish by deliberately spending on "the best."
  • Living in a wealthy neighborhood before you are wealthy makes it harder to accumulate wealth. People measure themselves by comparing what they have to what their neighbors have. By constantly surrounding yourself by people who are so wealthy that $50,000 cars are a minuscule portion of their net-worth, you set yourself on a hedonistic treadmill which depletes your wealth instead of accumulating it.
  • Engineers are the most frugal millionaires in America. They have no problem living below their means, and driving cheap cars for the sake of efficiency. Engineers account for 7.6% of millionaires but are only 2.3% of the working population. They also never pay retail. What amuses me the most about this, of course, is that engineers have a notoriously hard time attracting mates, which tells me that a lot of "acting rich" is really about demonstrating proof of reproductive suitability (don't ask me whether the strategy succeeds --- the author doesn't mention it). And true to form, I checked this book out of the local library rather than buying it.
  • By contrast, middle managers and attorneys have a hard time accumulating wealth despite having high incomes. That's because their peers tend to live in expensive neighborhoods, which tends to accelerate their spending. This also explains why I've occasionally seen signs of jealousy from managers in the past.
The author makes this point by using examples from homes, watches, and cars (I would have loved it if he had included Apple products), but the problem is that we don't see good statistical analysis --- if a large number of millionaires buy Toyotas, that doesn't tell us whether or not buying Toyotas is an independent variable, or whether they do prefer Toyotas to a larger extent than the general population.

All in all, the book is entertaining, but provides limited additional insights if you've already read The Millionaire Next Door, so I can't in good faith recommend it.

Labels: , ,

Saturday, November 14, 2009

Review: The Investor's Manifesto

The Investor's Manifesto is Bill Bernstein's latest book on investing. I was worried that since I had read most of his previous books, The Four Pillars of Investing, and The Birth of Plenty, that this would just be a rehash of old material so brilliantly covered by David Swenson in Unconventional Success.

Bernstein wrote that one of his goals was to write a book even more accessible than Four Pillars, and I think to that end he succeeded --- I easily breezed through the book in a couple of days, and there's no sophisticated math here to scare even the most liberal of liberal arts majors away. A big important section that wasn't properly covered before is the emotional aspects of investing --- Bernstein points out that most investors over-estimate their risk tolerance (something frequently causes them to buy high and sell low), and that faddish investing (investing so as to have something to brag about at dinner parties) is likely to have extremely poor results. He puts it all across in a very witty fashion as well, for instance, writing about the fad for investing in China, he points out that the Chinese stock market has had a negative 3.3 percent return over the last 2 decades, and in addition:
Finally, in many developing markets, governments do not protect shareholders from the rapacity of management as well as in nations with more established legal systems. In other words, in these countries, management and controlling shareholders find it disturbingly easy to loot a company. Even more bluntly, a nation that does not protect its children from lead-contaminated toys will likely not protect its foreign shareholders.

In particular, the chapters on asset allocation and the provided sample asset allocations are now very refined in explanation. His advice on rebalancing, for instance, is even more nuanced than before, and covers all the tax considerations that were not always mentioned in previous books.

He points out on the one hand, given the failure of Wall Street professionals to beat the market or even match the market indices' performance, it seems extremely unlikely that asking all Americans to manage their own 401(k) portfolio would result in a good outcome. On the other hand, hiring a financial advisor is also fraught with danger:
people do not go into the financial services industry for the same reasons that attract individuals to social work, government service, or elementary education. It is rare to meet a hedge fund manager or mutual fund executive who has a vision of the world that extends very far beyond his or her own self-interest. It is not grossly unfair to observe that most seek employment at brokerage houses, hedge funds, and mutual funds for the same reason Willie Sutton supposedly offered for robbing banks: “Because that’s where the money is.” Consequently, you should extend an extra degree of caution to anyone who wants to manage your finances.

These are dilemmas that I myself haven't been able to resolve. Bernstein then finishes up the book by describing how you can inoculate your children against American brand-awareness and marketing, as well as teaching them how to manage their finances well. This isn't typically covered in many financial books, and short as his advice is, I think it will prove effective.

All in all, this is a very good book, and very much worth your time to read. Highly recommended!

Labels: , , ,

Tuesday, November 10, 2009

Kindle App for your PC

The Kindle App for your PC just launched. What's really cool is that it doesn't seem to take up a slot as far as devices are concerned (which I would have known, since I already have 6 devices).

Another nice thing is that tables, etc., show up much larger on a 24" screen than they do in the book. This is particularly useful for non-fiction books, such as Value Averaging, which has lots of tables, equations, and charts, all rendered as pictures on the Kindle.

Even if you don't have a Kindle, and like reading on a netbook, this application basically makes all of Kindle's content available to you. Given the number of free books for the Kindle, that makes it worth the download.

Labels: ,

Monday, November 09, 2009

Review: Every Landlord's Tax Deduction Guide

Every landlord's tax deduction guide is a guide to tax deductions oriented towards a landlord. Of course, some people I know run their rental businesses on a cash basis and evade taxes that way, but I don't advocate doing that, since pissing off the IRS is a good way to lose a lot of money.

Once you've decided to run a legitimate (at least in the eyes of the IRS) business, there are several questions, including:
  • What does depreciation mean, and how do I take advantage of it?
  • If I upgrade the unit, do I get to write that off against income?
  • What if I'm renting out a room in a house, as opposed to the whole house?
  • What if I rent it below market to my cousin?

As you can see, any complication at all, and you need to start worrying about how the tax system works. In addition, by knowing what sort of items are deductible, and what aren't, you get to do better tax planning and increase your after-tax profits.

You expect tax books to be extremely boring, but this one was very well-written. It's still not as interesting as say, a Richard Morgan novel, but if you read it in small chunks everything is laid out clearly and you won't be bored. The only obvious flaw I can find is that they don't emphasize how fraught with danger the home office deduction is --- it is easily the biggest red flag the IRS looks for when seeking tax cheats, and if all you do is set aside a small portion of your home for it it is probably not worth putting up with the tax audits as a result.

All in all, this book is recommended if you're running a rental business --- I can see myself looking over it again in April as I file my taxes. And before you ask, yes, if you're running a rental business this book does qualify as a deduction.

Labels: , ,

Sunday, November 08, 2009

Review: LG WM2016 Washing Machine

One of the benefits of owning a house is that I now get to have a washer and dryer. Prior to moving into my house, I had been doing laundry at work. At one point, I even would rig up a trailer to my bike so I could ride in with a load of laundry and get it done. It felt a bit ridiculous, but since I had absolutely no room at my apartment for a washer and dryer, I felt entirely justified.

When I moved to Munich last year, the office there didn't have a laundry machine at work, so I was forced to buy a used washing machine. Talk to a European who's lived in the USA about washing machines, especially a German, and you'll get a lecture about how German washing machines are much better in terms of cleaning laundry, energy efficiency, water efficiency. A typical German would tell you, "The only thing the American machines are good at, is not washing your laundry very well quickly!" German machines took a long time to run.

To my surprise, when I started shopping for washing machines, the one that stood out was the LG WM2016. It was the lowest priced machine that qualified for the PG&E energy efficiency appliance rebate. In fact, for Santa Clara county, the water company chipped in for a grand total of a $200 rebate, so the fact that it was $600 cheaper than all the other Tier 3 machines meant that it was a no-brainer. Consumer reports said good things about it, as did all the other web-sites that rated energy efficient washers. I bought the machine at BestBuy, in part to get the delivery and installation taken care of (these high efficiency must be properly leveled, so it's worth the $30 to get them to do it for you), and in part to pick up a 5 year warranty. I don't usually pick up extended warranties for products, but my brother convinced me that these front-loader units (at least the ones sold in America) are still not fully debugged, and since I intended to get a renter, I decided that the reviews on epinions meant that I should get a warranty.

Operating the machine is pretty straight forward: stuff all the laundry into the drum, close the door, drop in some detergent and bleach, and push the play button, and all the defaults will do the right thing. This machine was more sophisticated than my German machine in that it gave me a time estimate for when the laundry would be done (and yes, expect it to take at least an hour).

The trick lies in the various rules you have to abide by if you want to keep your machine reliable. First of all, you must use HE-rated detergent. This is a big deal because normal detergent generates too many suds for these machines, eventually clogging up the machine's outbound pipe, and resulting in a dead machine. I thought the detergent would be more expensive, but it turns out that Safeway sells a 96-load pack of HE detergent for $10 under their house brand. To prevent the renter from cheaping out and using normal detergent, I've simply folded the cost of detergent into her rent, so she uses ours.

Next, when you're done with laundry, you must leave the laundry door open. Actually, all washing machines have to be treated this way, otherwise, mold will grow in the machine and your clothes will never smell clean again. It's just that a top-loading machine would typically have its lid open when laundry is done without interfering with anything else, while a front loader's door could get in your way. I solved this problem by putting the washing machine in a place where the open door wouldn't be an issue.

The machine has all the functions you might expect --- separate settings for washing towels, delicates, even a hand-wash mode. You can pre-rinse, pre-wash, add an extra wash cycle, set spin speeds, and decide what temperature of water to use. When it first starts up, it will turn the drum over --- that's the machine weighing your laundry so it can figure out how much to use! The result is the machine is very quiet, extremely water and energy efficient, and takes forever to do laundry. That would have driven me wild if I had to share a laundry machine with 10000 other Googlers, but for just Lisa, me, and the renter, it's just fine.

All in all, we've had the machine for 4 months now, and it's working like a champ. We're not heavy laundry users, maybe doing a couple of loads a week, but we're quite pleased with it. I'll post a long term report after a few years to see how it goes.

In case you're wondering, for the dryer, we just went with whatever scratch-and-dent unit Best Buy had in stock and went for the cheapest one. There's no difference in energy efficiency amongst gas dryers, so that's the correct selection method.

Labels: , ,