Author Archives: newhoggy

Java: Cleaning up after yourself

Most sensible Java programmers know that garbage collection is no substitute for careful de-allocation of resources. In Java that a class typically allows you to do this on a per object basis with the close method. On .net, this the … Continue reading

Posted in Uncategorized | Leave a comment

Java NIO: Must remember to avoid using SelectionKey.attachment

Must remember than SelectionKey.attachment is evil and should never be used to store anything that has a handle on a buffer.

Posted in Uncategorized | Leave a comment

Scala: More differences from Java

Method declarations use the def keyword and follow’s Scalas syntax rules of putting the type after the symbol for argument variables. In our send method below, the statements within look a lot like Java code with some minor differences: On … Continue reading

Posted in Uncategorized | Leave a comment

Scala: Declaring classes

Scala classes are public by default. It Java, to define a class with a field, you need to define the field an argument in the constructor for that field and an assignment from the argument to the field to initialise … Continue reading

Posted in Uncategorized | Leave a comment

Scala: Rewriting from Java

I’ve taken the ROX NIO tutorial code, fixed it up a bit, translated it to Scala and uploaded both the Scala and Java to https://offsync.googlecode.com/svn/tags/rox-nio-tutorial-source I’ll be looking at some of the differences between the Scala and Java code.

Posted in Uncategorized | Leave a comment

Very useful Java NIO resource

I highly recommend the ROX Java NIO Tutorial for learning about Java NIO. Java NIO made no sense to me whatsoever until I read this page.

Posted in Uncategorized | Leave a comment

Scala: Declaring variables and methods

The first thing that hit me in my first encounter in Scala is the different syntax for the declaration of variables. In Scala it is defined in one of two ways: The first line defines an immutable value (i.e. constant … Continue reading

Posted in scala, software development | Leave a comment