Floating Point to Hex update, and writing tests as a sign of maturity

Over the weekend I published an update to my Floating Point to Hex calculator that allows you to swap the endianness of the hex bytes! Pretty exciting, no? (the answer is: meh)

It was actually more work than it looks like, because I decided to go ahead and update the backing script to Python 3, which meant I had to recompile the C module it uses. When I was about to start doing this I was disappointed to see that I didn’t have any tests in the project, so I went ahead and wrote those before changing everything. And even before I started changing things I found a few bugs (oh negative zero, you are tricky), so it was time well-spent!

I did have to refactor a few things to make the script testable, but I can’t imagine doing a refactor with only the help of spot-checking things, which is what I used to do. Just like writing clean code, writing tests is useful for future you as well as others!

honesty and false hope

1. When I used to go on recruiting trips for NI, often students would talk to me who were majoring in something we weren’t recruiting for. I would feel really bad for them, and I would generally take their resume and go through the process while saying something like “well, I know we do hire people with your background, let me see if I can talk to someone when I get back to NI”. I didn’t want them to leave the NI booth without hope! But it was false hope, because not once did that work out.

Eventually I realized this and started to say “Sorry, we’re not recruiting for people with your background today, but you can apply online for specific positions and see if one looks like a good fit for you”. And people seemed fine with it – they were at a career fair and there were plenty of other companies to talk to, and this way I didn’t waste their time or mine! It seemed less kind, but being honest was the more kind thing to do.

2. When I moved from LiveJournal to WordPress, I wrote a script to migrate posts and comments over and posted it to a WordPress support thread. A few days ago, I got a few emails saying part of the script had stopped working, and after investigating I figured out it was a problem with logging in to LJ – something has changed and I don’t know what. I didn’t respond to those emails for a day because I was trying to figure it out, and then I didn’t really want to respond to the emails at all.

But again, I (eventually) did the right thing and responded saying that something was wrong, I would keep looking at it but I don’t know when (if ever) it would be fixed. And one person emailed me back saying that she had found a different program that worked, and I was able to pass that along to the other people that had emailed me to help them out, which probably wouldn’t have happened if I hadn’t said that I was pretty stuck!

Why health care isn’t like cupholders (or, why essential health benefits make sense)

Apparently the Republican effort to drastically weaken the Affordable Care Act isn’t dead after all, maybe. So I thought it would be a good idea to take a look at one of the issues that came up last time – getting rid of essential health benefits.

Essential health benefits are a list of 10 things that every health care plan is required to cover. (this was a new requirement under the Affordable Care Act) They include things like:

  • hospitalization and emergency care
  • maternity/newborn care
  • prescription drugs

and more. The libertarian/small-government conservative view of this is presumably something like:

Why should the government mandate what you can offer in a health plan? Let the free-market figure it out – if people don’t like what’s in a plan, they won’t buy it and the company will change it to improve sales.

or something along those lines. (I’m trying to make a good-faith representation here – if an actual libertarian wants to correct me, feel free!)

Here’s what I don’t think that makes sense.

Let’s say the government wanted to pass a law (because everybody loves cupholders!) that requires every new car sold to have at least two cupholders. This seems unnecessary for the following reasons:

  1. People know whether they want cupholders in their car
  2. It is exceedingly obvious how many cupholders a car has
  3. There are many car companies, so if a car company refuses to make a car with cupholders other car companies will step in to make cars with cupholders, because they will make more money doing so

Now, back to health care.

  1. The problem with health care insurance is that it’s not a good. If you never have to use your insurance, you’re happy! But you don’t know what kind of health problems you’re going to have over the next year, so expecting people to predict what health care problems they’re going to have and buy the appropriate insurance is pretty unreasonable.
  2. There were many stories before the ACA about people who bought insurance and then were surprised when it didn’t cover something catastrophic. Now, you could certainly argue that it’s the person’s fault for not reading details about their coverage closely enough.

    Here’s another way to think about it. In some poorer countries the water they get is contaminated with various microbes, and aid groups distribute chlorination tablets to make the water drinkable. People in those countries have to remember to use the tablets every time, or they’ll probably get sick. This is a mental burden on them even if they never forget to treat their water. In the US we can afford to provide clean water to everyone, and everyone benefits from it. (I think this example is from Why Nations Fail but I’m not sure)

    Having insurance that doesn’t cover what you think it covers can literally send people into bankruptcy. Yes, this makes premiums more expensive, but that’s why the ACA includes subsidies to help lower-income people afford insurance.

  3. There aren’t a ton of insurance companies, but more problematic is the idea of a “death spiral”. Let’s say company Gold provides a generous insurance plan that covers all sorts of treatments, etc. with a higher premium, and company Bronze provides a very bare-bones insurance plan with a lower premium. If I think I’m a healthy person with a Gold plan, this will make me want to switch to a Bronze plan since the premiums are cheaper. That means that the average person on the Gold plan is now less healthy, which means company Gold will have to raise their premiums to compensate. That will in turn drive more healthy people to leave the Gold plan, and the spiral has begun.

Hopefully this gives you an idea why essential health benefits are a good idea!

Obamacare survives! Some mostly jubilant thoughts

Yay! Here’s one of many articles covering it.

– While part of the problem was the House Freedom Caucus thought the bill didn’t do enough, there were also a chunk of moderates that wouldn’t support it. I saw a number of quotes from people saying they were getting thousands of calls against it and single-digit number of calls for it. Calling your representative can work! See:

– The bill itself was very unpopular (this poll had it at 17% approve 56% disapprove, and that was before they got rid of the essential health services!), which I guess isn’t surprising for something that would have made 24 million people lose health insurance in the next 10 years. This is a good example of how passing Obamacare moved the Overton window – just repealing it wasn’t acceptable to even most Republicans since so many people would have lost insurance.

– Margins matter. The estimates of how many votes the Republicans were short is in the neighborhood of 15 or so when it was closest to passing. If the Republicans had 30 more seats in the House it easily could have passed. (although who knows what would have happened in the Senate…but again, the Republicans have a very slim majority there)

– We’re going to lose a lot. It was great (and important!) to win this battle, but the Republicans still control the House, Senate, and Presidency, so I wouldn’t be surprised if they pass some terrible tax bill or whatnot. So don’t lose hope when this happens, and don’t give up!

why you should oppose the Republican health care bill (aka the ACA “repeal and replace”)

If you want to read the bill itself, you can do so at the clever URL ReadTheBill.gop. I tried to get through it and gave up – it’s 120 pages and not the easiest thing to read. But I do appreciate having the bill easily available!

If you want to read articles by people smarter than me, here’s a pretty good summary, and here’s an article wondering why the bill exists because both conservative and moderate Republicans are unhappy about it for different reasons. And here’s a roundup of how people are responding to it.

Here are some weird/bad things about it:

If you don’t have insurance through your employer, poorer people will get less of a subsidy/tax credit, and richer people will get more – see here for a chart with some samples. The original bill would give a tax credit to everyone (without employer health insurance) based solely on age, so Mark Zuckerberg and I would get the same amount. Now they added some phasing out based on income, so Zuckerberg won’t get anything. But it’s still less progressive than the ACA, and people are worried that more low-income people won’t be able to afford insurance at all.

We don’t know how much it will cost or how many people will lose coverage because the Republicans are voting on it out of committee tomorrow – the plan was released yesterday and they want to vote on it tomorrow! They’re not waiting for the Congressional Budget Office to “score” it, which is awfully suspicious. An expert suspects 15 to 20 million people would lose coverage under the bill.

The individual mandate is gone, but if you stop coverage and later want it your premiums will go up 30% which is just weird. One big problem you have to worry about in healthcare is that people will not buy insurance until they get sick, then they’ll buy it to cover procedures, etc. This can lead to the feared “death spiral” where more healthy people drop their insurance, which makes premiums go up, which makes more healthy people drop their insurance, etc. Pre-ACA insurers dealt with this by either refusing to cover people with “preexisting conditions” or raising their premiums sky-high. The ACA attempted to solve this with the mandate, which says you have to have insurance or pay a penalty. But raising someone’s premium by 30% is probably not enough to dissuade people from doing this.

There’s a sweet tax break for insurance company executives that make more than $500K because it wouldn’t be a Republican bill without a tax break for the rich, I guess?

Six pages of the bill deal with keeping lottery winners off of Medicaid which really threw me for a loop when I started reading the bill! (more coverage here)

writing a test for a bug before fixing it: a good idea most of the time

I’m not fully onboard with test-driven development, but I have started to like it a lot when I’m fixing bugs. First I reproduce the bug manually in the product, then I write a test for it that fails, then I fix it and makes sure that the test passes. Good stuff!

Friday I started working on a bug that I was surprised to see, because I had written a test that I thought should cover it. So I tried it manually in the product, and was easily able to reproduce it. I noticed some differences with the way the test was set up, so I started trying to tweak the test to get it to fail.

And I spent like 4 hours trying to do this, getting more and more frustrated. I could not for the life of me figure out what was going on!

Finally I said “whatever” and investigated the bug in the product. It took me like 10 minutes to find the cause of the bug, which also revealed why my test hadn’t caught it. Another 20 minutes later, and I was able to make a test that failed without the bug fix and passed with it.

So this is a reminder to myself: it’s OK to do things out of order sometimes!