Tidbits #3 from JCrete 2022—Loom
This is the last of three articles about tidbits that I learned at the JCrete
unconference. Here is an elevator pitch about Loom for those who aren't familiar with it, followed by a couple of observations that shine some light on the essence of Loom.
Tidbits #2 from JCrete 2022—TimSort
, I learned that the sort methods in the Java standard library can throw an exception with the curious message “Comparison method violates its general contract!”. Of course I had to dig into the gory details.
Tidbits #1 from JCrete 2022 - Puzzlers
Every year, Heinz Kabutz and his merry band of disorganizers run the fantastic JCrete
conference. Well, except for the last two years, when COVID-19 put a stop to it. This year, JCrete was back with a limited number of attendees to avoid a superspreader event. This is the first of a three-part series of tidbits that I learned.
Record Patterns (JEP 405)
This article, also posted on http://javaalmanac.io
, describes record patterns, a preview feature of Java 19. A record pattern lets you “deconstruct” a record value, binding each component to a variable. Record patterns work with
pattern matching. Guards are supported. They are particularly compelling with nested deconstruction and sealed record hierarchies.
Virtual Threads and Tomcat
Virtual threads are the ideal mechanism for running mostly blocking tasks, providing a high level of concurrency without requiring asynchronous acrobatics from business logic programmers. I show that it is easy to configure Tomcat for virtual threads, provided one makes a small change to the Tomcat source code.
Pattern Matching for Switch (JEP 427)
This article, also posted on http://javaalmanac.io
, describes pattern matching for
, in its third preview iteration in Java 19. Type patterns allow you to match on the type of the selector value and analyze the value further in a variable of the appropriate type. There are fiddly rules about
, fall through, and case ordering. At the end of each section is a “sandbox” with somewhat contrived code to try out the syntax variations.
Loop Patterns (Java Edition)
In a presentation about teaching new Java features, I casually mentioned that my textbooks for beginning students include a list of common loop patterns (counting matches, maximum, and so on). After all, students can't realistically be expected to invent them on the spot each time they are needed. Attendees asked me about that list. Here it is.
Lies, Damned Lies, and Microbenchmarks
A Fibonacci microbenchmark runs slightly faster with Java 8 than Java 17 on some fellow's laptop. Should you stick with Java 8?
Java 17: The Nice, the Meh, and the Ugly
Java 17 was just released. It is a “long term support” release. Should you upgrade? In this “Java advent” article, I walk you through the nice, the meh, and the ugly.
Sixteen Going on Seventeen!
Today, Java 17 is being released. It is a “long term support” release. I've been updating the Core Java books for this momentous occasion. Maybe not that momentous since the best (Valhalla, Panama, Loom) is still ahead of us. But still nice. And with a ton of bug fixes and security patches. You should upgrade.
CodeCheck Now With Parsons Puzzles
Parsons puzzles are a useful tool for teaching basic programming skills. A Parsons puzzle asks students to solve a programming problem by rearranging tiles marked with code lines. This is a useful bridge towards writing code.
I just added a Parsons puzzle editor to the CodeCheck autograder that makes puzzle authoring easy and enjoyable.
Unicode—One of the Two Hard Problems on the Internet
As José Paumard said, there are only two hard problems on the Internet: Time zones and Unicode. I got flustered by a blog entitled “Make sure you know which Unicode version is supported by your programming language version”. That turned out to be a red herring. The real culprit was a buggy regex implementation in Java.
Book Review: Seriously Good Software
I review “Seriously Good Software” by Marco Faella, another book for intermediate level programmers familiar with Java. The
book uses a deceptively simple problem to explore data structures, algorithms, computer architecture, and software engineering topics. If you wonder what those CS courses (that you were perhaps forced to take) are actually good for, you'll find answers in this delightful book.
Book Review: Java by Comparison
I review “Java by Comparison”, a book that aims to teach intermediate level java programmers to step up their game, through 70 items that are easy to digest. If you are at this level, get a copy. If you work with those who do, get them a copy.
What's in a name?
Did you know that Java identifiers can contain €, a “wavy underline” ﹏ and the bell character? If not, read on for the gory details.
The Perfect Backup Plan
For years, I backed up my laptop every night to a cloud provider without problems. But a few days ago, I was unable to restore a file because my account was “under maintenance”. Time to look for a new service. With a backup script that I can understand.
Adding State Saving and LTI to Interactive Exercises
Project Loom and Structured Concurrency
Project Loom is one of the major “projects” in which Java is moved forward, alongside the perhaps better known projects Amber and Valhalla. It will bring “virtual” threads with low resource footprint and low cost of blocking to the Java plaform. Here is my annual advent season update, this time with a focus on structured concurrency and API changes.
Quadratic Equations Even Easier
Side Effect Puzzles
Inspired by Heinz Kabutz' daily JGym
workout, I present some puzzlers that show how horrible side effects in nested expressions can be.
Sealed Types (JEP 360)
This article, also posted on http://javaalmanac.io
, describes sealed types, which are a preview feature in Java 15. Sealed types allow you to describe type hierarchies that are closed to further inheritance. In this article, you will see the syntactical rules and a number of examples, such as JSON nodes and directory entries.
Checking Code Samples
In this blog, I describe the process that I use to extract sample programs from my latest book to make sure that the code works. Read on if you want to create an automated work flow for checking code that you describe in your blogs, slides, and so on.
Text Blocks (JEP 378)
Java 15 will be released really soon now, and after two preview phases, multiline strings (AKA “text blocks”) are now a permanent part of the language. They work nicely for most common use cases. This article, also posted on http://javaalmanac.io
, dwells (perhaps excessively) on some corner cases to watch out for.
The Script is Mightier...
This is a great time to be an author. It is easier than ever to produce content that actively involves the reader. In this article, I give a few examples and discuss what I learned about creating interactive materials.
Corona Virus and Heron's Theorem
Corona virus quarantine. Home schooling. My teenage daughter asks: “Daddy, how do you compute the area of this triangle?” Well, that is something that I haven't done since I was a teenager. And then only as “base x height / 2”. This wasn't a right triangle, and my daughter didn't yet have trigonometry, so how do you figure the height? She googled and found Heron's formula.
Strings with Zero Hash Code
Here is some light diversion for these difficult times: How to find strings with zero hash code in Java. In particular, how to find one that you can remember. Like "misjudge corona modulation".
How Switch Expressions Are Explained
The four-form switch syntax is now final in Java 14. Here I look at some evidence suggesting that the feature may be harder to teach than its creators anticipated.
What I learned at JSpirit—Graal
Last weekend, I joined the amazing JSpirit unconference. What a venue—a working distillery! We discussed Java, surrounded by barrels and aromatic (and presumably slightly alcoholic) vapors. Here is what I learned about Graal.
Records are a major preview feature of JDK 14. A record is a class whose state is visible to all—think of a
y coordinates. There is no need to hide them. Records make it very easy to declare such classes. A constructor, accessors,
toString come for free, and you can add other methods. Read on to find out how to work with this new feature of the Java language.
Project Loom is one of the major “projects” in which Java is moved forward, alongside the perhaps better known projects Amber and Valhalla. It promises to bring lightweight/userland/virtual threads with low resource footprint and low cost of blocking. If blocking is cheap, then you don't need to worry about callback hell or async trickery. How well is this shaping up as we enjoy the 2019 holiday season? Read on!
At JCrete 2019, Heinz Kabutz led a session that showed a mystery about configuring the thread pool for the
HttpClient class. Setting a new executor didn't have the desired effect. It turns out that the implementation has changed (and perhaps not for the better), and the documentation is lagging. If you plan to use
HttpClient asynchronously, you really want to pay attention to this. As a bonus, there are a few more useful tidbits about using
Down the Collector Rabbit Hole
At JCrete 2019, José Paumard gave a quiz intended to stump the Java experts. One of the questions that I got wrong had to do with
java.util.stream collectors. I know how to use them, but I never bothered to look inside what makes them tick. Read along and find out.
HTML Drag and Drop—What a Drag
Five Golden Backticks
Does 12 in “Java 12” stand for the twelve days of Christmas? If so, then on the fifth day of Christmas my true love gave to me five golden backticks. For delimiting raw strings. Or so I thought. On the 11th day of Christmas, they were gone. A bit awkward because this blog was included in the Java Advent Calendar.
Give Me a
break, or: How to Make Awesome Puzzlers with Java 12
Java 12 provides, in experimental form, a
switch expression and new forms of the
break statements. There is a profusion of new syntax and semantics for constructs that may find little use—except, of course, for authors of puzzlers and certification exam questions for whom this is a wonderful gift. If you enjoy Java puzzlers and would perhaps like to create some yourself, read on.
AdoptOpenJDK Open for Business
Before downloading a JDK from Oracle, you need to know two things. (1) You can't use that software in production without a paid license from Oracle (2) You can only get the current six-month release, not the long-term-support release there. For many users, the OpenJDK from http://adoptopenjdk.net is a better option. However, those downloads don't come with an installer. Here I provide simple installation instructions for Windows, Mac OS, and Linux.
Java 11 Has Arrived
Java 11 has arrived, right on schedule. This is a long-term release, with welcome improvements over Java 8. When installing it, you have—for the first time—the choice between the Oracle license and an open source license for the exact same feature set. And you really want to carefully look into this if you use the JDK in production.
Teaching with Java is Still Free
It's not easy to wade through the recent licensing changes with Java. It's particularly confusing for folks who use Java for education. Fortunately, it's not rocket science. If you teach with Java, relax, there is nothing to worry. Most of you will continue to use the current free version of Java, but you can also get older ones if you need them.
Every year, intrepid Java enthusiasts converge upon the island of Crete to brave questionable air carriers, the intense heat, the allure of beaches, the temptation of tropical drinks, and the astounding disorganization of the conference; all in the quest for knowledge. Here is my trip report.
Core Java 9/10/11 for the Impatient Video Course
As of Java 9, new versions of Java arrive at a fast and furious pace. In this blog, I write about the challenges of updating the Core Java video courses.
Udacity CS046 Revived
In 2013, at the height of the MOOC hype, the president of San José State University and the CEO of Udacity struck up a partnership, to bring modern technology to crufty old higher education. Three courses, on “developmental” (i.e. remedial) math, college algebra, and statistics were produced, with predictably poor results. But there was a fourth course that did much better—CS046: Introduction to Java Programming. Udacity's business model has long since shifted to corporate training, so it was time to set the course free.
Embedding Interactive Learning Elements
Would You Like Your Strings Raw or Medium Rare?
A new feature is proposed for Java 11 (maybe): A simple syntax for strings that can span more than one line and that can contain arbitrary characters without the need for escaping any of them. No more double backslashes in regular expressions and Windows path names. But as with all things simple, the devil is in the details.
Launching Single-File Source-Code Programs
A new feature is proposed for Java 11: To launch a Java program consisting of a single file, you can skip compiling it. This is proposed as a feature to make learning java easier. Having some experience in teaching Java to beginners, I explain why it does not.
An Easy Solution for the Gear Ball Puzzle
My daughters keep bringing home various puzzle cubes, expecting me to solve them. The gear ball seems like an evil Rubik's cube. Rotating one face causes the opposing face to rotate in the opposite direction. At first my brain hurt watching it, but I now realize that the gears severely limit the number of possibilities. Here is a simple algorithm for solving it.
An Easy Solution for the Pyraminx Puzzle
My daughter Emily knows how to solve a Rubik-style pyramid puzzle. I tried learning her method, but I am no good at spotting the patterns that she recognizes effortlessly. Here is a simple recipe suitable for dads.
How is the Grand Social Experiment Coming Along?
In Java 11, the JAXB module is removed, and the “open modules” example from Core Java for the Impatient no longer works. I had to find a module in the wild to replace it. How is the grand social experiment of library modularization coming along? Not too badly, actually.
Solving the Mefferts Skewb Xtreme
And now for something entirely different—solving a cube puzzle with the aid of a Prolog program
Confessions of a Fallthrough-Hater
Java is getting a multi-way selection expression, and an updated
switch statement. Join in for more bikeshedding .
Give Me a Break
Java is getting a multi-way selection expression. Check out the current design, and join the bikeshedding.
A Play App on Google Compute Engine
Google gave my grad students some free credits to use Google Compute Engine. Here is how we set up a Play app with autoscaling and https support.
Code Page 437 Refuses to Die
console: 1. to alleviate or lessen the grief, sorrow, or disappointment of; give solace or comfort. — That's what I need more of after trying to demystify the behavior of
System.out in the Windows console. Read on if you want to be consoled and enlightened.
The Post Office Hates Java
I am updating the section of Core Java that explains how to make a POST request. The service that I used in the previous edition was discontinued, so I tried using the USPS ZIP code lookup. The POST redirects to a GET, but that's ok—HttpURLConnection can handle redirects. But when the user agent contains the string Java, the post office redirects to a dead end!
If You Don't Want Users to Use a Class, Give it an Ugly Name!
I spent the better part of a day trying to figure out why a clearly documented API call didn't work as advertised. It turns out that the library uses the same class name, but in a different package, for an implementation class with different methods, and Eclipse auto-completed to that package. That's reprehensible. Don't entrap your fellow programmers like that!
Oh Goody—My New Build System Gives Me Stack Traces
My pet peeve from Java EE is the “stack trace from hell”, when the app server shares its pain with me, showing a stack trace, instead of telling me in which source file I messed up some setting. Oh goody—I just switched my Android build to Gradle, and it acts the same way. Hello, dev tooks makers. If you can't trace back your failure to the file name/line number of my artifact, you have failed.
Some Small Details About Working with Play
In my last blog, I marveled how the dull pain of Java EE stacktraces melted away after I started using the Play framework, where each error was clearly reported with the file name and line number of the offending artifact. Here are some small details that I ran into.
All Work and No Play
All work and no play makes Jack a dull programmer. And I just felt the dull pain of another stack trace from hell from my Java EE app server. There has to be a better way. So I ported the troublesome code to run on the Play framework, and it was all play. No stack trace from hell, just a few screens with clear error messages, and then sweet success.
Years ago, I designed a “refcard” for DZone that tried to cram all of Java into eight pages. Now a Java 8 update is available, thanks to Bulgarian JUG leader Ivan St. Ivanov. Check it out!
Arrows of Outrageous Fortune
At Java One, I overheard someone mentioning an outrageous trick to abuse the arrow
-> of the lambda syntax. Of course I had to investigate. Here are the gory details...and please, kids, don't try this at home.
Sayonara java.net Blog. Welcome Unblog.
For almost ten years, I had a blog on java.net
. I am grateful for having been given a platform and a community for my thoughts, but sadly java.net has fallen apart. I still want to share the occasional tidbit of useful information and rant about the latest injustice, but I don't want to find a new home just to see it fall apart too ten years from now. So, I am starting an unblog on my very own website.
Back from the JCrete Unconference
Some time ago, I got an invitation from Heinz Kabutz (the man behind the Java Specialists newsletter
, to which you should subscribe right away if you haven't already), to join the JCrete
The Curious Case of the
It's been almost twenty years that Gary Cornell contacted me to tell me “Cay, we're going to write a book on Java.” Those were simpler times. The Java 1.0 API had 211 classes/interfaces. And Unicode was a 16-bit code.
Trying out the Java 9 REPL
A REPL (read-evaluate-print loop) is an integral part of dynamic programming languages such as Lisp or Python. It's a great tool because you can experiment with language and library features without having to write complete programs. If all goes according to plan, Java 9 will have its own REPL. In this blog, I show you how to build the pre-release version and play with it.
Hello Java 8 (and how it makes GlassFish speechless...)
After all these years, Java 8 is finally available. Just make sure you don't get tripped up by the change in the classfile format!
Sign Your Applets, Or Else...
Remember applets? When Java was first introduced, applets were what excited everyone. No more desktop apps! Deliver code from the server!! Run it securely in the browser’s sandbox!!! That was then. Java 7 update 51, which was released January 14, 2014 will only run signed applets. If you still have any applets and haven’t gotten around to signing them, here is how.
Java 8 for the Really Impatient
Java 8 is the biggest advance in the Java language since, well, Java 1, even bigger than the addition of generics in Java 5. I figured that every Java programmer would want to come up to speed quickly with these changes and wrote a short and snappy book “Java 8 for the Really Impatient”. A “rough cuts” version is now available on Safari.
Scanners Live in Vain
In the bad old days. you had to turn an
InputStreamReader into a
BufferedReader if you had the desire to read lines of text. Java 5 introduced the
Scanner class, and I never looked back. But the
Scanner class is getting no respect. Java 8 makes you use a
BufferedReader, with all that layering nonsense, if you want a stream of lines from a URL. Why not a
Scanner? Or, if
BufferedReader is so loved, why not add a few constructors?
Java One for the Impatient
Here are my impressions from the 18th Java One. Java SE 8 is around the corner, Java EE 7 was just released, and both are a joy to use. NetBeans 7.4 is awesome. And yet, people were strangely blasé at the conference. I still remember how much excitement there was at Java One when Java was in its infancy, and the promises greatly exceeded the reality. (Do you remember Jini? Or the original Java EE?) Nowadays, that excitement is lavished on other technologies whose promises exceed the reality, and Java has grown up.
I Didn't Ask for a Toolbar with That Java
In these unhappy days where Oracle is working hard to regain the trust of users, it seems a staggeringly bad idea that the Java updater installs the Ask toolbar by default. It's plainly bad for Java and can't possibly be worth the few clams in additional revenue. If you agree, sign the petition!
An XML Macro
In my previous blog on Scala 2.10 macros, I showed you how to write a macro that can swap the contents of two variables. In this blog, visiting scholar Martin Christensen and myself try to solve a problem from our blog on dynamic types in Scala 2.10.
The swap macro
The final version of Scala 2.10 was released on January 4, 2013. Martin
Christensen, a visiting scholar in our department, and myself have been playing
with some of the new features, and I'll be blogging about some of our
discoveries in my copious spare time.
Dynamic Types in Scala 2.10
This blog explores Scala dynamic types, a new feature of Scala 2.10, and
provides some hopefully interesting exercises so you can try it out for
Wildcards in the Wild
Generics and wildcards have invaded Swing, and I got an error message from
hell when decorating my perfectly working code with those pesky angle
brackets. This blog a nifty and self-referential tip on how to fix such
The Grand War is over, and what we can learn from it
The grand war between Oracle and Google over the Android API is over, unless Oracle prevails on appeal. The judge and jury have spoken, and this is what they said: Android doesn't infringe on the couple of patents that were at play in the lawsuit. (Other patents that Oracle asserted were invalidated by the USPTO or not included for tactical reasons
BOMed out by Notepad and javac
I've been too busy to blog for quite some time, but today something
happened that seemed strange enough to break my silence. A student came to
me with a Java source file that the grading script rejected. We looked at
it and couldn't figure out why. I unearthed the error message:
The Sordid Tale of XML Catalogs
In this blog, I summarize what I found out about using XML catalogs with the
Java SAX parser. I know, it's not the most riveting subject, but if your app
waits for minutes untilthe parser delivers a perfectly ordinary XHTML file, you
may find this useful. Or depressing.
Operator Overloading Considered Challenging
In this article, I explain why I think that operator overloading is a good
feature, even though it is hard to get right. To illustrate my point, I go
into more detail of the operators in the Scala collection library than you
want to know.
A first look at Dart
Google released details about the Dart
language today, and I am surprised how
JavaOne 2011 Day 4
Another day, another keynote. A fellow from IBM talked about cloud stuff. I
sat through a lot of nebulous cloud talks, but this guy was good. He had a
sensible slide on architectural alternatives, explained why we should all go out
and buy a device for a ”data grid”—a memory device for sharing data among
VMs—and he gave a demo of some software for configuring an app to run on
their cloud server. Clear and to the point, like a tech talk should be. It had
nothing to do with the “community” theme of the keynote, but you can't have
JavaOne 2011 Day 3
It's the third day of Java One. No keynote today, but I write about the
thrills of the Script Bowl, alternative languages for Java EE, OpenEJB, and the
GreenFoot and BlueJ projects for computer science education which I hope Oracle
will continue to fund.
JavaOne 2011 Day 2
Here I am, on my second day of Java One. I live in the residential part of
San Francisco and get to the conference on a battered “express” bus that
stops at every block, starting from the ocean until it reaches mine. Then it
goes straight downtown, but by the time that I get on, it is standing-room
only. I make it to the keynote frazzled but just in time. Today, I realize that
the empty chairs labeled “Oracle Press” are not for the publishing division
of the Oracle corporation but for scribblers like me.
JavaOne 2011 Day 1
Today, JavaOne started officially. With the traditional keynote. Except,
traditionally, the keynote is in a huge room that has space for everyone.
Today, people were shunted into overflow rooms where they could watch on
monitors. In the age of the screencast, that seems pointless—why is that
better than watching on your laptop?
JavaOne 2011 Day 0
Once again, I got a blogging pass to JavaOne—my fifth year as the intrepid
reporter at JavaOne, and my 15th JavaOne attendance. Sadly, that wasn't enough
to get me the coveted Alumni badge—my email address wasn't in the right
Oracle database, and showing my previous conference blogs didn't impress the
conference staff. I complained to Sharat Chander, the marketing person at
Oracle who is responsible for the tech tracks at JavaOne, and he told me he
can't get an alumni badge either.
Complexity is in the Eye of the Beholder
I just read through David Pollak's blog Yes, Virginia, Scala is
. Now David has much more contact with developers in the trenches than
I do, but I was a bit perturbed by his perspective.
Scala for the Impatient—Free Chapters at typesafe.com
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 typesafe.com.
Whatever Floats Your Boat
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
float instead. Another professor contributed a business
problem set that used
float where I would have used
double, or, if I had been allowed,
Inner Classes in Scala and Java
When I used the Scala combinator library in earnest a few months ago, I got
confusing error messages when I used classes that are nested inside other
classes. There were several blog posts that made the feature look complicated,
so I reserved a chapter of my upcoming ”Scala for the Impatient” to explain
class nesting. It turns out that won't be necessary. It's simpler in Scala than
in Java, and I can explain it in a few paragraphs.
Java 7 Unsafe at Any Speed?
Java 7 got released, but there are rumors of hotspot crashes . It's probably
a tempest in a teapot, but it reminds me of the 1994 Pentium floating-point
In Praise of Language Specs
An implicit conversion is only inserted if there is no other possible
conversion to insert. If the compiler has two options to fix x * y, say using
either convert1(x) * y or convert2(x) * y, then it will report an error and
refuse to choose between them. It would be possible to define some kind of
“best match” rule that prefers some conversions over others. However,
such choices lead to really obscure code. Imagine the compiler chooses
convert2, but you are new to the file and are only aware of convert1—you
could spend a lot of time thinking a different conversion had been
Handwringing about Scala
There has been a flurry
and email threads with hand-wringing about the fact that Scala hasn't yet
achieved world domination.
There Will Be Monads
My sabbatical is coming to an end, and I just finished off my “modern
programming languages” course at the Ho Chi Minh City University of
Technology with a dose of monads. The good news is that I am not going to tell
you how monads are just like Vietnamese spring rolls. Just think of them as a
design pattern for composing actions.
Easy Red-Black Trees
Users of one of my textbooks asked for a section on red-black trees. That
makes sense—just lecturing about binary search trees leaves the nagging
doubt what happens when a tree becomes unbalanced. Unhappily, the standard
algorithms are a mess of fiddly special cases. Here is a simpler way of doing
it, modifying the presentation by Chris Okasaki and Matt Might.
A Dozen Concurrency Pitfalls
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
Parallel Arrays in Scala
In my programming languages class, I have come to the point where I talk
about language and library support for concurrent programming. As I revise my
slides about the fork-join framework, I need to do something about the bullet
that Java 7 will have parallel arrays. Sadly, it won't, but Scala 2.9 does,
and they are really easy to use. Read on if you want to see how to keep your
cores busy with just a few keystrokes.
Having a Racket with Pictures and Continuations
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.
A Blog Uploading Tool for java.net
In this blog, I address my grief with blog uploading, following Paul
Graham's advice about choosing technology.
Ruby, Scala, and Complexity
In this blog, I ponder why Ruby and Scala are easy to learn and complex to
master, and how their cultures differ.
Scala for the Impatient
My next writing project is "Scala for the Impatient". Why yet another
book? I became impatient with the books and blogs that seemed to be directed
towards language enthusiasts, not programmers who need to get a job done.
Watch out for the first drafts on Safari in a few weeks!
A Report from the Sewer Hole: Cygwin, JLine, rxvt, and the Scala REPL
I have students running Windows, Linux, and Mac OS X, and I like to
encourage students to choose whatever platform makes them most productive. But
I also like to be able to give out one set of instructions, grading scripts,
etc. to everyone. Fortunately, bash is available everywhere, even on Windows,
in the form of Cygwin
A Condensed Monospaced Font
When the time comes for my graduate students to write their project reports,
I give them a long checklist of do's and don'ts. One of the more vexing issues
is the code font. I am astonished how many people who have been programming for
years are unaware that computer code is usually presented in a
font, like this.
The Mystery of the PolicyNodeImpl Class
Google further denies that the document attached to Oracle's Amended
Complaint as Exhibit J contains a true and correct copy of a class file from
either Android or "Oracle America's Java." Google states further that Oracle
has redacted or deleted from the materials shown in Exhibit J both expressive
material and copyright headers that appear in the actual materials, which are
significant elements and features of the files in question.
A Geometry Problem in Scala
I ran into this
about making a pretty drawing in C# and F#.
The Voters Have Spoken
The votes are in, and the people have spoken. They are mad as hell and they
want change. No, not those electionsI am talking about the JCP elections.
In this blog post, I describe how I use Scala for mundane scripting instead of monadic computations.
Java One from Afar
I have been at JavaOne since 1996, its inaugural year. In 1996, JavaOne was
colocated with the Software Development conference, which has since fallen on
hard times and vanished. But at the time, half of the exhibitors were from SD,
and the other half from JavaOne. Weirdly enough, the JavaOne booths were all
yellow with a bit of red and blue, so it looked as if the SD half of the
exhibit hall represented the free world and the Java One half a totalitarian
regime. This year, JavaOne is again colocated with another conference, Oracle
OpenWorld, but I am on sabbatical in Vietnam, so I didn't get to enjoy the
The Next Big JVM Language
Stephen Colebourne has a very
on the Next Big JVM Language (NBJL). The comments are
good too. (I was going to add this as a comment to his blog, but it was
rejected as spam. Maybe jroller is onto something...)
PrimeFaces works great with JSF 2.0/NetBeans 6.9
In 2002, JSF was introduced at Java One as Swing for the Web.
The vision was that you would compose professionally designed components into
web pages, add a bit of Java glue code, and presto, you would have a web app
without having to worry about HTTP or the DOM.
A puny Java 7 isn't the end of the world
Mark Reinhold just published a blog
stating what has
been painfully obvious to everyone following the JDK 7 development: There is no
way that it will ship 2010. He thinks that mid-2012 would be realistic. Having
followed the Project
, I can see where he is coming from.
Scala, JSF 2, and NetBeans
I am working on a web site that will help students practice their Scala
programming skills. As I labored along, writing my JSF app code, I thought
this is sillywhy not practice Scala at the same time? But
I like JSF and wasn't ready to jump to Lift
Independence Day for Java?
I am on sabbatical in Vietnam right now, and today the country celebrates
independence day. (On September 2, 1945, Ho Chi Minh gave his declaration of
The Horstmann Brace Style
There is a brace style with my name attached to it. In this blog post, I describe its merits and why I had to stop using it.
JSF and Power Windows
My dad is visiting, and he just picked up his rental car. He proudly
announced that he got a good deal on a compact car without power windows
Another Java Web Start Pitfall
Yesterday, I installed shiny new Ubuntu Lucid Lynx on a shiny new laptop.
This morning, I launched a Web Start application, and I got the following
Transforming an XML Tree with Scala Partial Functions
In my last blog, I outlined how I found the Scala XML library a pleasant
solution for unpleasant XML format conversion jobs. In those jobs, I had to
completely transform the document from one grammar to another.
XML Processing with Scala
A few months ago, I had one of those unpleasant format conversion jobs. I
had about 1,000 multiple choice questions in RTF format and needed to import
them into Moodle
Mercurial on OpenSolaris and GlassFish
I am working on rewriting a set of labs for our intermediate students at
SJSU. Version control is something that everyone with a CS degree is pretty
much expected to know these days, so I thought of digging up an old Subversion
lab from my open source programming class.
Composite Input Components in JSF
Composite components are a great feature of JSF 2.0. The canonical example
is a login component with fields for the username and password:
Project Stage and Openness
I am an observer at the JSR 314 (JSF 2.0) expert group, whose mailing list
is open (but sadly not yet archiveddon't get me going...), and we had an
interesting discussion about the project stage setting. The
expert group's efforts to extend this useful setting to other parts of EE don't
seem to go anywhere. I can't tell why, because those discussions sadly have not
been open. If you believe that an app server should be a developer platform and
not just a deployment platform, say so in the blog comments!
A Flash in the Pan?
Last night, I awoke at 3 a.m. wondering whether David Geary and I should
have given more coverage to the JSF 2 flash in our Core JSF book revision. Here
is why I think your time is better spent learning about other, more powerful
constructs, together with some thoughts about CDI and REST.
How to stay away from the JSF API
A few weeks ago, Ed Burns posted a
link to a blog
on the JSF expert group mailing list, commenting A
nice one, but it doesn't mention JSF 2. Ever the curmudgeon, I pointed
out that it wasn't so nice that the blog's sample code used the JSF API in
beans when it wasn't necessaryas does in fact a lot of sample code, even
in the official Sun tutorials. Ed's response: Cay, a blog comment by
such an eminent citizen as yourself would certainly be noticed. So, here
is the curmudgeonly eminence's advice on how to stay away from the JSF API.
JSF 2.0 and Tomcat
As I happily wrote about new features of JSF 2.0, my coauthor David Geary
kept asking me how to run the examples in Tomcat 6. I kept putting it
offhunting down all those JAR files and
is just too much like eating soup with a fork. I finally got around to doing
the research and thought that others might benefit from the (unhappy) results,
if only to realize that this may be the time for switching to GlassFish.
Is @javax.faces.bean.ManagedBean Dead on Arrival?
Java EE 6 has three different ways of defining beans that are managed in one way or another. Here is a quick recap.
Running PHP Apps on GlassFish
For the upcoming semester, I want to run a learning
into which I can integrate an experimental feature for
evaluating student programs. It needs to be open source so that I can modify
it. I was first going to go with Sakai
which is based on Java, but just about everyone
is going to Moodle
, and there
are reasons for that
Closures? In Java 7???
Today, a tantalizing announcement by Mark Reinhold about closures in Java 7
has made its way through the twittersphere.
Monitoring the HTTP Traffic in a JSF Redirect
I wanted to trace exactly what happens when a JSF page uses a
redirect. Here are my experiences with the HTTP and TCP/IP monitors in NetBeans
and Eclipse, and why I ended up using Wireshark instead.
Another Small Step for JSF...
In the relentless fight against configuration boilerplate, JSF and Glassfish
have taken yet another small step forward. As of Glassfish v3 build 68, you no
longer need to declare the faces-servlet in WEB.XML.
Recursive varargs methods in Scala
And now for something entirely different...one of my students asked how to
write a recursive function in Scala with varargs. Apparently, the internet has
lots of articles complaining about the challenge of calling Java
varargs methods from Scala
, but this particular issue did not
. Here goes...
Oracle OpenWorld Day 1
I got a blogger pass for Oracle OpenWorld. Here is my report from the show
Oracle OpenWorld Day Zero
Aaron Houston, the fearless leader of the Java Champions, got me a blogger
pass to Oracle OpenWorld. Here is what I learned on the opening night.
Java/CS1 Cheat Sheet
The next edition of my CS1/Java book is going to print soon. At the last
minute, we decided to put the real estate of the inside covers to good use and
include a cheat sheet with the most important Java control
structures and libraries. Since it would be particularly embarrassing to have a
typo here, I am hoping to enlist the aid of the community.
How to draw simple diagrams the easy way (with Java2D)
When you need to produce lots of fairly straightforward graphs, Java2D is
your friend. In this blog, I show you how you can render simple images as
crisp-looking PDF or EPS files, provided you can draw them on a Graphics2D
Recording and serving screencasts
I just learned how to make Flash screencasts on my Linux system and deliver
them (with GlassFish) on a server that the computer science department received
as a donation (thanks Sun!!!).
Alice 3, CS1, and Quaternions
This semester, I am teaching the CS1 course again. If you just teach plain
Java, it isn't easy to come up with interesting lab assignments. Some of the
students have built exciting animations with Alice
in the CS0 course. Somehow, they aren't as
excited about printing prime numbers or digits of in CS1. But the latest
version of Alice, now in beta, can be programmed in Java. This is very cool.
Students can write Java code that directs the Alice models. For example, one
assignment asks students to make a
method moves the car and reduces the gas in the tank. (I
couldn't find a gas gauge, so I used the cat clock. The tail moves to the left
as the tank gets emptier.) I provide the code for moving the car and rotating
the tail, and the students compute the gas consumption.
A spoonful of Scala
I write my lecture slides in XHTML, using the marvelous HTML Slidy
package. I just dump
the images into the same directory as the HTML files, which isn't so smart
because it makes it hard to copy a presentation from one directory to another.
I could change my habit, but hey, what is technology for? A couple of years ago
I decided to write a script that simply generates a list of all images in an
HTML file, so I can run
Are you using static import?
I am rewriting a Java book for beginners, and it seems to make so much sense
Say Sayonara to sPAL!
When I teach my JSF crash course to my software engineering students,
everyone nods, works through the lab, and I don't hear any JSF issues from them
for a couple of weeks. Then they run into sPAL.
Add an XSD file to Eclipse and Eliminate Those Pesky XML Warnings
If you work with Eclipse and JSF 2, you too may be annoyed at the little
that shows up next
to all your
faces-config.xml files (even those that are blessedly
Are Web Services the New CORBA?
I am updating the External Services chapter in Core JSF
. There is lots of new and interesting
stuff: How to use JPA, stateless session beans, and WebBeans. I ditched the
LDAP sections (for which I hadn't received very few queries, even though the
examples are notoriously hard to set up). I reimplemented the authentication
example with a JDBC realm, which was no
. Now I am at the web services section.
WebBeans in Glassfish v3
As I am updating my share of chapters in the Core JavaServer Faces book
(with the hard parts fortunately being tackled by my coauthor, David Geary), I
started playing with WebBeans, erm, Java Contexts
and Dependency Injection.
I'll keep calling it WebBeansthe alternative JavaCandi is more than I
can take. There are two features that are crucial for JSF users: Conversation
scope and access to stateful session beans from JSF pages. (Seam users know all
about this and can skip this blog.)
A First Look at NetBeans 6.7
A few days after Eclipse Galileo, Netbeans released its latest offering,
Netbeans 6.7. Here is a first look, as always from my entirely biased
Upgrading to Eclipse Galileo
I just installed Eclipse 3.5 (Galileo)it seemed a more attractive
thing to do than actually getting my work done. Fortunately, I only need three
Eclipse plugins right now. Here is how they fared with Galileo.
JSF 2.0 Refcard available
DZone just published the JSF 2.0 version
of my JSF refcard
. It provides updated summaries of the tags and attributes
needed for JSF programming, along with a summary of the JSF expression language
and a list of code snippets for common operations.
My Department is Slashdotted
I teach computer science at San Jose State University. My department just
ended up on Slashdot
One of my colleagues, Dr. Beesonwho, to his great credit, makes
beginning students write lots of little homework programs until they get
got into a tussle with Kyle
, an eager student who insisted on publishing
on the internet. I don't want to get into the personalities
here. Beeson can be irascible and a bit overbearing, and the student's claim
that he is doing this to increase his chances for employment rings a bit
hollow. When is the last time you hired someone because of their TicTacToe
program? Even if I did, I'd be wary about candidates who write
(foundEmpty == false)
Java One 2009 Day 4
One of my favorite parts of Java One is the Friday morning toy
show where James Gosling presents a random mixture of cool and
inspirational projects. Of course, all these involve Java in some way.
Java One 2009 Day 3
Like every year, I offer a quick script for packrats who want to download
the slides for all the talks. Of course, you can just wait for them to become
available online after the conference, but then you'd not be a true packrat.
Java One 2009 Day 2
I do this to myself every year. I go to the opening keynote on Tuesday. I suffer through the love-in-with-Sun-partners part, just so I can get to the good part with the important announcements. Then I go to the Wednesday keynote, which offers no such benefit, and vow never to go to any other keynote except for James Gosling's toy show.
Java One 2009 Day 1
I am no fan of keynotes, but I figured I should earn my press pass (thanks
Jacki!) and show up.
Java One Day 0
Today is day 0 of Java One, AKA “Community One,” with a focus on
open source and community projects. With the economy being what it is, and Java
One stretching the definition of “early bird” specials past the
breaking point—the discount was good until today—I was fearing for
the worst, but there definitely were crowds today.
The Fit and Finish of JSF
When I come
across an article such as this one
, I am
overcome with melancholy. I really want to love JSF. Its heart is in the right
place. It wants to let me drag and drop components onto a form, wire them up
with JavaBeans, and give me AJAX with essentially no work on my part. And it
comes so close.
My Oracle Pronouncements for Java
As everyone knows from yesterday
morning's news, Oracle has made an offer to buy Sun Microsystems, Sun has
accepted, and the acquisition is expected to go through by the summer.
Much A-do About Nothing
In general, a
for loop may be used if the number of
repetitions is known, as for example, when you need to print a message a
hundred times. A
while loop may be used if the number of
repetitions is not known, as in the case of reading the numbers until the
input is 0. A
do-while loop can be used to replace a
while loop if the loop body has to be executed before the
continuation condition is tested.
A Simple Servlet for Running JUnit in Glassfish
When teaching unit testing in the context of a simple EJB3.1 application, I
was looking for an easy way of testing managed beans and session beans inside
Glassfish. Of course, one can test out-of-container or use an embedded
container (but I didn't quite figure out how to do that with Glassfish
v3I'd appreciate hints), or a mock container
(but that seemed to
require a bit of setup).
Long in coming...
A Thinkpad sale seduced me into
upgrading my laptop. My feeble rationale was that I could stop dual-booting,
use Linux on the new laptop and Vista on the old one. So, I got a shiny new
Thinkpad T500 for under $1,000, blew away Vista Homeless Edition, and installed
Ubuntu Jaunty Alpha 4. I expected the usual fussing with wireless networks,
display adapters, and futile fights to activate exotic peripherals. I was
totally disappointed. Everything, and I mean everything, down
to the webcam, worked after a 30 minute install with one reboot and no fussing.
With an alpha release.
Towards Java EE Nirvana
Java EE 6 makes it pretty straightforward to crunch out a basic web +
database application. This semester, my software engineering class is building
web apps, and I decided it is simpler to have them use JSF + JPA in Glassfish
v3 rather than some technology that seems easy at first and then lets them
A Call to Fix the JCP Oberver Status
In this blog, I report on my disappointing experience with the JCP observer
status, and suggest that another dose of glasnost is needed to fix the
A simple JSF2+AJAX example
In this blog, I go over a very simple JSF2+AJAX example and show how one can
spy on the inner workings with the TCP monitor and debugger.
Baby Steps with JSF2
several blogs that tell you how to do fancy things with the upcoming JSF 2
(such as these by Ryan Lubke
and Jim Driscoll
). In this blog,
I look at the other side of the coinhow the simplest things are working
out. After all, if Ruby on Rails
taught us anything, it is that a technology that makes the simple things simple
has a great shot at getting developer mindshare.
What Worked for Our Blackberry Project
many weeks of labor, my software engineering class is ready to deliver our
BlackBerry project to Cinequest, the organizers of the San Jose Film Festival.
Moviegoers will be able to check the schedule on their Blackberry devices, see
when their favorite films are playing, and find out about the latest special
Where is the source?
This semester, my software engineering class is working on a project to
bring the San Jose Cinequest film festival catalog to the Blackberry. RIM has
generously donated us some devices.
Grief with Gantt charts
Occasionally, I have to put together a project schedule with a Gantt chart.
In my software engineering class, I figured I should use something
cross-platform and open-source, and not Microsoft Project, which I vaguely
remember as a muddleheaded mess.
Restless about REST
In my software engineering class, we are designing an application that shows films and events for the Cinequest film festival on Blackberry devices. We need to get film schedules and descriptions from a server onto the mobile phones. A typical query would be: “Show all movies playing today”.
Core Java Refcard
My second "refcard" has been published by DZone. This time, the DZone team managed to cram an unbelievable amount of Core Java language and library facts onto a small PDF file. Check it out here
Know When to Fold
I am teaching an undergraduate course in programming
. We build interpreters and compilers for toy languages, in the
hope that students gain a basic understanding of syntax, semantics, and
Teaching Software Engineering with BlackBerry
One of the best aspects of my job as computer science professor is that I
keep learning new stuff. This semester, I am teaching a software engineering
, the organization that puts
on the annual San Jose film festival, approached the CS department, asking for
help with their mobile initiative. We jumped at the chance, and now my students
are hard at work designing and prototyping a BlackBerry application for
JSF Refcard available
When I traveled to the U.S. as a nerdy teenager, I was fascinated by those laminated reference cards. It seemed yet another example of boundless American optimism that one can cram an entire semester's worth of information into two pages.
Applet Dragging in Linux
Being a Linux user, I watched those applet dragging demos with envy when they only worked on Windows. When the release candidate of JDK 6 update 10 (now there is a product name only a mother could love...) came out, I was eager to try it out on Linux. Initially, I was held back by a factor entirely beyond my control, i.e. my cluelessness and unwillingness to read the docs. Thanks to Aaron Houston and Ken Russell for helping me out. Here are the steps:
Teaching Programming Languages with Scala
This semester, I am teaching the undergraduate programming languages course
at SJSU, a required course for CS majors. The course has two objectives:
Lessons from My Summer Vacation
In this blog I reflect on what I learned during my summer vacation, about
standards, folding travel beds, and snatching defeat from the jaws of
Summer School in Switzerland
In this blog, I report on how I am spending my summer vacation (or at least
a part thereof) as a guest lecturer in a summer program in beautiful Canton de
What do CS students learn?
On May 23, I gave a presentation at Sun about computer science students,
and how a company can engage with them (audio
are some of the questions that I was asked, and the answers that I gave (or
wish I had given), and a question that I wish I had been asked.
The hardware, the OS, and the JVM are ready for large numbers of
The languages, the tools and the programming community at large
are not ready for large concurrent programs.
So... good luck, guys!
During a meeting in the Community Corner (java.net booth) with James
Gosling, a participant asked an interesting question: "Which Programming
Language would you use *now* on top of JVM, except Java?". The answer was
surprisingly fast and very clear: - Scala.
Here is my report from day 2 of Java One. I continue to feel diffident
about RIA and Java FX Script, the theme of this year's Java One, so I decided
to make my own themes: Ease of development, and transparency.
Here is my braindump from Information Overload Central, AKA Java One 2008.
Last year, Java One Day 0 was Netbeans Day, in a cozy hotel. This year,
the Java One week started much more grandly, with Community One, at the
Moscone Center. There were tracks for a number of open source communities,
including NetBeans, GlassFish, MySQL, OpenSolaris. Frankly, I preferred the
cozy hotel, but I can see that it is savvy marketing by Sun to have a
large-scale free community event.
On Blue-Collar Languages
I ran across this
on using wildcards in Java generics. Pretty basic stuff, I
thought. But I was amazed by the comments:
Is Computer Science the New Latin?
reports on the elimination of underenrolled Advanced
Placement (AP) courses in American high schools. The subjects affected are:
Italian, Latin Literature, French Literature and, hold on to your hats,
Computer Science AB. (The College
designs high school courses that aim to be equivalent to college
courses. High school students who take the course and pass an exam are often
given college credit.)
Last time, it took me at least 10 hours to do one of the problem, but i
got through #1 in less than 1/2 an hour. most of it was copy and paste. I
didn't even need more than 1 class. am i missing something? It's almost as
if you can lift the solution out of the labs. All I had to do was write 2
really really really simple closures.
Swing for the Web--Are We Getting Closer?
When I first heard
about JavaServer Faces, way back at the 2002 Java One conference, it was sold
as Swing for the Web. That caught my attention. I was sick of
cookies, servlets, and that special form of tortureJSP custom actions.
Ever since, I have pinned my hopes on JSF because it has one thing going for
it: a component model. When I need, say, a progress bar, I want to
leave it to someone more skilled than me to make such a thing out of images,
a progress value and move on to the next task. After all, when I use a
JProgressBar in Swing, I don't worry about the pixels and
Dinosaurs Can Take the Pain
There has been much discussion on whether Java
programmers are becoming dinosaurs, on an evolutionary
and overtaken by more nimble mammals. Bruce Tate has long
abandoned Java for greener (or redder) pastures. Bruce Eckel has embraced
Flex , Bill Venners favors Scala. Python is making inroads in college
curricula. What is a Java programmer to do? In this blog, I argue that we
need to focus on less on syntax and more on the pain points of Java
The OLPC and Java
With Java, I can replace my computer with a $500 Internet
Properties Get No Respect
There has been another flurry of discussions about closures
, together with the usual flurry of leave
the language alone
DSLs--Standalone or Embedded?
I am a reviewer for Java One. I have about 350 project proposals to plow through and not enough time to give each of them justice.
Flying Saucer Comes Through with Flying Colors, or the Triumph of
I had to render a set of presentation slides in HTML
Slidy format into images. This blog entry shows how to carry out this task
with the excellent Flying Saucer XHTML renderer and concludes with some
ramblings about infrastructure.
A Bundle of Joy - NOT.
Today, I rant about Sun's blunder in their bundling of JavaDB in JDK 6.
Executive summary: 1. Don't rely on JavaDB being present in the JDK. 2. A
bungled bundle is worse than no bundle at all.
The grass isn't greener on the other side
Today, I am in beautiful San Diego, at a NSF workshop on active learning and UCSD's Ubiquitous Presenter
software. Ubiquitous Presenter lets instructors and students add pen-based markup to slides and share them with each other. It is a nifty tool to engage students in the classroom instead of just lecturing. The student part of the software uses Java, and students can use the mouse or a tablet pen (which just acts as a mouse) to add their notes. The instructor part of the software uses .NET because instructors need to be able to write nicely, and Java doesn't have any support for pens (pressure, erasing, etc.).
Changes in 1.6.0_02
The full internal version number for this update release is
1.6.0_02-b05 (where "b" means "build"). The external version number is
JSF Support in Eclipse Europa and NetBeans 6.0m10~
When Eclipse Europa was released on June 29 (together with the iPhone
and the GPL 3 license), I wanted to know if it did anything about one of
my many pet peeves: tool support for writing JSF apps. In this blog, I
will compare Eclipse 3.3 and NetBeans 6.0 milestone 10 to see how they do
on the world's most mundane JavaServer Faces application: the login
example from Core JSF
The Single Thread Rule in Swing
Once a Swing component has been realized, all code that might affect
or depend on the state of that component should be executed in the
Java One Day 4
This is my last day as the intrepid reporter at Java One. The press
room, which had become my home away from home, was closed. Instead of
snarfing up the baked goods and looking for the secret stash of booze, I
chatted with lots of interesting folks in the halls of Moscone, attended a
couple of sessions, and pondered what it all meant.
Java One Day 3
This is my third day of reporting from the floor of Java One. I ran
into a number of very interesting folks, got the chance to ask more
hard-hitting questions, and had a mixed bag of sessions.
Java One Day 2
This year, I got a genuine press
pass from a kindly soul at Sun. While my quest for priority seating was
still futile, I made progress on my quest to locate the stash of free
booze, and I got the chance to ask more hard-hitting questions. Here is
your intrepid reporter's take on day 2.
Java One Day 1
This year, I got a genuine press
pass from a kindly soul at Sun. I was excited about priority seating and
unlimited free booze in the press lounge, neither of which I was able to
locate. But I did get to ask hard-hitting questions in the press
conference. Here is your intrepid reporter's impression of day 1.
Java One Day 0
This year, I got a genuine press
pass from a kindly soul at Sun, which entitles me to priority seating at
the keynote, the opportunity to ask hard-hitting questions in the press
conferences and unlimited free booze in the press lounge (I hope).
What's so Taxing about Return?
Some responses to my blog on Neil Gafter's closures talk showed concern
with the handling of the return statement in BGGA closures. Since I am
done with my tax return, I am blogging about the intricacies of the return
statement inside closures.
Dr. Gafter comes to SJSU
I teach a graduate programming languages class at San Jose State
University. In order to inject some topics of current interest, I had a
lab about closures and the competing closure proposals for Java 7. I got
an email from Neal Gafter: Hey, it's really cool to see your
reference to BGGA in a SJSU lab assignment! I asked if he could
give a talk at the department seminar, to which he graciously agreed. We
had a packed room today. I am very excited that my students had a chance
to witness a bit of history in the making. Here are my impressions of the
Microsoft Patents BlueJ Workbench
BlueJ is a tool for teaching OO programming in Java that is very well
regarded in the CS education community. Microsoft engineers who were
familiar with the BlueJ "workbench" added a similar feature to Visual
Studio, didn't give credit to the BlueJ inventors, and filed a patent
application. Not the way to win the hearts and minds of the education
Properties are Design Features
The discussion about properties had reached a fever pitch in the last
weeks, and there is a great deal of dissent about the nature of
properties. Are they meant for tools, are they the tool of the devil to
seduce us away from the goodness of OO, or are they just an irrelevant
preoccupation of programmers who have no tolerance for boilerplate? In
this blog, I would like to argue that properties are legitimate design
features, and that it is the job of a programming language to allow
faithful mapping of design intent to code.
Pie in the Sky Properties
Jacob Hookom has
about doing properties right rather than simply generating
methods. Of course, you still want the
JavaBeans introspector to work correctly. I thought it would be
interesting to run with this idea and see where it gets.
Arrows in the Back
There has been a flurry of recent blogs on native
property syntax, much of it rather emotional. This blog tries to get past
the emotions, hoping to garner interest in the real issues that need to be
solved for native properties.
inside JDK6. Pretty nifty for running quick-and-dirty tests. Or so I
thought until I ran into a bizarre problem with that most exotic of
The World's Simplest Unit Testing Framework
I describe the world's simplest Unit testing
framework for teaching Java to beginners.
The Power and Pain of POJOs
I wrote a quick-and-dirty quiz application to check
whether my software engineering students do their reading assignments (or
at least google quickly). Can an Elvis-level programmer do this in a
couple of days with EJB3 and JSF? Here is my experience report.
How Not to Report an Internal Error
NetBeans pops up a dialog with an exception message
when it finds an internal error. And again. And again. And again. And
again. This blog reviews just how user-hostile this behavior is, and
Track+ On GlassFish
Directions for setting up the Track+ bug tracking
system on GlassFish. This is all boring, and I just put it up for
reference. If you are looking for something fun, follow one of the links
in the second paragraph instead.
Installing GlassFish and PostgreSQL on Ubuntu Server Edition
I don't do LAMP, I do JELP (Java, EE5, Linux,
PostgreSQL). Here are instructions for installing Java, GlassFish and
PostgreSQL on Ubuntu 6.06 "Dapper Drake" Server Edition. No gotchas, just
a bunch of steps that I hadn't found together in one place.
I used Java Web Start as a "poor man's installer" for a
Java client app that allows students to check their homework assignments.
The app needs "all permissions", so I simply signed it with a worthless
self-signed certificate. The Web Start security dialog is complete
gibberish to 99% of end users, which works in my favor. Something is wrong
here. Should the JNLP API be less convoluted, so that it is easier to live
in the sandbox. Should it be less of a hassle for an individual to get a
Does anyone still use railroad diagrams (AKA syntax
diagrams)? If so, how do you produce them?
Don't Lie to the Entity Manager
JPA is the new object-relational mapping standard that
you can use in EJB3 or in standalone applications. For the most part, it
is phenomenally easy to use. But there is a trap that has bitten more than
one developer. If you ever lie because your fibbing won't affect the
database, your lies can still come back to haunt you. This blog gives two
An EJB 3 Glossary for Elvis
I am working on a glossary of EJB 3 terms that gives
both the official definitions and explanations that Elvis can understand.
(Elvis is the programmer persona who is neither Einstein nor the
point-and-click/drag-and-drop "just give me a wizard" Mort.) What other
definitions would you like? Do you spot errors or inaccuracies? Please let
Why Java Developers Should Switch to Linux
It's summer again, people have more time on their hand,
and they think about switching operating systems. I'd like you to consider
switching to Linux. It's not cool, but you get to enjoy freedom from
crapware and forced upgrades, keyboard shortcuts, and great Java support.
There is just one drawback. Unlike the Mac crowd with their
distinctive-looking hardware, you'll need a garish Linux sticker so that
the world can see you aren't running Windows.
Honey, I built the JDK! (on Ubuntu)
These are my notes for building Mustang on Ubuntu 6.06.
Amazingly enough, this works with just a small number of easily fixed
issues. This is good news if you want to tinker with the JDK on Ubuntu.
Even if you don't, it is comforting to know that the Mustang build process
is robust enough to allow the tinkerers to use it on their favorite
platform, so that you can benefit from their labors.
The innermost secrets of -javaagent:toplink-essentials-agent.jar
I had been mystified by what exactly the magic
incantation -javaagent:toplink-essentials-agent.jar does for JPA clients,
and my experiments had been inconclusive. I finally figured it out. Here
is the answer in terms that Elvis can understand.
Say No to Properties Boilerplate!
Nobody likes to write properties boilerplate--the
getter, the setter, the Javadoc for the getter, the Javadoc for the
setter, you know the drill. Ok, you say, Eclipse writes it for you. But
you still have to read it. Pages and pages of it in many real life
classes. My graduate student Alexandre Alves implemented a Mustang
compiler extension to remove the drudgery. We want to get this feature
into Dolphin and need your help. Try it out and let us know what you like
and what needs work!
Programmer Productivity, JSF, and NetBeans
My first impression using NetBeans 5.5 for JSF 1.2
development: Not easy on the eyes, but the debugger, HTTP monitor, and
GlassFish integration dramatically increased my productivity.