Monday, June 04, 2007

Imperial Stout via Batch Sparge

My brother-in-law and I recently started brewing beer. Being in Fort Collins, amongst some top-class breweries, we thought we'd be in good company.

Robb's got extensive experience in the craft, having brewed scores of quality beers, meads and wines. On the other hand, I have done very little. After making 2 or 3 batches in the dorm kitchen about 10 years ago, I just gave up. I found it much easier to run down to the corner for a sixer after I became of the age to legally purchase. Nevertheless, I love making my own stuff, and having a discriminating palette, I've always wanted to get back into making beer. With summer nigh upon us, and plenty of "Yeah, dude. We gotta brew!" conversations through the past year, Robb and I finally jumped in head first making beer.

Our last batch was a pale ale using Crystal hops exclusively. It turned out to be pretty good. A little light in body, cloudy, and not quite bitter enough, but Mmmmm tasty. One of the best things about home brew is that you get a chance to make more if it's not quite right -- and if it's perfect for that matter too.

Yesterday, we set out to build an Imperial Stout. We used an award winning recipe from Robb's stash, with a full 18lbs of grain for a ~5 gallon batch (Yowza!). We decided to omit the 10 lbs. of raspberries it called for, as neither of us have the garden, nor the budget for such an extravagant adjunct.

We started at about 8 in the morning with some donuts, coffee and a wee bit of mead Robb happened to find hibernating in a forgotten Corny keg. The mashing went a little less than controlled. We started with water that was about 4 degrees outside of the envelope of enzymatic activity we wanted, and semi-frantically (only as frantic as home brew allows) tried to cool it down, as you would a hot bowl of oatmeal. Then we went in for some breakfast. When we got back out, it was way too cool, by about 10 degrees F. I hypothesize because it was sitting on the concrete. We decided to put it back on heat for a bit until the temp got to where it needed to be.

I was in charge of the re-heat. I stirred while the pot was over the flame, and watched the thermometer closely. It rose pretty slowly, until I gave it a good stir. And suddenly it was like 20 degrees too hot. Real nice. With any enzymes completely fried that would help us out with any starch conversion, we decided to check the status. Fortunately our starch converted. Whew!

After a discussion with the friendly owner of the local home brew shop, we decided to batch sparge our mash. I didn't quite understand the process at first, but it turns out to be pretty simple. Instead of letting the grain sit while spending an hour sprinkling hot water over it, you go through a process of draining the mash at full speed, stirring in the sparge water in a couple batches until you have your desired volume. The best instructions for batch sparging, we found at brew365. There's lots of other articles about the technique, but few make it seem as simple as it is.

After that, everything went as planned. We got the gravity reading we were hoping for too (with 18 lbs of grains we BETTER). It should be quite a stout stout.

Robb just sent me a movie of the fruits of our labor. She lives!

Friday, June 01, 2007

Action based frameworks and fine-grained component dependencies

Working in an action-based framework, such as Struts, there's the inevitable problem where you may want to render a page which has content that the Action hasn't prepared yet.

The prime example is in the case of bad validation. Let's say we're viewing a page which has dynamic content on it, such as a list of products in a store. If I submit a form on that page with a validation error, in default cases the execution code, which probably retrieved that list of products, doesn't fire, and I'm forwarded to a validation error result page. Same action, different result page, but I still probably want to have the list of products on the page. I just don't want to process the form

The problem is that action based frameworks make an action do many things. It's not just a form processor, or just a product retriever, or a User retriever. It's all of those things at the same time.

There are solutions out there, and this is mostly a brainstorm about which kinds work well, and which do not.

In Struts 2, there's a tag which can call another action. It's kind of like action chaining. For example, if I have an action named "productList" which retrieves a set of products, I can just insert that tag, and I'm good to go. The nice thing about this is that it allows for more fine grained actions, tailored to specific tasks. On the down side, more than one action is being fired per page view, which can be pretty expensive.

There's also the option of creating a custom jsp tag. This too can be pretty cool. Total customization is possible, and at a lower-level. On the down side, Custom tags can get a little out of hand, if they're made to do more than intended. It's also pretty far outside of the realm of the action framework, so they might not play well together.

JSF: I haven't done anything with JSF, but as I understand it, they'd work similar to the custom tags. Same down side, I think as well

Dependency injection: Another place I haven't roamed quite yet. Although, I'm sooooo on the brink of doing so. Allowing an action to be populated ala carte could be very beneficial, however, there's probably a little plumbing to do, on a per-action basis, to make those dependencies available to a page. Writing getters and setters for every action which *might* want to use a list of products could be a pain.

The answer? I don't know!

I'm pretty actively working in a Struts2 environment, so, I'm thinking that using the struts action tag might be the way to go. However, I don't know how I feel about tying an action to a specific task.