|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
Cay Horstmann's Blog
A First Look at NetBeans 6.7Posted by cayhorstmann on June 29, 2009 at 08:54 AM | Permalink | Comments (11)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 perspective.
“Out of the box” readiness has always been a forte of Netbeans (pun intended for old-timers). The integration with the Kenai open source software hosting site takes nothing more than entering your password. You can do issue tracking from inside the IDE. Think of it as “Mylyn for Kenai”. Glassfish integration is also smoother than in Eclipse. And you don't have to fuss with a Subversion adapter, like in Eclipse. Subversion and Mercurial are built in. I just noticed that Netbeans has an equivalent to Eclipse's workspaces, called “project groups”. (Thanks to Michael Bien for pointing out that this feature has been there since 6.0.) The Netbeans feature isn't quite as powerful as the Eclipse equivalent. —you can't have two project groups with different code formatting conventions. I am told that Netbeans has great support for PHP, but that's not my cup of
tea. I tried activating Scala support, following the “nightly
build” instructions from this
page, but I got an error “Could not connect to compilation
daemon.”. Update: That error goes away if you globally set One big disappointment for me is the lack of support for a JSF component
set. Netbeans used to include the Woodstock components, which Sun
unfortunately abandoned. The promise at the time was that Netbeans would switch
to IceFaces, and you can find a conversion guide here.
It uses a plugin which does not seem to be available with NetBeans 6.7.
(Soapbox: I have always felt that there ought to be a high quality, visually
attractive component set as a part of JSF. Can you imagine if Swing had just
specified If you want to experiment with JSF 2.0, be sure to install Glassfish v3 preview (from here; this is not the same as the prelude version that ships with NetBeans). Then install Vince Kraemer's nifty Glassfish V3 enabler plugin from the Netbeans plugins dialog, and point it to your installation. Unfortunately, JSF editing is disappointing. The facelets plugin doesn't know anything about JSF 2.0. So, it's really no better than Eclipse. That, in a nutshell, is the problem with this Netbeans release. For a while, Netbeans was faster and better in supporting new Java EE features. For that reason, I regularly used it for my web projects. But with both Eclipse and Netbeans having equally basic support for JSF 2.0, I found myself back in Eclipse. What would it take for me to change again? Autocompletion in JSF 2.0 pages. A JSF component set with a visual editor. A superior Scala plugin. Hopefully in Netbeans 6.8. Upgrading to Eclipse GalileoPosted by cayhorstmann on June 26, 2009 at 09:54 AM | Permalink | Comments (10)
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.
What did I have to show for my troubles? Not much, actually. Here are the three improvements that I noticed so far.
Did I miss anything exciting? This and this and this review didn't have anything that looked it would change my life. Not a problem, of course. Eclipse is a great IDE and pretty mature at this point. If I could wish for something, it would be better support for JSF and Scala. Maybe in 3.6. JSF 2.0 Refcard availablePosted by cayhorstmann on June 16, 2009 at 12:03 PM | Permalink | Comments (0)
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. If you haven't done so, give JSF 2.0 a try. It is a lot more fun than JSF 1.0. Here is a quick recipe.
Now look at the source. Note these points:
If you are stuck with JSF 1.x, the old refcard is still available. My Department is SlashdottedPosted by cayhorstmann on June 15, 2009 at 09:12 PM | Permalink | Comments (13)I teach computer science at San Jose State University. My department just
ended up on Slashdot.
One of my colleagues, Dr. Beeson—who, to his great credit, makes
beginning students write lots of little homework programs until they get
them right—got into a tussle with Kyle
Brady, an eager student who insisted on publishing
his answers 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
So, what does it mean for teaching and learning programming when the solution to every beginner problem is available on the internet? I am all for more code reading by students. Too many students just write code, and if googling an answer makes them read more code, that's great. When I learn new stuff, I set myself little tasks to solve. I don't just google for the answer since that would defeat the purpose of learning. Are our students like that? Kyle Brady probably is. But I have met a few who just want to get a good grade, get their degree, and start making money. Others are willing to do the right thing but lack the self-discipline. Quite a few work a job or two to put themselves through college, and limited time and financial necessity makes them go to Google when they shouldn't. That brings me to the issue of “certification”. When you hire someone, you want to see that college transcript because you expect some correlation with ability. So, we as instructors need to give grades, and to give grades, we give homeworks and exams. All of whose solutions are available on Google. So, how can we certify that students know what they are supposed to?
Strategy #2. Starve them for time. That's what TopCoder and betterprogrammer do. Sure, you could google for hints, but then you would not be able to finish in time. My students will argue that I use that approach as well, and they do not like it. Strategy #3. Interview each student personally and ask questions about the code. Unfortunately, this is incredibly time-consuming and impractical on a large scale. (After all, if this was easy, we wouldn't have the SCPJ.) Strategy #4. Forget about coding and evaluate students on their ability to be creative, express themselves, resolve conflicts in a non-confrontational way, etc. etc. These are all wonderful traits, of course. But I am reminded of a faculty summit at, of all places, Google, where eager professors from reputable institutions shared the latest thinking in computer science education. At the closing session, one of the Google managers said that this was all good and well, as long as the graduates can code.
What you don't hear in Slashdot is that Dr. Beeson is actually doing a good job. He built a system where students can submit their problems until they get the right answer, and for a lot of students that is pretty motivational in itself. Obviously motivational enough to get Kyle Brady to come up with answers that he is proud to share with the world. Java One 2009 Day 4Posted by cayhorstmann on June 05, 2009 at 09:03 PM | Permalink | Comments (5)The Toy ShowOne 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. The BlueJ team received a well-deserved special recognition for building tools that help millions of high school and college students get started with Java.
A fellow from RuneScape dev demoed their tools, and I learned how one animates a water troll, something that will surely come in handy one day. There was a wacky demo involving a Wii infrared sensor and infrared LEDs that guide a projector. One of them lets kids draw on a virtual wall. I want it for the Horstmann twins. Tor Norbye, the demo stud, showed a very impressive JavaFX authoring tool whose release is planned in December. I admit that I was dubious about Java FX when it was first released, but it is looking much better now. At least when Tor demoes it... There was a demo by the high school kids who won the FIRST robotics contest. Sun and the FIRST folks just ported the programming environment from C/C++ to Java. They hope it will lead to more interesting robots in the future—right now, the students struggle enormously with core dumps. They need volunteers—check out their web site. What's in it for you? “There is nothing more fun than see your program drive on the floor.”
The Grameen foundation showed off an open source system for helping with microfinance in third world countries. They also need volunteers. SIM cards have now become so powerful that they can easily run Java and a web server. The latest ones can interact with sensors and WiFi radios. A fellow showed how you can mock that up with Sun Spots for easier debugging.
Someone demoed a satellite ground station management app built on Netbeans RCP (i.e., the same platform on which the Netbeans IDE was built), using over 1000 modules. As it happened, James Gosling's first programming job was in a satellite ground station (he was 14), using a PDP 8. It had less compute power than a modern smart card. Two Hungarian university students showed off the project that won them first price in the Ricoh printer contest. Those printer/copiers are Java-powered, and the students used them to grade multiple choice exams. A musician showed off a Java-powered juke box that allows independent artists to upload their creations to a web site and have it played in bars. As James put it: “Here's Manuel. He is a musician. He has a problem.”And with the help of a touch screen, a cash reader, and Java FX, he put together a solution. “Project Bixby” controls an Audi TT on a dirt rallye course going really fast (160 km/h) without a driver. And finally, the“LincVolt” project controls a 1959 Lincoln Continental with an electric motor, this time with a human driver—another musician named Neil Young. There is a Swing-based control panel. Boy, is it ugly—maybe JavaFX can help. What's next? The “Thinkin' Lincoln” that no longer requires Mr. Young? Technical SessionsI attended the “JPA Magical Mystery Tour” session. JPA has been a real game-changer, maybe more than people realize. I can now routinely run student projects that involve a database, with a lecture on JPA and a couple ofcode samples. These are greenfield projects, so there is no need for any SQL. Of course, as the speaker pointed out, in a real project, you don't need to write the SQL, but you still need to understand what goes on. For example, JPA 2.0 has a nifty Bill Pugh gave a repeat of his “Defective Java” talk—the antidote to “Effective Java”. If you haven't used his FindBugs tool, check it out now! He had a sabbatical at Google where he explored how FindBugs does on production code. Interestingly, it found a lot of bugs—over 3/4 of the flagged issues were deemed by Google engineers to be mistakes that should be fixed—but it didn't find many mistakes that really matter. Those had been found earlier, and perhaps painfully, through testing and failures in production. The moral is to use FindBugs early. Bill is now working on a cloud service for community review, where programmers can post previously found bugs. When you evaluate a FindBugs issue, you can then evaluate whether it is likely to be serious. Our cat, Mr. Darcy, would like to thank Bill for the bug that he tossed my way when I raised my hands as soon as I saw the slide involving
Ludovic Champenois (AKA Ludo) gave a presentation about EE6 tooling in NetBeans and Eclipse—sadly not well-attended at a time slot that is usually reserved for such crowd pleasers as “Enhancing the Role of aLarge U.S. Federal Agency as an Intermediary in the Federal Supply Chain via a Service Registry and a JBI-Based ESB”. Ludo is responsible for the Glassfish plugin for Eclipse, which I can heartily recommend. If you just get started with it, download the Finally, after having been thoroughly worried about JSR 299 vs. JSR 330, I decided I'd better learn more about Guice, and I attended the talk by Jesse Wilson. Ok, it's a nice enough DI framework. You configure injection with a “fluent” API, not XML. That's nice. But it isn't as nice as WebBeans, erm, Contexts and Dependency Injection. Instead of writing a lot of XML boilerplate for configuring a test of a large system, Guice makes you write a lot of Java boilerplate. Here is the one thing I don't get about JSR 330. It has this annotation SummaryJava One is now over, and here are my random conclusions and opinions.
Java One 2009 Day 3Posted by cayhorstmann on June 04, 2009 at 09:17 PM | Permalink | Comments (2)For Packrats
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. Here goes: curl -d ilc=230-1 -d ilg=English -d is=y http://www28.cplan.com/cc230/sessions_catalog.jsp > index.html mkdir cb_export for f in `grep -o "/[^/]*.pdf" index.html` ; do curl -u contentbuilder:doc789 -o cb_export/$f http://www35.cplan.com/cb_export/$f ; done This script improves upon last years—point your browser to index.html, and you get a page with all the talk names and links to the local PDFs. For extra credit, figure out how to add the paperclip. Miscellaneous FunHooray--no keynotes today. (They were there, but I wasn't.) My day started out with a "Second Life" session with David Geary. It was weird but kind of fun. Here are the slides, and here are David (in the middle of the podium) and myself (to the right).
I went to a lab in which I built a "JavaFX client-server application with Jersey and REST based web services" in 100 minutes, which is pretty good given that I have never used either Java FX or JAX-RS.
JAX-RS is definitely very nice--thanks eduardo for pushing me to check it out. Java FX was better than I thought. Of course, they gave us a pre-made component with the nifty effects (a pie chart with animated slices). I noted that Java FX now has a bunch of standard effects, like "glow" and "distant light". That kept the code clean and manageable. The lab stuck to the easy part--reading data from the server. I would have liked to have an enhancement where cli king on a slice modifies the data on the server, but the course author said that was pushing the 100 minute limit. I like to run hands-on labs in my own classes to make sure that my students get a good amount of practice and have someone there when they need help. It's always a big hassle, with students' hardware and software configurations failing in exciting ways. Well, the lab attendees--who looked like professionals--didn't have a better track record than my students, keeping four Sun people scurrying from one machine to the next. Technical SessionsKito Mann gave a nice talk on writing composite components with JSF 2.0. This feature is definitely a crowd pleaser. Also check out Jim Driscoll's slides. Cliff Click and Brian Goetz's talk "Not Your Father's Von Neumann Machine" gave a crash course on modern hardware. I thought I know nothing about hardware--whenever the hardware courses come up during faculty meetings, I lose my customary loquacity for fear of embarrassment. Cliff and Brian talked about instruction pipelining, parallelism, speculative execution, and branch prediction. Hey, I knew that. Multicore memory caches. I knew that. And that was pretty much it. Ok, I learned something new about chip-level multithreading, but the idea is pretty simple. I guess I'll speak up at the next faculty meeting and ask why my students seem to be stuck with the von Neumann architecture. Check out the slides when they become available--they are very clear. Finally, I went to Phillip Haller's and Frank Sommers' talk on Scala actors, which didn't have a huge audience but a very long Q&A period. Here is what I learned.
Overall, it was a pretty satisfying day at the conference, but it doesn't make for a thrilling blog. Did I miss something exciting? If so, please comment! Java One 2009 Day 2Posted by cayhorstmann on June 04, 2009 at 12:02 AM | Permalink | Comments (5)The keynoteI 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. Today's mobility keynote was easily the most painful in my memory. Some fellow from Sony Ericsson broke into rambling monologes that left his stage partners speechless, and he had an inexhaustible supply of platitudes (such as "Every user is unique" and "You can be a part of the total experience") that work better in the executive suite than a gathering of engineers. He seemed a bit taken aback that the audience didn't "get" the idea of "monetizing" the 200 million Sony Ericsson phones out there. But help is on the way, in the form of another app store. Oh goody... The store has been around for some time, selling ring tones, games, music, and movies. Unlike the Java app store, they figured out how to take money. After July 1, you can submit your apps (without having to pay a fee, which is apparently customary in the game biz), and they'll review it within 30 days. For their trouble, there will be a 70/30 "rev share". I think I'll skip the other keynotes. JUG Meeting With James Gosling/Buzz from the Floor/Radio InterviewVan Riper kindly invited me to the Silicon Valley JUG meeting with James Gosling. JUG members and students asked lots of very interesting questions. A few random answers that I remember, hopefully accurately:
People asked about "buzz from the floor", such as "Why isn't there a banner advertising next year's Java One, like there used to be in the past?" James didn't know. But he did know what was behind the rumor that he coached Larry Ellison in Java FX programming. It was not so. Larry just downloaded the SDK and hacked together some stuff on his own. Later, I told that story to some engineers, and they inquired whether it was really Larry who did it, and not his personal hacker.
Unfortunately, I had to run off early to give a Java One Radio interview. The recording should be available here. Technical SessionsI attended Jonas Bonér's session entitled "State--You are doing it wrong". Jonas reviewed three alternatives to standard locking: Software transactional memory (with Clojure), actors (with Scala), and data flow, which he called "the forgotten paradigm". He wrote a custom library for data on top of Scala actors. It wasn't very deep, but I learned
Alex Miller gave a talk on concurrency gotcha's, with good old fashioned locks. The talk was very well attended--clearly, interest in concurrency has reached the mainstream. Most of the gotchas were pretty familiar, such as the shared DateFormat. (I really hope the date and time API makes it into Java 7. Haven't we suffered enough?) I liked the slide: synchronized(what goes here?) I had students who would just try filling in one thing after another into that slot...
I tell students that they should just stay away from synchronized blocks unless they really know what they are doing. Reentrant locks seem easier to understand. Of course, there is a way of snatching defeat from the jaws of victory, also covered in Alex' presentation: public static final Lock LOCK = new ReentrantLock();
synchronized(LOCK) { ... }
JSR 299My final presentation was Gavin King's talk on WebBeans, erm, Contexts and Dependency Injection or JSR 299. Gavin is an opinionated speaker--good thing his opinions were pretty close to mine. He was very enthusiastic about EE6 (provided, of course, it includes JSR 299). As he puts it, finally the EE stack will be fully usable without 3rd party addons. The web profile removes a lot of old cruft. I agree--cruft removal is excellent. He says JavaMail should have been added. Agreed too--all my web apps seem to need JavaMail, usually for password recovery. He spoke kindly of JSF 2.0. It fixes "all the problems". Ed Burns, whom I met later at the Java EE party, basked in that statement :-) There are a lot of things to like in WebBeans, erm, Contexts and Dependency Injection. Gavin will tell you about the benefits of loose coupling with strong typing. But I'll be more pragmatic.
Gavin promises a proposed final draft of the spec by Monday. During the Q&A, he sad that, in hindsight, JSR 299 should maybe have been an SE JSR. I asked about potential conflicts with 330? Gavin said that JSR 299 has no (portable) solution to a standalone bootstrap outside a Java EE container, which JSR 330 provides. He'll be glad to adopt whatever they come up with. But the fact remains that there are gratuitous naming differences between the JSRs. At the Java EE party, Ed Burns introduced me to Bill Shannon who oversees Java EE. Bill seemed genuinely perturbed by the conflict between the two JSRs. I hope this gets resolved in a positive way. As an app developer, I really want the benefits of WebBeans in Java EE 6. Sure, I could always use Seam, but that removes the "one stop shopping" advantage from Java EE.
At dinner with my co-author, David Geary, and my editor, Greg Doench, we talked about the Winchester Mystery House, the building constructed by the widow of the gun manufacturer who was obsessed about the spirits of those killed by the guns. The house has over a hundred rooms, most with no purpose, windows that don't open, and stairs that lead to nowhere. As one of the dinner companions remarked, just like the JSF spec. Ouch! Tomorrow, too early in the morning, David and I will be in a Second Life chat. Please join in if you are into that kind of thing. Java One 2009 Day 1Posted by cayhorstmann on June 02, 2009 at 10:53 PM | Permalink | Comments (0)The Morning KeynoteI am no fan of keynotes, but I figured I should earn my press pass (thanks Jacki!) and show up.
The keynote started auspiciously, promising a release of Java SE 7, but that turned out to be irrational exuberance—it was just another JDK 7 build. This may seem a trivial distinction, but it is not. There is no official JSR for Java SE 7, and at tonight's JCP party unnamed but knowledgeable people agreed that Sun was not moving forward with the JSR because they are nervous about Apache Harmony. Perhaps the plan is to forge ahead with JDK 7 and then rubber stamp a fait accompli through the JSR process, which would not be good. Apparently, every keynote must go through the usual dreary ritual of allowing paid sponsors to say their part. This time, we had
Once we got that out of the way, things got more interesting. There was a demo of a Korean made TV set running Java FX. This was the first really compelling use case that I saw about Java FX. Flash or Silverlight aren't plausible candidates for running in a TV set. But Sun has experience in getting Java into embedded devices, and you want flashy UIs there, not Swing. And there is a nice per-device royalty coming Sun's way. Nandini Ramani showed off a nifty looking authoring tool for Java FX that is slated to be available by the end of the year. Then there was a demo of the Java store, presented by James Gosling. The idea is that a developer can put an app on the store, turning the labor of love into day job. When I first heard about it, I was dubious, but I can see two advantages. (1) The “drag to install” feature is nicer than anything you can do on Windows today (2) The app store can automatically install new versions.
Most importantly, at the end of the keynote, Scott McNealy and Larry Ellison showed up. They said the usual things about not being able to say anything until the acquisition was completed, but then Larry said soothing words about being supportive of OpenOffice, Java FX, and Android-powered netbooks. In the post-keynote press conference, someone asked why Java FX wasn't developed under the JCP. Good question, I thought. Jeet Kaul, a Sun executive said that the speed of innovation in this technology wasn't compatible with the JCP. Ouch. I asked about the sorry state of Java ME/FX on cell phones. I was reminded that it takes a long time for phones to incorporate new technologies. Fair enough, but the showcase phone for Java FX (which you can buy on the show floor) is the HTC Diamond, running Wince. I think I'll pass. In summary, this year's Java FX demos looked a lot better than last year's. I did come away with the impression that the renewed focus on the desktop was for real, and that Oracle might keep it going. The Afternoon KeynoteIn the afternoon, Bob Brewin hosted annoucements on the status of Java SE, EE, and FX. Mark Reinhold gave a nifty demo on managing modules in Java SE. He got a resounding applause when he said “the classpath is dead”. Roberto Chinnici demoed Glassfish v3 and got a round of well-deserved applause when he demoed “deploy on save”. If you have not experienced hot deploy of an EE app, you should really give Glassfish v3 a try. It is a game changer in terms of developer productivity. I'll spare you the details about SOA and the app store. SessionsJoe Darcy talked about “project Coin” or small language changes
in JDK 7. Properties, reification of generics, and closures are definitely out.
They would impact too many parts of the JDK. He walked us through the many
issues raised by the introduction of
Well, it's better than nothing, but I have come to realize that the Java language may well have reached the end of its evolution. For more fun/productivity, it may be best to look for other languages on the JVM. I attended the Clojure presentation. The software transactional memory feature is intriguing, but otherwise, I think I'll still consider Scala first. I was on the “Tools and languages” selection committee again this year, where we reviewed about 500 proposals for technical sessions and BOFs. Many of them were excellent, and we could only accommodate a small fraction. Rather than filling the entire allotment with JRuby talks (←minor sarcasm here), I successfully lobbied for some of the more advanced topics, such as Michael Ernst's presentation on type checking annotations (JSR 308) and Phil Haller's work on Scala actors. I was very happy to see Michael's talk fill up with an attentive audience that asked lots of great questions. Overall, for me, the highlight of the day was seeing Larry Ellison on the stage, appearing generally supportive of the entire breadth of the Java ecosystem. Java One 2009 Day 0Posted by cayhorstmann on June 01, 2009 at 10:37 PM | Permalink | Comments (3)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. Here are some of my impressions from today.
Guillaume Laforge gave a nice presentation on what is new in Groovy 1.6. An expanded version of the talk is here. I was most impressed by the ability to manipulate abstract syntax trees. For example, class Event {
@Delegate Calendar when
String title, url
}
All of I really want to like Groovy, but what is holding me back is (a) the rather ad-hoc process in which Groovy rediscovers what has been known in other (mostly functional) languages for a long time and (b) the stubborn resistance to producing a language spec. As for (a), consider the sections on ”multiple assignment” and “optional return for if/else and try/catch/finally blocks” in the InfoQ article. In Groovy, you can now write def (a, b) = [1, 2] What's with that mishmash of parentheses and brackets? In Scala, you'd write val (a, b) = (1, 2) That's because Scala—like so many of its predecessors—has tuples. And Scala—like so many of its predecessors—has conditional expressions that return values, without having to wait for version 1.6. Perhaps I quibble. But the lack of a spec really bothers me. Suppose I add
two JSF 2.0 can work very nicely with Groovy, and I understand that the lack of a spec is making it difficult for the JSF spec to acknowledge that fact. Hopefully, one of these days, the Groovy folks will get around to a formal spec.
Dan Allen gave a great presentation on running Seam on Glassfish, and what pitfalls one encounters. Mostly, the issues are JNDI naming, exploded WARs, and other distasteful topics. It all adds a dose of reality to app server portability. Sharat Chander and someone who admitted to being in marketing talked about Project Kenai. David Geary and myself are hosting a project there for our Core JSF book. The site works just fine, but I never understood why it describes itself as “more than a forge”. The speakers were hinting at great things to come, in terms of continuous integration, testing, and deployment, so that will definitely be worth watching.
I met up withDennis Cosgrove of alice.org at the show floor. If you haven't checked out Alice, do it now! It is a super-cool environment to teach programming to middle and high school kids. The new version—now in beta—has two enhancements. It has characters from the Sims that are a lot smoother than the old wireframes. And you can program in Netbeans, in addition to the Alice IDE. Next semester, I will try this out on freshman students, replacing the old “print all prime numbers < n” with problems that use the Alice cast of characters.
My favorite talk of the day was a “lightning talk” by Masafumi Ohta on running OpenSolaris on an Eee PC. Now here is a true hacker. Apparently he even got Second Life running! Finally, I stumbled into a “bring your own laptop” lab on the Eclipse Glassfish plugin, brought to you by Ludovic Champenois (AKA Ludo). I had used that plugin with good success, as did my software engineering students last semester. We used Java EE 6 + JSF 2.0 on Glassfish v3 with Eclipse, and it all worked out. Except, that there was some flakiness with the adapter. My students figured out how to solve this by downloading the Eclipse + adapter + JavaDB bundle that Ludo provides, but I stubbornly refused to do that and ran into grief when Glassfish v3 updated. It turns out that you need to manually check the update site for the plugin:
(It doesn't help that the update site is called https://ajax.dev.java.net/eclipse.) When the Glassfish plugin broke for me, I had a miserable time testing my JSF 2.0 examples with Tomcat for the last several weeks. I look forward to going back to Glassfish! If you are still using Tomcat, you should really have another look at Glassfish or another app server. This year, Sun has been very generous in admitting students to Java One for free. In fact, one of the lab participants who ran into trouble in that lab turned out to be one of my students—good choice on her part; she is starting a master's project using this stuff. I ended up being pressed into service with troubleshooting because she ran Linux. The issue was a space in a file name :-)
This being day 0, I have no profound observations yet. There seems to be cautious optimism about EE 6, JSF 2.0 and even OpenSolaris and Java FX on the conference floor. Interestingly, I ran into a group of my students and asked where they were going. The cloud talks, duh. The Fit and Finish of JSFPosted by cayhorstmann on May 29, 2009 at 07:44 AM | Permalink | Comments (5)
Now, admittedly, I am biased. I am a co-author of the best-selling JSF book, with David Geary, published by Sun Press. I am making lots of pennies on the Safari page views and a few dollars from the hardy souls who, bless their hearts, still buy the paper version. But frankly, there are easier ways of making a buck than writing a JSF book. I wouldn't do it if I didn't think JSF was (or, at least could be) the cat's pajamas. We all know that JSF is far from perfect. Too much stuff in the HTTP session. Component authoring is way too hard. A leaky abstraction. The stack trace from hell.
But what really bugs me is the overall lack of “fit and finish.” Sometimes, JSF feels like one of those lower end American cars that make up much of the rental car fleet. Cheap, mismatched buttons. Gaudy metallic plastic that comes off when you stare at it too hard. Here is a random example, one of many: JSF 2.0 has a new feature for locating resources. It's pretty nice. You dump
images, CSS files, scripts, and so on, into subdirectories of a
<h:graphicImage library="images" name="myimage.png"/> Or, as my coauthor inexplicably prefers, <h:graphicImage value="#{resource['images:myimage.png']}"/>
As it happens, I have a command button with an image. Wanting to be
thoroughly modern, I move the image to the <h:commandButton image="#{resource['images:myimage.png']}" .../>
Of course, it doesn't work. The value of
The JSF 1.0 expert group had to worry about big and important things such as
the pluggability of the state manager, and nobody paid much attention when
I know, it's no big thing, and I can work around it. It's just like that rattling piece of plastic in the rental car. And I don't want to make fun of the JSF expert groups. They are very knowledgeable and have solved hard problems in constrained time frames. My beef is with the process.
With this process, cruft is bound to accumulate. JSF is not the only culprit. Apparently, all is not well in the land of servlets. And that's a much simpler spec. I think the process needs a couple of tweaks
Again, I don't want to bash JSF. There are lots of nifty things in JSF 2.0, and I see no really compelling alternative to it. (If there was, everyone would just flock to it instead of kvetching about JSF.) I just want more fit and finish in JSF 2.1 and 3.0. My Oracle Pronouncements for JavaPosted by cayhorstmann on April 21, 2009 at 09:03 PM | Permalink | Comments (12)
The Java blogosphere seemed pretty happy when IBM was rumored to acquire
Sun. IBM has made many contributions to the Java infrastructure, embraced open
source well before Sun, and, with the release of Eclipse to a independent
foundation, showed more confidence in open governance than Sun. Everyone
expected them to be a good steward of Java. With Oracle, the mood seems less
optimistic. Of course, Oracle has made contributions such as the EclipseLink
JPA implementation and the Trinidad JSF library, but
they pale in comparison with IBM. And some developers are clearly weirded out
by Larry Ellison... There have been many questions and guesses what will happen to various pieces of Java and other open source technologies that Sun has. Here are my guesses. It will be interesting to come back in a year and see how many of these I called right, and where I was way off. MySQL. There has been a lot of talk how this is surely the end of MySQL—Oracle will just let it wither on the vine or kill it outright. Well, I don't think so. Suppose someone can't use MySQL any longer. Would they say “aw shucks, then I'll just have to fork over the money for an Oracle database”? No, they'd first have a look at a MySQL fork or PostgreSQL. I think Oracle will be smart, keep MySQL as an entry level product, and use it to get consulting revenues and an upsell opportunity. MySQL actually seems a better match for Oracle than Sun because Sun never had that upsell opportunity. Java 7. There have been grumblings that Sun is busy working on a JDK 7 without moving forward on a JSR for Java 7 because they don't want to get into a fight with IBM and Apache about TCK licensing. Will Oracle see the light, let Apache use the TCK, and then go back to using the JSR process, which despite its flaws is a lot more transparent than what is currently happening with JDK 7? I would like to see that happen, but I don't think so. Oracle just paid good money for the right to do whatever they want to do with Java, and I fear it will take some time until they understand that the best thing they can do is to let go. Netbeans. Many people seem to think that Netbeans is a goner too. After all, Oracle has its own IDE, JDeveloper. Come on, people. Have you ever used JDeveloper??? I am sure Oracle realizes that developers have stayed away in droves, and that you can't force the unwilling to use it. If Netbeans were to die, Eclipse would be the winner, not JDeveloper. Instead, this is a golden chance for Oracle to get rid of the JDeveloper albatross and switch to Netbeans. Glassfish. The conventional wisdom is that Oracle just paid a bundle for BEA, so they don't want Glassfish to succeed. I am not so sure. Oracle wants Java EE to succeed, and Glassfish is the reference implementation, so they can't very well ditch it. In the past, Glassfish acquired high-end features such as clustering, and I would expect that trend to stop. Still, it is in Oracle's interest that people use Glassfish and not JBoss for their entry-level Java EE projects, and I expect that it will remain a viable option. JavaFX. I predict it won't survive. The beancounters will want to cut something, and this is the obvious candidate. It's not making money, it isn't making visible inroads against Flash or Silverlight, and in general Oracle doesn't have much interest in client-side software. I am not the only one with this brilliant insight, so if Oracle does intend to keep it going, they really need to make some reassuring announcement very, very soon. What worries me is the state of client-side Java in general. Sun has done a rather poor job with the thankless and expensive task of building a reliable Windows installer/updater. Is Oracle committed to putting more resourcees behind that effort? If not, the future for client-side Java is bleak. OpenSolaris. Oracle has said that they want to integrate Solaris and the database products and deliver an integrated solution with hardware, OS, app server, and a database. Solaris makes a lot more sense for Oracle than for IBM. Do they want to keep it open? I am afraid it's not a high priority. VirtualBox. Your guess is as good as mine. I really like VirtualBox, but I don't understand why Sun bought it in the first place. OpenOffice. As an OpenOffice user, I am grateful to Sun for having it brought along this far. I hope it gets more love and attention in the future, but I see no reason why it should, except that Larry might want to spite Microsoft. Much A-do About NothingPosted by cayhorstmann on April 06, 2009 at 06:04 PM | Permalink | Comments (11)
Why am I not keen on bigger coverage of the
Here are the grep statements in case someone wants to improve on this: grep -r -h "[^A-Za-z0-9]for (" . | grep -v "^[ ]*[*]" | wc
grep -r -h "[^A-Za-z0-9]while (" . | grep -v "^[ ]*[*]" | wc
grep -r -h "[^A-Za-z0-9]do {" . | grep -v "^[ ]*[*]" | wc
As you can see, 98% of the loops are not Moreover, a boolean positive = false;
while (!positive)
{
System.out.print("Please enter a positive number: ");
value = in.nextDouble();
if (value > 0) positive = true;
}
instead of do
{
System.out.print("Please enter a positive number: ");
value = in.nextDouble();
}
while (value <= 0);
Is the first alternative that much worse?
That's indeed what other textbooks do. They give equal billing to each Java loop type. Here is a quote from one briskly selling text:
To paraphrase Truman Capote, that's not computer science—it's taxonomy. (And it's bad taxonomy. Wouldn't “the case of reading the numbers
until the input is 0” be one of the few cases where a
But, you may say, an employer wants to make sure that any student whom they
hire can read a I guess this gets to the heart of the difference between certification and education. In my loop chapter, I want to educate students to
Am I getting all worked up over nothing? I could just give in and turn the “advanced topic” into a regular section. Or should I stick to my guns? Please help me make up my mind by posting your thoughts! |
July 2009
Search this blog:CategoriesCommunityCommunity: Global Education and Learning Community Community: Java Enterprise Community: Java Tools Community: Java User Groups Community: JavaDesktop Community: JDK J2EE J2SE Linux Programming Archives
June 2009 Recent Entries | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|