Welcome to Cay Horstmann’s Home Page!
cay@horstmann.com | PGP Key
I grew up in Northern Germany and attended the Christian-Albrechts-Universität in Kiel, a harbor town at the Baltic sea. I received a M.S. in computer science from Syracuse University, and a Ph.D. in mathematics from the University of Michigan in Ann Arbor. For four years, I was VP and CTO of an Internet startup that went from 3 people in a tiny office to a public company. I now teach computer science at San Jose State University and held visiting appointments at universities in Switzerland, Vietnam, and Macau. In my copious spare time I write books and articles on programming languages and computer science education.
Links
Books
The March of Progress
- 1980: C
-
printf("%10.2f", x);
- 1988: C++
-
cout << setw(10) << setprecision(2) << fixed << x;
- 1996: Java
-
java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
String s = formatter.format(x);
for (int i = s.length(); i < 10; i++) System.out.print(' ');
System.out.print(s);
- 2004: Java
-
System.out.printf("%10.2f", x);
- 2008: Scala and Groovy
-
printf("%10.2f", x)
(Thanks to Will Iverson for the update. He writes: “Note the lack of semi-colon. Improvement!”)
- 2012: Scala 2.10
-
println(f"$x%10.2f")
(Thanks to Dominik Gruntz for the update, and to Paul Phillips for pointing out that this is the first version that is checked at compile time. Now that's progress.)
Programming and Software
- CodeCheck, a convention-over-configuration autograder for Java, Scala, Python and C/C++.
Violet is a free, easy to use UML editor.
- Safe STL is a safe version of the original HP STL implementation. For a modern safe version of STL, check out Boris Fomitchev's STLport.
- C++ Pitfalls
- C++ Iostreams
Are you frequently trapped in boring meetings? Are you a fan of the Great Underground Empire? Download a z-machine interpreter for your favorite device (for example Android or Linux) and the Zork games from Peter Scheyen's Infocom page, and make your meetings more productive.
Fun Applets
Check them out to see what was exciting circa 1995.
- Traffic jam simulator. This is an applet that is fascinating or depressing, depending on your outlook. It simulates the traffic flow on a freeway and shows how traffic jams are inevitable even at modest loads if too many people don't maintain their speed.
- Retirement calculator. This applet calculates how much money you will have left for your well-deserved retirement, under various savings scenarios. Another one of those fascinating/depressing applets. From the first edition of Core Java.
- Weather report. Get an up-to-date weather report the hard way. Also from the first edition of Core Java.
- Traffic light simulation. This is an applet that I wrote for David Bellin's CRC book. It simulates traffic signals at an intersection.