A recent blog post from James Gosling starts a new t-shirt campaign to free Java to and turn the JCP into a real vendor neutral standards organization. Ironically, this idea was originally proposed by Oracle in 2007. It's also been announced by Josh Bloch that Google is boycotting JavaOne this year. I hope this whole mess gets resolved soon.
Tuesday, March 03, 2009
Today I read an entry on Alex Miller's blog. I encourage all developers to read it. Too many times we get defensive about getting too many requests, late requests, requirements changes, etc. We have a tendency to label the requests as "stupid" or "clueless". Frequently the requests are lame, but often then are just worded poorly. As Alex mentions, we should listen and attempt to understand the root of the request. We should lean towards saying yes to the request instead of defaulting to no. Frequently we see the request as purely technical or architectural. We're thinking in terms of inflexible APIs, keeping a separation of layers, or reducing maintenance whereas the business is thinking in terms of pleasing users, clients, or sponsors. Many times a different solution to what was requested will fit both needs. We can at least entertain the idea even if it means redeveloping the entire application. However, that decision is theirs to make. It's our job to outline the cost and trade-offs. Everyone involved will become happier as the relationship becomes more team and less adversarial.
Tuesday, October 14, 2008
Today's java.net article An Introduction To Servlet 3.0 has a pretty good overview of some of the things we might expect in the upcoming Servlet 3.0 API. 1)I'm not sure I like the use of annotations for servlets, perhaps I'm just getting old and cranky. Class hierarchies provide clarity. I've been using annotations in Spring MVC with mixed feelings. 2)I really like the idea of WebFragments for frameworks can automatically add their own stuff. I hope there's a way to disable it though. I can see some problems using a jar file that contains a web fragment and not really knowing it's even there. It could be filtering some other requests. Ouch! 3) Programmatic login/logout. It's about time we have reasonable flexibility for authentication. There are those that will says it's too little/too late because of Spring Security/Acegi. I like these too, but as much as you like to pretend, its not a standard, its not even a de facto standard. This is likely to be the best thing to come out of the new spec. I hope they get it right the first time. 4) The asynchronous support intrigues me. I'd like to get my hands on this and try some scalability testing. 5) HTTP Only cookies to prevent some cross-site scripting sounds promising. I'll have to look into some hacks to find out if this is of any practical use. 6) I agree with one of the commenters. Where are the generics? Generics provide consistency. If they can be introduced into the API without breaking backwards compatibility then just do it. They were fitted into the Collections API, so I think getParameterMap etc could slip it in no problem. By the way how about some new methods to get around those methods that return Enumeration. The Enumeration class needs to go. How about an Iterator or an Iterable so getHeaders() can be used in an enhanced for loop.
Wednesday, September 24, 2008
Brian Goetz opens our eyes again to the world of concurrency fallacies in basic everyday code. In his latest article Brian reintroduces us to something every Java web developer either know or should know but sometimes forget. You must code cautiously when using ServletContext and HttpSession to hold state. It makes the code ugly as sin, but it will bite you in the ass later if you don't. I know he was focusing on the thread-safety of the matter, but he did elude to problems with replication of data across a cluster. Too often we design with the intent that an app will remain small and a single server will suffice. Sometimes we'll stick some data for performance reasons in the ServletContext and expect it to always be present and current. However, the ServletContext is not replicated across a cluster like HttpSession objects. In this case you must resort to more involved solutions like: 1) Always hit the database: It becomes a performance drag, but will work. 2) In some cases a local non-distributed cache will work. In this case each node has its own cache of data it is utilizing, but the cache need not be replicated as the data will be retrieved from persistent storage. However, cache flushes must be distributed so that common items in all node's caches will be flushed when needed. OSCache does this very well. 3) Use the HTTP Session instead of the ServletContext. This one always feels wrong to me, but I guess in some limited circumstances is simple and useful. The problem is that mostly static data will exist in many HTTPSession objects instead of a more centralized location. You'll be using lots more memory, serialization and replication will take longer, and its a bloated solution. Use very sparingly. 4) I've never tried these but they seem interesting. Look into EHCache to see if it supports cache replication, or the Terracotta "network attached memory". While I'm certain these can scale, but what's the performance tradeoff to achieve the scalability.
Wednesday, August 27, 2008
Swing Explorer now has IDE plug-ins for NetBeans and Eclipse. Swing Explorer is a cool utility for visually inspecting Swing applications at runtime. Here's a screenshot that mostly describes the type of functionality available. Using the plug-in allows you to easily link back to source code.
Thursday, August 07, 2008
Here's a good blog entry which is best summed up by Effective Java(2nd edition) Item 47: Know and use the libraries. Know the java.util.Collections class In case you'd like to discover some more gems, here's the JavaDoc for java.util.Collections.
Friday, July 25, 2008
Here's a cool article from IBM DeveloperWorks about various tools used for autogenerating documentation (UML, DB Schema, Ant). Automation for the people: Pushbutton documentation Other tools I would add on top of these would include SpringViz or BeanDoc and JDepend.
Tuesday, July 08, 2008
The Java SE 6 Update 7 Release Notes show that VisualVM is now included in the JDK. VisualVM is a sweet monitoring/debugging tool that brings together jconsole, jhat, jstack, gchisto, the NetBeans profiler, and other tools into a single pluggable interface utilizing the NetBeans platform.
Thursday, June 19, 2008
Tuesday, January 29, 2008
I managed to make a crude video recording of my extreme feedback from Continuous Integration using Hudson and Sun SPOTS. The video is kinda bad mostly because I'm not good at this kind of stuff, but it shows my computer screen on the Hudson dashboard showing a good build. All the Sun SPOTs sitting in front of the monitor are shining bright blue to match the build. As Hudson is building the project there is a lot of dead time, but towards the end of the video, you will see the build break and all the SPOTs give an indication by blinking red 5 times, then stabilizing on red. In the video, its kinda hard to distinguish what color the SPOT LEDs are because they are so bright, and the video camera can't decide what to focus on. However, believe me when I say the LEDs are very blue followed later by very red :). As I mentioned before each of our developers has one in a cube, and the SPOTS talk wireless. I put all the SPOTS in front of the same monitor for dramatic effect. I hope you enjoy. I'll be posting the code somewhere soon, so if you're interested stay tuned.