Caffeine Peter Colijn
(RSS)

November 28, 2010 (link)
Since last time

Let's see, since last time [1], I got married, switched teams at work, did one third of a triathlon (guess which third), rode 175 miles for a charity ride, bought a new bike and (almost) bought a condo.

Health care (revisited)

But where we left off was with me having just broken my elbow, and documenting some of my experience with health care in the US.

Since then, my elbow has completely healed, and I think I'm done dealing with all the paperwork for that particular incident. So how did it go?

The specialist

Well, I did eventually get the appointment with the orthopedist. And the first time I went, I thought he was great. He was nice, gave me a fair bit of information, showed me my X-rays and explained what I had actually done to break the bone.

However, I went to see him every 2-3 weeks after that for the next 10 weeks (I think I ended up going a total of 4 times) and every time he basically just said all the same things over again, without any new information. So I became less impressed as time went on, because he either didn't remember what he had told me previously, or thought I was stupid enough to forget every time.

Spoiled

The main issue I had though was that he had prescribed some physical therapy, but my insurance would only cover it if I got it at one particular facility in San Francisco. I was supposed to go several times a week, and this was really inconvenient for me since it would mean I would have to work from home those days. Working from home every once in a while is fine, but I have meetings and interviews and other things that really do require me to be in Mountain View, so working from home 2-3 days a week would suck. This is another case where an HMO plan really sucks.

As it turns out, Google actually has a physical therapist on site. Yeah, we're spoiled. Anyway, they were busy but I was eventually able to get some appointments there for only a $5 co-pay. This is extremely unusual, though. Very few employers have on-site phyiscal therapists. It does work to Google's advantage to have it, though: because of the on-site physical therapy, I was able to come to work on a pretty normal basis during my recovery.

Since a lot of people in the US commute a long way to work, I was surprised that this situation isn't really handled at all with HMO plans. You choose a doctor near either your home or your work, and then if that isn't convenient you're just kind of out of luck. It's definitely an incentive to live near your work, which I know is good for all sorts of reasons, but I really don't want to live in Mountain View.

Billing

The other noteworthy part of this whole story was the billing. My emergency room bill (for 2 X-rays and a splint) was $2500. The insurance company paid the hospital $1200ish and they were ok with that. That's less than half the original bill. This is the "group discount" that the insurance company gets. Basically, they negotiate lower rates for everything with the hospital. If the hospital doesn't agree, they won't have a contract with that insurance company and will have fewer patients as a result.

The effect of this system is that you really want to have insurance with one of the large providers accepted at most medical institutions. This makes small health insurance providers less viable, and the industry as a whole less competitive. I guess the problem is that in general you don't shop around for urgent care. It's urgent, so you go to the closest place. This means that hospitals don't need to compete on price, at least not for urgent care.

I'm not sure what the solution to this problem is, but I definitely think the health insurance industry could do with some more competition. I don't think anybody I've ever met here has been happy with their health insurance.

Holy wars

On a completely different topic, since I recently switched teams at work I started writing more C++ than Java. And I had to point out a few things, since most folks I know seem to be of the "let's bash Java at any possible occasion" persuasion.

Garbage

The first thing that struck me was that writing something fairly simple in C++ just felt like a lot more "work" than in Java, and the main source of mental exhaustion for me was tracking ownership of everything. Especially when you're working with large libraries, this is a lot of work. When you pass something to some other class, you need to know if it's taking ownership or not. If not does it expect the referenced object to survive after that call or not? There's no standard way to express these things in code (I know people have made some attempts with smart pointers and other horrible templatized messes, but as far as I know none of these has been widely agreed upon as a good idea, and more importantly, no such things are in use at Google).

So, what this means is that every time I use somebody else's library I have to look at every function to see what the memory management requirements are. Sometimes it's documented in the header. Sometimes I have to dig into the code and figure it out for myself. Sometimes it's documented incorrectly in the header. Yay.

So, in general, I'm a believer in GC. That doesn't mean I think GC is good in every circumstance. It's certainly less predictable than manual memory management. It's certainly still possible to have leaks when you have GC. It's unsuitable for hard real-time environments. It doesn't make sense inside OS kernel code. I know all that. But, in general, in application and server development, it saves a lot of time and grief.

Seemingly pointless

Map<String, List<String>>

'nuff said. I asked people on the twitwebs about this a while ago, and nobody actually knew why it didn't work in C++, but just that it was due to a conflict in the grammar and that apparently it's fixed in C++0x. I know that, but I was actually interested in where in the grammer this conflict was. I was made more curious by the fact that gcc gives you a very specific error message when you try it, so it certainly seems to be able to detect >> as closing two template expressions distinctly from the right-shift operator.

No consistency

No hashCode or toString equivalents. You can specialize __gnu_cxx::hash, but this only works on GCC, and only for the built-in containers. And you can define an operator<< to output to an iostream, but not everyone uses iostreams, and in particular they're incompatible with printf-style logging systems.

Errors

My god do GCC's error messages suck. This isn't a knock against the language as a whole, since clang has demonstrated that much better error messages can be generated for C++. But still. It's offensive.

Constancy

One thing I really missed from C++ in Java was const. It's a great concept, and has the mutable and const_cast escape hatches if you really need them. The lack of const in Java leads to all kinds of inefficient stuff, like defensive copying and wrapping objects in immutable layers, which always have a runtime cost.

Types, defined

I have to give this one to C++ too, though sometimes I hate it when people go typedef crazy and you're asking yourself "geez what's a Frobber?" only to discover it's an int. Still, type Map<String, Map<String, List<String>>> a few times and that annoyance disappears rather quickly.

Phew

Ok, done now. I've been enjoying writing more C++ again, but I think it's more just that it's nice to be doing something different than anything to do with with C++ itself. Also, while I can be pretty much just as productive in both, I think that's largely due to the vast C++ libraries Google has. Things like thread abstractions and thread pools, synchronization primitives like mutexes and blocking counters, RPC libraries, HTTP frameworks, etc.

The C++ standard library is pretty sparse, especially in comparison to the JDK. The JDK certainly has its share of dark corners and poor design, but it also has a vast collection of useful, well-tested and thoroughly-debugged utilities.

[1] technically, last time was a silly post about how to do something in Debian/Ubuntu. But that doesn't count.

Back: October 2010 Next: June 2011

email: caffeine@colijn.ca