Friday, August 10, 2007

Excel Charting in Java

Ahh, Excel...  I hate it.  I find it rather unintuitive, to be honest.  No, no no...that is not quite saying enough.  I find it nearly impossible to use.  Business folk however, love it.  In every company that I have worked for, every user group I have served has, eventually, asked for something to be output to Excel.  Of course, for us Java folk, there is good old Apache POI.  Now, POI is pretty good.  I've used it in a number of projects and have not had any stability issues.  Performance is generally acceptable when dealing with reasonable amounts of data.  It does however, have a good number of limitations.  A large subset of the Excel functions are still unimplemented and there is almost no support for charts (To be specific: charts will be preserved but cannot be altered).  This is often a big stumbling block.  Furthermore, building spreadsheets with method calls is not a very efficient process for the developer.  Creating just a single spreadsheet can require a lot of code.

This is the problem I found myself up against recently.  In searching for a possible solution, I came up with a couple of really useful finds.  The first of which was jXLS.  jXLS is an excel templating framework of sorts.  It allows a designer to insert tags into a template spreadsheet which will be interpreted by jXLS and populated appropriately.  The tags utilize an expression language very similar to the EL used in JSPs or XSLT.  Developers who are comfortable with either of these technologies should feel right at home with jXLS.

Basically, you can create an excel sheet and throw in some expressions like so:

jXLSexpressions.png

Then you run in through jXLS with something similar to:

Map beans = new HashMap();
beans.put("item", items);
XLSTransformer transformer = new XLSTransformer();
HSSFWorkbook results  = transformer.transformXLS(Thread.currentThread().getContextClassLoader()
    .getResourceAsStream("daysToProvideInstructions.xls"), beans);

As you can see by the fact that we get a HSSFWorkbook back from this method call, jXLS is based around POI, but it does the having lifting for the data insertion.  If you want to shove that file back out via a HttpServletResponse, you don't need much:

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename=warrantyAgingReport.xls");
results.write(response.getOutputStream());

Put all this in your web app and you'll get:

jXLSpopulated.png

So, jXLS gives me a nice and easy solution for populating a spreadsheet with data...but, we still cannot edit the ranges of any tables that we create.  Furthermore, if we want functions to be evaluated when the spreadsheet is opened, we have to evaluate them in POI, right?  Named Ranges to the rescue!  It just so happens that we can define a dynamic range in Excel and give it a name.  We can then use those named ranges in charts, functions, etc.  This results in a those items being dynamically evaluated and gives us the results we want.  So following Micro$oft's own instructions on the matter, we can create a couple of ranges in our template spreadsheet like so:

namedExcelRanges.png

Using those ranges in a chart gives us the following:

dynamicallyRangedChart.png

Now we have the dynamic Excel charts we need, generated via our Java web application with very little excess effort.  So, while I still hate Excel...today I hate it from Java just a little less. :)

Thursday, August 2, 2007

Austrailian Echoes

Would you like a fork, sir?  It looks like the Echo2 community has finally made that option a reality with the Cooee project.  Cooee (an Austrailian "Over here!",  of sorts) is being put forth by Karora, an open source group with routes in Melbourne.  The "openness" of the Echo2 project under the guidance of NextApp has been questioned by the user community for some time now.

I am, personally, torn on this issue.  I empathize with the issues raised by Karora.  I think that the leadership of the Echo2 project have given the community the impression of being forsaken or, worse yet, irrelevant.  However, I am still a little unsure of the timing.  Echo seems to be on the verge of a fairly major release and I can't help but wonder if waiting for that code to surface might have been worth it.  What is done is done, however and Karora can always spend some time merging code. :)

I want to wish the best of luck to the core Karora team in gaining acceptance as well as momentum.  A little competition never hurts...

Blogged with Flock

Wednesday, August 1, 2007

Work, school and other such obstacles...

So, school, work, and life have gotten in the way of posting recently.  Summer classes are always time consuming.  I am working on a couple of different tutorial ideas right now.  I've got SCRUM, JavaFX and the Swing Application Framework in my sights at the moment.  SCRUM is almost ready to go, I can decide on the App Framework or JavaFX to follow it up though.  I've begun work on both, but hit the breaks when everything else picked up.

To those of you reading, my apologize for the delay.

Tuesday, June 19, 2007

Podcasting Tutorials?

So, I've been thinking a lot about the kind of information that I want to convey here.  I am very fond of the tutorial format.  The problem is that I am not really convinced that blogging tutorials is appropriate.  The reason that I say this is that my tutorials tend to get long-winded rather quickly (as does anything that comes out of my head).  Tutorials seem to be a better fit for the multi-paged, online magazine format.  The problem I have with going that route is two fold.  First of all, I have no desire to spend time trying to convince some online editor to publish my tutorials.  Yes, I could always do it myself, but I really do not think that my goals match up with that format.  I, like many of you out there, am a busy guy.  I think I do a pretty good job of keeping current, but it takes a significant effort.  This is an effort that, sadly, most developers either do not have the time or the motivation to undertake.  My answer to this problem has been multi-pronged.  First, I utilize the wonderful service provided by Netvibes to keep my time spent having to jump from site to site at a minimum.  Secondly, (and this is something that Netvibes also helps with) I practice active "time shifting".  What I mean by this is that I utilize technology to help me make something out of the time in my day that is lost to the abyss.  The time I am talking about is that spent in the car, in lines, waiting for other people or even performing the less "thought intensive" parts of my day job.  Now, I do not want to give anyone the idea that I put all of those minutes to actively advancing myself.  A good many of those minutes get devoted to things that are nothing but mind candy.  I do, however, listen to a number of podcasts that take aim at intellectual topics or attempt to educate their listeners in some way or another.

This got me thinking: would a podcast be a good format for tutorials of this type?  While there are a number of podcasts that address software development, most of them focus on news or interviews.  From what I can tell, there really is not much out there providing active training to the community.  Personally, I know that I would listen to a podcast of this type...but that goes without saying.  What I am stuck on is whether or not audio is a format that would be widely accepted for this purpose.  I have a number of tutorials canned and ready to go.  So, I am contemplating recording a few of them up front to determine if there are any hurdles to getting this type of information across in an audio format...and maybe syncing that audio with a "screencast" if I get ambitious.  If it goes well, maybe I will release them and see what everyone has to say.  If the response is good, I'll keep it up.  I am a bit concerned about being able to create tutorials at a rate that would keep a listener base coming back.  However, if I get enough feedback, I may try to balance that out by requesting tutorial submissions from listeners.  We'll see...it is really just a thought at this point.

technorati tags:, , ,

Drink More Guice...

Okay, okay...this post is, seriously, a long time coming. I have not posted anything for a while for a number of reasons. I could give the details, but there aren't enough of you out there who are going to care. So, I'll skip it and get into the goodies.


Reading this may actually kill two birds with a single stone for many of you. For the example project that I put together here, I made use of the Echo2 framework. There are a number of reasons that I chose to do this. First of all, I think that dependency injection (D.I.) can be particularly beneficial when working in a component model. I think the switch to a real component model in Java GUI development is long overdue, particularly in the world of web UI development. So, I am hoping that this example will convey the ease with which a simple UI can be created using a framework like Echo2 or GWT as well as provide a few simple, yet useful, ways to leverage D.I. when creating a user interface.


We have all seen dependency injection brought into the main stream by the Spring Framework. As many of its proponents will tell you, Spring is a very powerful and highly configurable tool, whose usefulness goes way beyond simple dependency injection. Many people see Guice as a competitor to Spring, and in some ways it is. However, Guice is not nearly as broad in functionality as Spring. Guice is aimed at being fast and simple for dependency injection only. One immediately evident difference between Spring and Guice is Guice having fully embraced annotations in its implementation of DI. While I must point out that while the JavaConfig project has brought annotation based configuration to Spring, the implementation is, arguably, more complex and results in a more intrusive presence in the most common circumstances where DI is being used. If you are familiar with Spring and JavaConfig, much of this will become evident as I continue.


Enough of this blathering, let's look at some code. I am going to start with what many tutorials will save to the end: the point of injection. Ideally, D.I. should be something that is as invisible as possible. Far too often you see people directly accessing a framework's DI context directly in several different places in their application code. This is a situation that I will try to avoid in this tutorial. To that end, I am going to try to find a place where injection can happen once and the effects will flow throughout the rest of the application. In an Echo2 application this choice is simple, every Echo2 application instance is feed off and attached to the user session via a WebContainerServlet implementation:


package com.amateuratbest.examples.guice;

import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.webcontainer.WebContainerServlet;

import com.amateuratbest.examples.guice.layout.LayoutModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.Module;
import com.google.inject.servlet.ServletModule;

/**
* This is where all the Guice-iness goes on. We will look for our injector
* in the ServletContext, create it if necessary and then inject our newly
* constructed ApplicationInstance. All done!
*
* @author mkimberlin
*/
public class TestGuiceServlet extends WebContainerServlet {

private static final long serialVersionUID = 2715828643772899566L;

/* (non-Javadoc)
* @see nextapp.echo2.webcontainer.WebContainerServlet#newApplicationInstance()
*/
@Override
public ApplicationInstance newApplicationInstance() {
TestGuiceApplication newApp = new TestGuiceApplication();
// This uses the Injector class name as the attribute name...
Injector injector = (Injector) getServletContext().getAttribute(
Injector.class.getName());
if (injector == null) {
injector = Guice.createInjector(new Module[] {new LayoutModule(), new ServletModule() });
getServletContext().setAttribute(Injector.class.getName(), injector);
}
injector.injectMembers(newApp);
return newApp;
}
}

In order to avoid constructing the injector more than once, I am keeping it in the ServletContext. If one isn't in context when I need it, it can be instructed by specifying the configuration modules that contain the desired configuration. Yes, you read that right. The configuration is done in Java, not XML. For the purposes of this example, I have a set of two modules that will be used for injection. In this case, I have one application specific module (LayoutModule) and one Guice-provided module (ServletModule). If you are working with a web application, you will almost definitely want to include this second module, as it defines injection scopes for request and session as well as providing bindings for injection into the request, session or response. It should be noted that there is nothing preventing the use of different modules as dictated by your applications needs. Module selection could be done based on user preferences, branding, or any number of other concerns. The main thing here is that, if I do things right, we should never see an injector again.


Now that we've seen our "point of entry", as it were, let us grab a quick look at those configuration modules:


package com.amateuratbest.examples.guice.layout;

import nextapp.echo2.app.Column;
import nextapp.echo2.app.SplitPane;

import com.amateuratbest.examples.guice.annotations.NamedAnnotation;
import com.google.inject.AbstractModule;

/**
* This class contains the DI bindings for the main layout components.
*
* @author mkimberlin
*/
public class LayoutModule extends AbstractModule {
public static final String BANNER = "banner";
public static final String NAVIGATION = "navigation";

@Override
protected void configure() {
bind(Column.class).annotatedWith(new NamedAnnotation(BANNER))
.to(BannerColumn.class);
bind(SplitPane.class).annotatedWith(new NamedAnnotation(BANNER))
.to(BannerSplitPane.class);
bind(SplitPane.class).annotatedWith(new NamedAnnotation(NAVIGATION))
.to(NavigationSplitPane.class);


// Note that if you uncomment the following lines you will get a compile
// time error. Guice's use of generics means a far less error prone
// configuration process. If this were done in a config file, you would
// have to wait until run time to discover your mistake.
//
//bind(Column.class).annotatedWith(new NamedAnnotation(BANNER))
// .to(BannerSplitPane.class);
}
}

This module, lovingly dubbed "LayoutModule" extends the abstract class AbstractModule that is provided as a part of Guice. As you can see, you only need to override the configure() method and specify the bindings that you would like Guice to honor when doing injection based on this configuration. The first two calls to bind() produce bindings for the given classes for any case where the target is annotated with a named annotation constructed with the name "banner". Using named annotations like this is simply one way to accomplish multiple bindings for the same class. The third call to bind() produces a second binding for the SplitPane class. However, this binding only applies when the target was annotated with a the NamedAnnotation for "navigation".


The section of code that has been commented out can be uncommented to see how Guice's "config in code" approach results in a less error-prone configuration. Static typing results in a compile time error if you have configured a binding that doesn't make sense.


This next piece of code has a couple of methods that are requesting injection. What is worth attention in these is the fact that there was no binding necessary. If you look at the earlier configuration module, you will not find anything that creates a binding for these classes. Crazy Bob Lee and his ilk at Google appear to have put a good deal of effort in to minimizing the amount of configuration you have to do (of which this is but one example). In this particular case, I just need to make sure that any new instances get a rootWindow and layoutPane. Since Window has an available default constructors, Guice will just take care of things for us without having to be told. LayoutPane is a similar, but not identical circumstance, but I will investigate that in a moment.


package com.amateuratbest.examples.guice;

import nextapp.echo2.app.ApplicationInstance;
import nextapp.echo2.app.Window;
import nextapp.echo2.app.componentxml.ComponentXmlException;
import nextapp.echo2.app.componentxml.StyleSheetLoader;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.amateuratbest.examples.guice.layout.LayoutPane;
import com.google.inject.Inject;

/**
* Very simple implementation of the Echo2 ApplicationInstance. Normally, we
* would not want to have a check that is "injection aware", per se...but I did
* here for "instructional" purposes. Now I think I'll use some "more quotes",
* "just because" i think they are "groovy".
*
* @author mkimberlin
*/
public class TestGuiceApplication extends ApplicationInstance {
private static Log log = LogFactory.getLog(TestGuiceApplication.class);

private Window rootWindow;

private LayoutPane layoutPane;

/* (non-Javadoc)
* @see nextapp.echo2.app.ApplicationInstance#init()
*/
@Override
public Window init() {
try {
setStyleSheet(StyleSheetLoader.load("/style.xml", Thread.currentThread().getContextClassLoader()));
} catch (ComponentXmlException e) {
log.warn("Could not load default styles for routine builder.");
}

if(rootWindow == null) {
rootWindow = new Window();
log.debug("Injection Failed...");
} else {
log.debug("Injection Worked...");
}
rootWindow.setContent(layoutPane);
return rootWindow;
}

public Window getRootWindow() {
return rootWindow;
}

@Inject
public void setRootWindow(Window rootWindow) {
this.rootWindow = rootWindow;
}

public LayoutPane getLayoutPane() {
return layoutPane;
}

@Inject
public void setLayoutPane(LayoutPane layoutPane) {
this.layoutPane = layoutPane;
}
}

Unlike with Window, Guice is not using a default constructor for LayoutPane:


package com.amateuratbest.examples.guice.layout;

import nextapp.echo2.app.ContentPane;
import nextapp.echo2.app.SplitPane;

import com.amateuratbest.examples.guice.ComponentUtil;
import com.google.inject.Inject;
import com.google.inject.name.Named;

/**
* Constructs and contains the main layout components of the application.
* You will notice the constructor parameters are named. In this example
* I'm using named mostly to avoid writing a bunch of custom annotations.
* This may or may not be the right approach for your project.
*
* @author mkimberlin
*/
public class LayoutPane extends ContentPane {
private SplitPane bannerSplitPane;
private SplitPane navigationSplitPane;

@Inject
public LayoutPane(
@Named(LayoutModule.BANNER) SplitPane bannerSplitPane,
@Named(LayoutModule.NAVIGATION) SplitPane navigationSplitPane) {
super();
this.bannerSplitPane = bannerSplitPane;
this.navigationSplitPane = navigationSplitPane;

add(bannerSplitPane);
bannerSplitPane.add(navigationSplitPane);
}

/**
* @return the navigationSplitPane
*/
public SplitPane getNavigationSplitPane() {
return navigationSplitPane;
}

/**
* @param navigationSplitPane the navigationSplitPane to set
*/
public void setNavigationSplitPane(SplitPane navigationSplitPane) {
ComponentUtil.replaceChild(bannerSplitPane, this.navigationSplitPane,
navigationSplitPane);
this.navigationSplitPane = navigationSplitPane;
}

/**
* @return the bannerSplitPane
*/
public SplitPane getBannerSplitPane() {
return bannerSplitPane;
}

/**
* @param bannerSplitPane the bannerSplitPane to set
*/
public void setBannerSplitPane(SplitPane bannerSplitPane) {
ComponentUtil.replaceChild(this, this.bannerSplitPane, bannerSplitPane);
this.bannerSplitPane = bannerSplitPane;
}
}

In this case I have made Guice aware of a constructor available for use during injection with the @Inject annotation. Furthermore, I have annotated the parameters of said constructor in such a way as to trigger the bindings that I presented in the LayoutModule.


Another instance of injection in this example application that deserves calling is in the NavigationSplitPane. Let's take a look at its constructor:


@Inject
public NavigationSplitPane(Column buttonColumn, ContentPane mainPane, ContentDAO contentDAO) {
...
}

Here again, there is a constructor being marked for injection, and again there are default constructors being used without configuration. The last parameter deserves a few words, and not only because it is highly irregular to construct a GUI component by handing it a DAO...but that's not the point here. ;)


As you might expect, ContentDAO is an interface. So, how did Guice know what to do for it?


package com.amateuratbest.examples.guice.dao;

import com.amateuratbest.examples.guice.dao.mock.ContentDAOImpl;
import com.google.inject.ImplementedBy;

/**
* Simple DAO interface with a default implementation annotated for Guice.
* Using the ImplementedBy annotation allows the developer to supply a default
* implementation in the event that there is no explicit binding for an
* interface. This is the case 90% of the time for most projects.
*
* @author mkimberlin
*/
@ImplementedBy(ContentDAOImpl.class)
public interface ContentDAO {
public String getContent();
}

Some people are going to balk at this right off of the bat. "WHY does my interface know about its implementation?!?" However, I think you have to see this as something that is available for your convenience (and boy is it convenient) and not a required part of working with Guice. If we developers are honest with ourselves, or simply inspect our code, it is clear that most interfaces we create use a single implementation 80+ percent of the time. This makes those 80+ percent easy. Obviously if this is an interface that you are going to package as a public API for some B2B system, you probably want to avoid this type of dependency. Most of the time that is not the case, however. Most of your interfaces only exist on the server and only have one implementation in the first place. So, it is up to you to decide when using this "default implementation" feature is appropriate


I have not presented all of the code contained in the example application in this tutorial. I would encourage you to download and deploy the application for yourself. Plop the war in tomcat and off you go...all of the dependencies are included in the project zip file. You will then be the proud papa (or mama) of a rich web application developed with only a few Java classes, and without touching any javascript directly, which manages to hydrate itself successfully with only one initial point of injection.

Friday, April 13, 2007

Geekfest is good for the soul!

So, this post was originally going to be all about Google Guice.  After writing for a few paragraphs, I realize that if I ever got to Guice this would be the longest blog post of all time.  So, tomorrow you get Guice and today you get Geekfest!  "What the heck is Geekfest?", you might ask, or maybe not, but you should.  Yes, I am sure there is some concert or conference or some such wonder by that name...but, we do not care for such things.  Geekfest in this conversation is a few hours that the team that I work on puts aside every other week to encourage, even require, developers to take the time to keep their skills up-to-date and share their experiences with the group.  Think of it as on-the-job training that even the veterans need.  I have been on so many teams that do not make learning a priority.  On most of those teams, training would be provided only if there was an impending need.  This is a disastrous way to do things.  First of all, we as developers absolutely must stay current if we want to stay employed.  Furthermore, we as organizations must keep the skills of our development staff current if we wish to be able to compete in the marketplace.  Now, we can simply expect developers to keep themselves current.  We can put in the job description that a developer must advance the knowledge of the team, or stay current with market trends or run a freaking marathon...but that does not make it happen.  Even for those developers who are self-motivated enough to do these things on their own, what percentage of them go around to the group and make sure everyone knows what they know?  Not very many, I can tell you.  We geeks tend to be made up of a high percentage of the less-than-social crowd.  A lot of people just do not feel comfortable doing this.  So, what happens to that knowledge?  Maybe it gets utilized, maybe that person puts it to work on a project or more likely it wastes away.

Managers and team leads: You have a responsibility to ensure the best performance of your teams.  You have a responsibility to facilitate the growth of those around you.  Do not forget this.  Yes, I know that you have to get the project done.  Yes, I know that it is already 3 weeks behind schedule (that is your fault too, but we will talk about that in another post).  None of that matters.  Admit it!  Two or three hours every other week will not be noticed as even a blip in your time line.  What do you get out of this?  You get a team that feels like their development is important enough to you and to the organization to make it a priority.  Have you ever felt that way?  Does your organization put you first?  Make it happen for your employees, it makes a world of difference.

Maybe all that touchy-feely mumbo jumbo is not enough to convince you.  So, let us take a look at the basic rules that will allow us to realize some actual benefit for the team:

  1. Thou shalt not skip the 'fest, no matter how busy you are...only actual emergencies qualify as an excuse for absence.
  2. Thou shalt not investigate anything directly related to project work during the 'fest.
  3. Thou shalt share your experiences with the group before leaving the 'fest.
  4. Thou shalt capture the results of your investigation at some level on the 'fest wiki.

Now, that isn't asking all that much is it?  Do you see where the increased benefit comes in here?  No, well let me wax poetic on that for a bit. :)

We have already addressed the fact that, if left to their own devices, only a fraction of of the group will actively expand their horizons and that only a fraction of those will share a fraction of what they learn with the group.  Wow...that is a lot of fractions and a lot of lost knowledge.  What makes Geekfest different?  Everyone learns what everyone was learning!  I scream, you scream we all scream for...oh, never mind.  Even the thickest headed of management will see the benefit of this.  If a team of six goes into a room and spends two hours investigating different topics then each one shares what they learned, what do you get?  Let us do a bit of arithmetic. 6 people do 2 hours of work and share that with the team of 6...hrrrm: 6 x 2 x 6 = 72 hours with of gathered knowledge.  You invested 12 man hours.  Need I say more?  Now of course our implementations of this will be less than perfect.  Still, this is a great deal for an organization  What will happen if we let developers do this on their own?  We have to start dividing instead of multiplying.  Oh, and those developers who were learning on their own...do you think they stop because of this new found study time?  Not from my experience.  If anything, they are spurred forward in their endeavours. This is a big fat win for everyone involved.

Now, you have read this.  It all makes perfect sense to you.  How could you not have seen this before?  So, what are you going to do about it?  If you are a manager or team lead, schedule the meeting now.  Do not wait.  You and I both know it will get swept under the table.  If you are a developer, suggest it to your boss.  If you do not feel comfortable being that forward then send them a link to this post.  Tell them your friend that works over at the major competitor said his team has been doing this for months and how much they are gaining from it.  The entire industry will be all the better for it.

technorati tags:, , , , , ,

Tuesday, April 10, 2007

Domain Driven Design...revisiting good ol' fashion OO.

A few weeks ago I attended the Gateway Software Symposium put on by the guys from No Fluff Just Stuff. While I was there, I got the opportunity to listen to Venkat Subramaniam talk about domain driven design. I almost skipped out on it for something else, but Venkat's knack for speaking is always good for an enjoyable lecture at the very least...so I went for it. As expected, Venkat gave a great talk. While the content convinced me even further that DDD is essentially a repackaging of old ideas, it also made me realize that some of the things that have bothered me about some of the ways we utilize patterns, and how many of them are even enforced as standards. This is just evil. Some of this stuff is so ubiquitous that we just accept it as perfectly normal. How many of you have worked on a project that looks something like the one below (hopefully with a few more classes)?

I know that I have...and not just one. Now, mind you, this project is trying really hard to have good practices. It wants to reduce tight coupling...heck, it might use DI a la Spring or Google Guice. What it does more than anything is insult our intelligence. When I see a project like this, it makes me wonder why all this poor User has been scattered all over creation. I feel like this project is trying to be a self-describing code cookbook. It practically begs you to right a BO, a controller, a DAO, a model object and a factory for every class you create. Now, I know we all hear a lot of people telling us not to put business logic in with our model. I say, "Bullocks!"...put logic where it belongs, wherever that may be. Sometimes our objects want to know how to do things for themselves. Not only that, but why are we all so afraid of maintaining state in our applications? Yeah, it comes with some complications...but sometimes those complications are worth it and even appropriate.

I want us to start taking a hard look at what the users are saying about how they work. Listen to what they are doing...how they are working now. You probably had a professor use the old analogy of the bicycle and how all bicycles have a few attributes and actions that are common to them. That same professor probably talked about 10-speeds and how they have some extra attributes and actions that a plain old bicycle might not. I often wonder what this professor would think of seeing:

int gear = bicycleBO.getCurrentGear(tenSpeed);
bicycleBO.setGear(tenSpeed, gear+1);

I will tell you exactly what he would say:

tenSpeed.upShift();

I am not advocating that we go back to the days of gigantic all encompassing classes...where a bicycle knows how to do anything that one might possibly want to do with it. I mean, I might want to hang my bicycle from a tree, but that does not mean that my bicycle should know how to climb trees. I am merely saying that we need to stop worrying so much about applying patterns across the entire landscape of a project and start thinking about the design that fits best.

technorati tags:, , , , ,

Friday, March 30, 2007

Fresh Blood

No, no, no...I'm not going all Scott Sigler on you. (Go get Ancestor tomorrow, Junkies!!!)

I am talking about breathing life into that dead project. We have all been there. You are assigned to a project where momentum appears unattainable and you fear the worst. If you are a project manager and this is your project that I am talking about, big red flashing warning lights should be going off for you right now. When the dynamics of a project team go stagnant and the momentum has died off (if it ever existed), it may be time to call in some fresh blood.

Let me make it clear that I am not suggesting that adding new people in the middle of a project is going to solve all your problems. As most of us in the real world are aware, this is rarely an option. Often only projects of the highest priority and visibility have the freedom to infuse their team with "resources" at a whim. Furthermore, this will often be counter productive. What I am suggesting is much more benign that any of this. I am saying simply that the right person can breath new life and vitality into a project. So Mr. Manager, if you happen to find yourself in the sorry position of needing to fill a vacancy on a project that is already flailing, turn it into an opportunity. Do not simply fill the slot with someone who can crank out that code. Take the time to find someone who has a focus on team communication. Experience with agile development practices can bonus points to your candidate. Finding these candidates is no easy task, but they are out there...and if you are having a hard time getting your hands on the right person, just give my employer a ring. I am sure they would be happy to let you know when I will being freeing up. ;)

Someone who is excited to dive in and learn from the team, who has focus on the user community and goes out of their way to encourage involvement from everyone can turn a failing project upside-down. When it works, the change is dramatic. Let us hope that your project is not need of such a "magic-maker"...but remember that it is never too late to make a necessary change.

Wednesday, February 14, 2007

Down with JSP!!!

Okay, okay...that's a bit of a troll, I admit. However, I have been doing Java based web applications for what must be more than 7 years now and I am honestly sick of JSPs. Now, before I get all ideological on you, I want to point out that I am not sure that we are ready to completely eliminate the JSP from the planet. I will tell you that the average developer of Java web apps is spending way too much time looking at these things. JSPs are nasty, dirty things that are difficult to put together and even worse to maintain. Now, I'm sure some people reading this will start thinking things like "this guy probably still uses scriptlets everywhere" or other such blasphemies. I will assure you this is not the case. I use all the happy little taglibs that are supposed to make my life so much easier. Yeah, well they don't...

So, it's obvious that I am getting a bit hot-in-the-collar about this. However, I think that most of us who care about such things realize that the old familiar style of web development just isn't doing it any more. I am tired of switching from XML to Java to SQL to CSS and on and on and on. I am tired of writing unnatural form bindings and silly validation scripts. I am tired of not being able to interface with the components on my web UI in the same way I would any other components in my application; via a Java API. Now, that there are frameworks that are getting there. I have used Echo2 and fiddled with Google Web Toolkit a bit, and they are on their way. I am really excited to see the switch to a component and event paradigm in web frameworks. I wish that JSF had not been so little so late. However, I guess that change is in the air and we really will not know where we are going until the dust clears. Wherever that may be, I sure hope we get there soon...because, if I have to write another <%@ taglib prefix="c" uri="/WEB-INF/tld/c.tld" %>, I'm not sure I can take responsibility for my actions...


technorati tags:, , , ,