Skip to main content

Cay Horstmann

Cay Horstmann is author of Core Java (Sun Microsystems Press 1996-2009), Enterprise Java for Elvis (Sun Microsystems Press, to appear), and co-author of Core JSF (Sun Microsystems Press 2004-2009) Cay is professor of computer science at San Jose State University. He is a computer science series editor at Prentice-Hall and a frequent speaker at computer industry conferences. For four years, Cay was VP and CTO of an Internet startup that went from 3 people in a tiny office to a public company.


cayhorstmann's blog

Scala for the Impatient—Free Chapters at

Posted by cayhorstmann on August 26, 2011 at 2:33 PM PDT

My hard-hitting, tell-it-as-it-is Scala book draft is coming along. No animals or fruit have been pressed into service for contrived examples. Free chapters are at ♦

Whatever Floats Your Boat

Posted by cayhorstmann on August 14, 2011 at 5:14 PM PDT

Inner Classes in Scala and Java

Posted by cayhorstmann on August 5, 2011 at 4:19 PM PDT

Java 7 Unsafe at Any Speed?

Posted by cayhorstmann on July 29, 2011 at 4:32 PM PDT

In Praise of Language Specs

Posted by cayhorstmann on June 27, 2011 at 7:25 AM PDT

I give an example of why having a language spec builds confidence in a situation that would induce fear and trembling in a seat-of-the-pants programming language. I boldly generalize to posit that it is good to have multiple implementations of a spec, and that there should be more than one implementation of the Java platform. ♦

There Will Be Monads

Posted by cayhorstmann on June 18, 2011 at 9:37 PM PDT

I finished my "modern programming languages" course at the Ho Chi Minh City University of Technology. We covered metaprogramming (with Ruby and Rails), continuations (with Racket and Scala), concurrency (with Scala and Clojure), and finished off with a dose of Haskell to see type inference and type classes in action. Here are the hardy souls who stuck it out until the end.

Easy Red-Black Trees

Posted by cayhorstmann on May 12, 2011 at 3:46 AM PDT

A red-black tree is a binary search tree with the following additional

A Dozen Concurrency Pitfalls

Posted by cayhorstmann on May 4, 2011 at 8:52 PM PDT

I needed some filler material for my lectures on concurrency. I googled around for Java concurrency pitfalls and came up with a nice mixture of golden oldies and new ones (at least new to me). I cleaned them up and translated them into Scala because that's what we use in the course. Here they are, for your puzzling pleasure.

Parallel Arrays in Scala

Posted by cayhorstmann on May 4, 2011 at 1:49 AM PDT

Having a Racket with Pictures and Continuations

Posted by cayhorstmann on March 22, 2011 at 8:50 PM PDT

In this blog, I describe how the Racket language provides fun graphics and a nifty web framework. The  former is great for beginning students, and the latter is helpful for grasping the mind-bending concept of continuations. ♦