Skip to main content

Blog Archive for cayhorstmann during August 2011

When I write a book, I always imagine who the reader is. Depending on the kind of project, it might be a beginning computer science student, or an experienced engineer starting out with learning a new technology. Sometimes, it's “myself, as I was a little while ago”. That's how it went with Core Java, which sold a huge number of copies when everyone else wanted just what I wanted too...
I am in the process of revising a CS1 textbook. I made changes requested by users, added snazzy exercises and sample programs, and the publisher sent the draft out to reviewers. A couple of reviewers said in no uncertain terms that I was wrong, wrong, wrong in using double for my examples. I should use float instead. Another professor contributed a business problem set that used float where I...
In Scala, you can nest just about anything inside anything. You can define functions inside other functions, and classes inside other classes. Here is a simple example of the latter. (I follow this explanation in a hopefully more intuitive context.) import collection.mutable._class Network {  class Member(val name: String) {    val contacts = new ArrayBuffer[Member]  }...