Jasper
(0 comments, 17 posts)
This user hasn't shared any profile information
Posts by Jasper
Interview Bruce Tate
A very good, thoughtprovoking interview on EJB3, lightweight containers and AOP with Bruce Tate (author of Bitter Java, Bitter EJB and his latest, Better, Faster, Lighter Java) can be found here.
Eclipse webtools
The Eclipse webtools subplatform is live, with two initial code submissions from Lomboz and IBM. More info here.
The submission by IBM is looking _really_ good: it’s like a free version of WSAD (WebSphere Studio Application Developer). Must delve deeper into this before making any conclusive comments though.
While on topic (well actually not at all): we might consider looking into the Spring framework, a lightweight container that takes care of things like transactions and decoupling of code (created by Rod Johnson of ‘Expert one-on-one J2EE Development’ fame) which has gotten a lot of attention in the J2EE communitiy lately. Click here for a short showcase/tutorial.
Exception-handling in Struts
For a simple and generic solution to the boring and code-aesthetics ruining routine of catching rare exceptions in your Struts-actions, try a global exceptionhandler. (more…)
A Generic MVC Model in Java
An interesting article about reducing the amount of code needed to implement a certain objectmodel, using JDK1.5′s generics.
“Model-View-Controller (MVC) is a widely used design pattern, especially popular in graphical user interface (GUI) programming. JDK 1.5 introduces parameterized types, or generics. Combining the two allows for a generic implementation of the MVC design pattern, freeing the programmer from writing code that handles the registration and notification of listeners, as well as from writing getter and setter methods for the properties of models. This article shows how this can be accomplished.”
I’m not sure if i find the code better readable, but that may also be because i’m not yet that accustomed to read code that uses generics..
ServletUnit
ServletUnit is a thin layer around the HttpUnit framework (reviewed here). An excerpt from the page:
“As a testing tool, HttpUnit is primarily designed for “black-box” testing of web sites. In many cases that may be all you need; however, if you are developing complex servlets, you may wish to test smaller pieces of your code. Sometimes you can isolate them into simple tests using only JUnit. In other cases, you will want to test in a servlet environment. At this point you have two basic approaches available. You can test in a real servlet container, using a tool such as Apache Cactus, which has you deploy your tests into the container along with your servlets. Or you can use a simulated servlet container. ServletUnit takes the latter approach.”
So again, like HttpUnit, ServletUnit is not a unittesting-framework. It is a way to execute complex servlets without the need for a servletcontainer. Before we might want to dive deeper in the API, i’ll try to explain why i think it is deprecated.
Since the advent of MVC-frameworks like Struts there has been a tendency to decouple the view and controller from the model using commands, facades, business delegates, or whichever useful designpattern you can think of, thereby moving the businesslogic to POJOs in order to make it as reusable as possible.
For instance, in a standard Struts application you’ll declare your actions (commands) in a xml-configuration file, extend the standard action by implementing the execute method and call your business-objects. A clean implementation of the method typically is only about 10 or 15 lines – at most, the real work is done in the model layer. When a request comes, a standard servlet (the Struts ActionServlet) redirects the client to a action-subclass which was specified in a request-parameter, calling its execute method.
Seriously, when was the last time you implemented a full fledged servlet?
My point exactly.
HttpUnit
First of all, although the name suggests otherwise, HttpUnit is NOT a unit-testing framework.
What is it then? Well, read this excerpt from the HttpUnit site:
“HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic http authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.” (more…)
Eclipse 3.0
After a promising start, getting me all enthousiastic about the new features described in the “what’s new” document, Eclipse 3.0 got to a grinding halt when i tried to create a simple helloworld class. It was extremely slow, even getting to the point that it wasn’t workable anymore. Switched back to 2.1 for now, but will try it out again later, maybe on a different machine.
Just as a teaser, two of the new features mentioned:
- “Copying or cutting Java code also captures information about which import declarations are needed by the copied code. The needed imports are now added automatically when the code is pasted.”
- “Select a constructor declaration or call in the Java editor and choose Refactoring > Introduce Factory. A static factory method is created that calls the now-private constructor, and all calls to the given constructor are replaced with calls to the new factory method.”
Update: tried it out again, on the same machine (without rebooting in between), and it seemed a lot faster. Not as fast as 2.1, but now it at least seems workable. Still, when rightmouseclicking (is that a word? it is now ) the project, package or classes in order to get to the relevant contextmenu, the menu popped up a bit slow though.
Recent Comments