Profile cover photo
Profile photo
Cay Horstmann
In my copious spare time, I write about programming languages and computer science education.
In my copious spare time, I write about programming languages and computer science education.

Cay's posts

Post has attachment
Google gave my grad students some free credits to use Google Compute Engine. Here is how we set up a Play app with autoscaling and https support.

Post has attachment
Woohoo! Gigabit fiber is coming to the Horstmann residence, thanks to Sonic. And it's the same price as crummy DSL! And the installers did an unbelievably awesome job routing the fiber into my wiring closet!!!

I had switched to Sonic years ago even though their DSL was a little pricier than AT&T because it meant no longer having to talk to the outsourced AT&T tech support who, after wasting my time for hours without resolving my problems, invariably asked "Have I provided you with excellent service today?" 

Now, with fiber speed at DSL prices, it's a no brainer. If you live in or around SF, check out their coverage area and see if you are in!

Post has attachment
Working on updating "Scala for the Impatient" to Scala 2.12... The Scaladoc in 2.12 does away with the listing of classes on the left hand side and instead puts up a search bar on top. At first, I thought I'd hate it.
But now I am sold. Searching is better than being organized :-)

Post has attachment
I remember a Java One where Jonathan Schwartz was perfectly happy on stage that Android was being built with Java, even though it was pretty clear that he would have been even happier if Google had taken out a license. But then again, why would they have done that? Would they then have been associated with the stinker that was Java ME? Android broke new ground, building on top of open source, and that's how it should be ... provided, of course, that they share back.

It's pretty sad to see how all that ended up in a courtroom.

Post has attachment
console: 1. to alleviate or lessen the grief, sorrow, or disappointment of; give solace or comfort. — That's what I need more of after trying to demystify the behavior of System.out in the Windows console. Read on if you want to be consoled and enlightened.

I am updating the section of Core Java that explains how to make a POST request. The service that I used in the previous edition was discontinued, so I tried using the USPS ZIP code lookup. The POST redirects to a GET, but that's ok—HttpURLConnection can handle redirects. But when the user agent contains the string Java, the post office redirects to a dead end!

Post has attachment
Do you have a web site with one of those old-fashioned web hosts? Do you feel inferior when reading how everyone else uses S3 for a static site, like this fellow?

So I gave this a try, and I am here to tell you that it may not be worth it, unless you want to learn a whole lot more about DNS than you probably do. For my domain,, I have two modest requirements. (1) I want to get my email. (2) I want people who visit or to see my website.

It is trivial to load your pages into an S3 bucket. You then get a  site with a cheery URL such as

And then you can fuss with Amazon's DNS server (Route 53), but it's a fiddly thing and StackOverflow is full of people who are no smarter than I am and repeatedly erased and recreated configurations until stuff happened to work.

Or you can try to mess with the DNS settings at your registrar. Don't do it if you want both mail and web. I learned the hard way that there is no good solution. Since Amazon's IP address is a moving target, you can't use an A record for your web site. You can't use a CNAME record either because some mail servers out there will then try to send mail to the CNAME target instead of querying the MX records. And if you try to use the registrar's web forwarding, it's either a hack involving iframes, or they redirect to the weird-looking S3 URL that you don't want people to see.

Now I know what I pay my web host for: A static IP address.

Post has attachment
One reason to go to an education conference is to have one's belief in the blindingly obvious confirmed. This paper, presented at SIGCSE 2016, concludes with: "In this paper, we have found evidence that programming ability is hierarchical, and goes beyond what can be as-
sessed by a multiple choice test."

Hear, hear. I taught CS1 many times without a single multiple-choice question on an exam, much to the chagrin of the students. After all, it's loops and array and functions that matter, and a pretty good way to test those topics is to make students trace code, fix code, or write code. 

And when teaching CS2, many students joined the class who had learned to excel in multiple-choice questions in CS1, with a limited ability to write code. Many of them caught on and wrote in their evaluations something like "assignments much more reasonable towards the end of the semester", but unfortunately others didn't in time--"assumes super-human powers from students".

Another paper in the same conference proposed a multiple-choice test for assessing a "concept inventory" of programming knowledge. I went to the presentation, and it didn't pass the smoke test for me. I wish I had read the other paper first so that I could have raised my hand and said "Aren't you aware that there is evidence that programming ability is hierarchical, and goes beyond what can be assessed by a multiple choice test?"

Post has attachment
Check this out:

"What makes Core Java the definitive work on the language
is more than its vast scope—it is the quality of the presentation"

Sweet words indeed from one of the more curmudgeonly reviewers in our field--Andrew Binstock of Dr. Dobbs' fame, and now the editor of Oracle's Java Magazine (which--from one curmudgeon to another--has gotten quite good since he took over).

Post has attachment
I spent the better part of a day trying to figure out why a clearly documented API call didn't work as advertised. It turns out that the library uses the same class name, but in a different package, for an implementation class with different methods, and Eclipse auto-completed to that package. That's reprehensible. Don't entrap your fellow programmers like that!
Wait while more posts are being loaded