Monday, November 19, 2007

Seam Tip Number 4

Seam Tip Number 4 : @In(required = false) pitfall

In retrospect this is really obvious, but a member variable annotated with @In will be overwritten in subsequent invocations of a Stateful Session Bean even with a "required = false" on the annotation.

I had assumed that the "required = false" would prevent the variable from being injected if it wasn't present, but that isn't the case.


Blogged with Flock

Wednesday, November 7, 2007

NumberFox

This is a completely cool Firefox plugin that Neal Ford mentioned in his Productivity talk at No Fluff Just Stuff (I was at the Atlanta one.)

Clicking ctrl + z or ctrl + w will display small, numbered boxes next to the clickable elements in a page. You can then click the link by clicking the number and enter from the keyboard.

Blogged with Flock

Tuesday, October 30, 2007

Seam Tip Number 3

Seam Tip Number 3

This isn't so much a tip, but a "gotcha" to avoid.

Make sure that you have an <h:messages /> tag in your page and that it does not have "globalOnly" set to "true."

I spent a lot of time wondering my my method wasn't getting called when the problem was a not null value being trapped.

Blogged with Flock

Wednesday, October 24, 2007

Seam Tip Number 2

Seam Tip Number 2

Keep insert statements inside the import.sql file on the same line.

One of the coolest things about developing in Seam is the "create-drop" setting for data. 

If you create your project with seam-gen and choose "y" for the prompt, "Do you want to drop and recreate the database tables and data in import.sql each time you deploy?" there will be three files, import-dev.sql, import-test.sql and import-prod.sql.  The data in these files will be used to populate tables generated from your entities.  You can of course do this manually, but I want to be brief.

I mocked up some data and redeployed, but I wasn't seeing anything when I hit the page.  Watching the log files after restarting the server showed an sql error on import which turned out to be the line break.  I was using Eclipse to edit the file so I found that odd, but stranger things have of course happened.  I removed the line breaks and everything worked.

Blogged with Flock

Tuesday, October 23, 2007

Seam Tip Number 1

Seam Tip Number 1

Seam-gen saves your defaults in the build.properties (Ant of course) file inside the [Seam dist]/seam-gen folder. 

If like me you have accidentally typed the wrong directory for your project workspace or the wrong directory for your db driver jar file, simply edit the build.properties and the defaults will change.


Seam-gen is a cool part of JBoss Seam.  From the Seam docs,
"This is the easy way to get your feet wet with Seam, and gives you some ammunition for next time you find yourself trapped in an elevator with one of those tedious Ruby guys ranting about how great and wonderful his new toy is for building totally trivial applications that put things in databases."

Blogged with Flock

Code is design

Everyone has heard the line, "The older I get the more I realize my father was right."  This a cliche of course, but I'm reminded of it pretty often now that I have kids of my own.

The Too Much Code blog, which I found on DZone this morning, reminded me of this.  Unless I have a selective memory, more selective than the average anyway, I remember hearing that we developers needed a complete design before we started coding.  I still hear that a lot actually despite the success of Pragmatic Programmers, XP, Scrum, etc.

I don't remember people telling me that big up front software design was a bad idea, and the older that I get the more I think it is at best a waste of time and worst a serious project risk.

From Too Much Code :
"If we accept that code is design -- a creative process rather than a mechanical one -- the software crisis is explained. Now we have a design crisis: the demand for quality, validated designs far exceeds our capacity to create them. The pressure to use incomplete design is strong."

From the articles (same link as in the quote) that he references,
"We must keep in mind, however, that these tools and notations (UML, CRC Cards, Booch diagrams) are not a software design. Eventually, we have to create the real software design, and it will be in some programming language. Therefore, we should not be afraid to code our designs as we derive them."

Too bad my father never told me anything about software development.

Blogged with Flock

Friday, October 19, 2007

Seam Lifecycle

I've been playing with JBoss' Seam for a brief while now. I've used Struts for years so I'm completely familiar with its' action based lifecycle. I have considerably less experience with JSF. Knowing a framework's lifecycle is definitely useful, and I wanted a diagram of Seam's.

This article from IBM Developerworks has a gif diagram that nicely outlines Seam's enhancements to the JSF lifecycle. I printed it out and tacked it onto my cube.

Blogged with Flock