Cay Horstmann
horstmann.com · Personal blog · on HN since 2011
Cay Horstmann, a computer science professor and author, hosts his programming books and notes on Java, C++, and Scala.
What HN saysHN commenters praise his Scala for the Impatient and his teaching, and point to his Scala page as a good introductory text.
32HN people shared it
15linked it in comments
24stories submitted
727story points
3 months agolast shared
2011people per year2026
Most-shared posts
- 1Ebook: Scala for the Impatient4 people · 6 points · first shared 2011 · discussion on HN
- 2C++ pitfalls3 people · 55 points · first shared 2012 · 31 comments on HN
- 3Index3 people · first shared 2014
- 4Homepage3 people · first shared 2012
- 5Java in the Small2 people · 413 points · first shared 2024 · 331 comments on HN
- 6C++ for Java programmers2 people · 2 points · first shared 2012 · discussion on HN
- 7The Horstmann Brace Style2 people · 2 points · first shared 2018 · discussion on HN
- 8Code Page 437 Refuses to Die1 people · 197 points · first shared 2016 · 89 comments on HN
- 9Help My LocalDate Isn't Flattened1 people · 20 points · first shared 2025 · 2 comments on HN
- 10Teaching Java Is Getting Simpler1 people · 6 points · first shared 2025 · 1 comments on HN
- 11Stop Using Char in Java. and Code Points1 people · 5 points · first shared 2023 · 3 comments on HN
- 12Core Java SE 9 for the Impatient1 people · 3 points · first shared 2017 · discussion on HN
- 13Core Java 13th Edition at the Printer1 people · 3 points · first shared 2024 · discussion on HN
- 14Linux High DPI Settings1 people · 3 points · first shared 2025 · discussion on HN
- 15German Driving Licenses for Expats1 people · 2 points · first shared 2026 · 3 comments on HN
What HN people wrote when they linked it
jbarham · 2012-05-08
I'm in the same boat. It's an old joke that Java tried to kill off printf style formatting but had to bring it back because it's a really great idea:
1980: C
printf("%10.2f", x);
1988: C++
cout << setw(10) << setprecision(2) << showpoint << 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)
(from http://www.horstmann.com)
To complete the circle I'd add:
2009: Go
fmt.Printf("%10.2f", x)
ggerules · 2024-12-18
Dr. Horstmann was my advisor in college, San Jose State.
I just loved his lectures, very dry sense of humor, and extremely funny.
He was just getting started writing books in the early 90s. He has this awesome way of thinking about programming, that I imparted to my own students when it came my turn to teach programming. I wish there some videos of his classes that I could go back to and share with people.
Good website also, https://horstmann.com/
The picture on the website with him in the row boat has a funny story with it. When asked why he is in a row boat, he would reply, "Students are in the row boat with me, learning to program. At some point I push them out of the boat into the eel infested lake. The ones who are clever enough to make it back to the shore will be good programmers." All of this said with a faint hint of a German accent and a sly smile.
If you happen to read this, Dr. Horstman. I made it to shore. Thanks! It has been an awesome journey!
rubiquity · 2014-07-15
I've never used Scala, but a few weeks ago it was really hot outside so I walked into a book store to cool off. I noticed "Scala for the Impatient"[0] was sitting on the bookshelf and I was intrigued. I sat down with the book and about an hour and a half went by without looking up. I think it's a great book and a very interesting language. I might have explored Scala more if I wasn't already quite busy with Elixir[1].
0 - http://www.horstmann.com/scala/index.html
1 - http://elixir-lang.org/
thebluesky · 2012-10-01
Best introductory text:
http://horstmann.com/scala/
Best IDE:
IntelliJ community edition (free) + Free Scala plugin
http://www.jetbrains.com/idea/
Symmetry · 2012-05-12
Both claim to have gotten it from http://www.horstmann.com/
62951413 · 2024-04-17
Core Java by Cay Horstmann (https://horstmann.com/corejava/) is a well-structured and concise review of major features. Historically, the most interesting chapters were scattered across both volumes. So completely skipping the "Fundamentals" volume was ill-advised while the "Advanced Features" volume had some boring and mostly unnecessary chapters.
amelius · 2022-08-27
Does anyone remember ChiWriter?
https://horstmann.com/ChiWriter/
https://en.wikipedia.org/wiki/ChiWriter
marvy · 2018-10-16
Horstmann style looks like my ideal, but there's very little tool support for it, from what I've seen. For instance, if I want to swap the first two lines of an "if" statement, I can't use "line-based" copy/paste. Do you do things manually, or does your editor support it fairly well?
EDIT: looks like the tool support is so bad, Horstmann himself pretty much gave up:
http://horstmann.com/unblog/2010-06-28/braces.html
gh0zt · 2017-03-27
As you are asking for books
- Scala for the impatient (http://www.horstmann.com/scala/)
- Programming in Scala (https://booksites.artima.com/programming_in_scala_3ed)
I found those books very good resources. The Scala website lists a few others (https://www.scala-lang.org/documentation/books.html)
Aprt from that I found Daniel Westheides blog a very good starting point (http://danielwestheide.com/scala/neophytes.html)
yareally · 2015-05-26
I read through Scala for the Impatient when I was initially learning Scala a few years ago. It's relatively new and written for version 2.10. Scala is on 2.11, but compared to 2.09 → 2.10, the changes are minimal. The book itself cuts out a lot of the BS and gets down to what a user wants to know about the language (features, syntax, how it differs from Java, etc).
Most Scala books were written pre 2.10, which makes them outdated enough that it would be hard for many new adopters of the language to get much out of them.
First 1/3 of the book is free online. The entire book is only $20 or so on Amazon.
http://www.horstmann.com/scala/index.html
justthistime_ · 2015-04-17
Which issues did you experience with http://www.artima.com/pins1ed/? (It's a slightly older version, but there aren't many changes which would be important for newbies.)
Partially free:
Atomic Scala also has at least a free sample, which expects basically no programming experience at all: http://www.atomicscala.com/free-sample/
Scala for the Impatient is also nice, but is more intended to help programmers get up to speed with Scala as fast as possible: http://www.horstmann.com/scala/index.html
gtani · 2012-12-29
besides staircase book (the one from Artima.com:
the other good starter book: http://horstmann.com/scala/
detailed looks, all angles: http://www.manning.com/suereth/
lumberjack · 2012-11-13
http://cplusplus.com/doc/tutorial/
http://www.horstmann.com/ccj2/ccjapp3.html
http://www.4p8.com/eric.brasseur/cppcen.html
I was in a similar situation just lately. The above are some very good introductory stuff I found very useful.
shagie · 2023-02-10
I would point to the Oracle vs. Google Supreme Court decision.
https://www.cnn.com/2021/04/05/tech/google-oracle-supreme-court-ruling…
> Writing for the Court, Breyer said that while it is difficult to apply traditional copyright concepts in the context of software programming, Google copied “only what was needed to allow users to put their accrued talents to work in a new and transformative program.”
> A world where Oracle was allowed to enforce a copyright claim, Breyer added, “would risk harm to the public” because it would establish Oracle as a new gatekeeper for software code others wanted to use.
The fair use tests that were used in the SCOTUS case, I believe, would fall on the side of "developers using GPT or Copilot to generate code do not generate substantial parts of the code and are below the amount of work needed to show sufficient creativity in writing it."
The example is https://horstmann.com/unblog/2010-11-15/NodePolicyImpl.html
If that is not a copyright violation and considered to be fair use, then the code generated by GPT or Copilot likely also falls in the the same bucket.
I don't necessarily agree with that, but that's my reading of the tea leaves.
PeterCorless · 2020-02-04
There are tradeoffs with all languages. C++ avoids the GC, but you then have to make sure you know how to avoid the common pitfalls of that language.
We use C++ at Scylla (saw that we got a shout-out in the blog! Woot!) but it's not like there isn't a whole industry about writing blogs avoiding C++ pitfalls.
C++ pitfalls through the years...
• https://www.horstmann.com/cpp/pitfalls.html (1997)
• https://stackoverflow.com/questions/30373/what-c-pitfalls-should-i-avo… (2008)
• http://blog.davidecoppola.com/2013/09/cpp-pitfalls/ (2013)
• https://www.typemock.com/pitfalls-c/ (2018)
I am not saying any of these (Go, Rust, C++, or even Java) are "right" or "wrong" per se, because that determination is situational. Are you trying to optimize for performance, for code safety, for taking advantage of specific OS hooks, or oppositely, to be generically deployable across OSes, or for ease of development? For the devs at Scylla, the core DB code is C++. Some of our drivers and utilities are Golang (like our shard aware driver). There's also a Cassandra Rust driver — it'd be sweet if someone wants to make it shard-aware for Scylla!