www.codinghillbilly.com   kyle.baley.org  Subscribe / Contact
 
 
 
 
LATEST POSTS
Tuesday, March 30, 2010

You wouldn’t know if from reading my blog lately but yes, I’ve still been working on Brownfield Application Development in .NET with Donald Belcham. The good news is that the book is done. And as much as I would have loved the book to be released on April 1, I have to settle on March 30 for the ebook and April 12 for the print.

I probably should be pushing it a little more but I think the Canadian in me is what’s causing me to resist such flagrant self-marketing. Some may say that doesn’t bode well for its success but we have another take: If the book is good, people will hear about it with or without our help. In thinking of the books I’d like to be associated with, exactly none of them came to my attention because the publishers and/or authors told me about them. It was because a peer told me about it or I read a review in a blog.

For my part, having re-read it recently in preparation for its launch, I’m pretty proud of it. And I’m going to break character a bit to explain myself in a fit of self-reflection.

Over the years, I’ve gotten comments from people about my blog. The ones that make me feel all warm and fuzzy inside are the ones that don’t talk about the technical aspects. Instead, they mention the writing style. One of the best compliments I was ever paid was from someone who claimed he had a non-technical friend who read a single technical blog.

If it’s not obvious from the last few years’ worth of posts, I love writing. Absolutely love it. I love the way the rights words sound when put together and the way you can catch someone off-guard with the proper phrasing. I’ve long held the belief that one of the easiest ways to differentiate yourself from others in this industry is by learning to write well. And judging from the Facebook status of your average tween/teen, that’s only getting easier.

Technologically speaking, I’m pretty schizophrenic. Which means I don’t usually dive deep enough into a technology to bring much new to the table. So I focus my efforts on communication. In explaining things in a different way such that people understand it and remember it. This, to me, has always been lacking in the industry and it’s by focusing on that aspect that I’ve enjoyed a rewarding career both as a blogger and a consultant.

By the way, the light-hearted tone I’ve worked so hard to build here belies a larger effort. And I don’t want to get all high ‘n mighty bragging about how much work I put into this (though to provide full disclosure, I *did* just delete a couple of paragraphs about my writing process that did exactly that). But there is a reason for the tone I use. Our industry is too serious most of the time. I suspect most industries are. It seems some people do nothing but actively *wait* for something bad to happen so they can talk about it to someone. Before I started blogging, I cut my teeth on a little family rag with my brother. And encouraged by our reaction on that, I wanted to take the same voice to the technical community. Mostly so that other people can have as much fun as I’m having. To doctor a line from Heist (written by my favorite screenwriter, no less): everybody needs fun. That’s why they call it fun.

But that’s not why I started this blog post.

In the book, we are fairly sparse on acknowledgements. We include the people at Manning that helped us and our respective families but are vague on others. The reason being, my memory sucks and we knew we’d leave someone out. So this post is meant to be a more living document that I can update as I think of others.

Without further adieu, I’d like to specifically thank the following people who all contributed to the book whether they know it or not. Reasons can be provided on request (links are to twitter):

Thanks to the people at Manning: Marjon Brace, Liz Welch, Mary Piergies, Steven Hong, Cynthia Kane, Karen Tegtmeyer. Special thanks to editor, Michael Stephens who has an uncanny ability to diffuse any situation, and to our proofreader, Katie Tennant, who got all my jokes and made them sound better.

And, of course, my co-author, Donald Belcham who provided the majority of the technical content, though he probably doesn’t realize it.

Kyle the Rewritten

Saturday, March 27, 2010

The code from my Mix presentation on building REST applications with OpenRasta can be found here. Check out the ReadMe file to get started.

The app is a very basic music library. The home page lets you enter the path to a folder containing MP3 or WMA files and it will load a database table with the metadata from those files.

If you have any trouble, please post in comments so I can respond for the greater good. Similarly, I can make this available via Subversion or Git if there is enough interest.

If you didn’t watch the presentation and are wondering about the pink, I made a little detour about company naming strategies in order to explain why I chose Flamingo for the name. It’s a well-rehearsed spiel that I’ve been making for some time now so I shan’t elaborate here.

Kyle the Restrained

Saturday, March 27, 2010

This has nothing to do with technology or anything in particular. I was rummaging through my old documents folder and stumbled across something I had written many years ago that made me laugh.

Background: It was after a corporate to-do in which we were assigned teams named after tribes. Ours was called the Tatapa tribe. Other pertinent information: this was in Calgary which is (relatively) close to the Mackenzie River. And one of the members of our team was named Chris McPhee.

Tatapa tribe are we
A hearty bunch as you can see
Full of spirit and integrity
Yes, a noble group the Tatapa tribe be

A noble tribe with a long and rich history
So gather round and listen to me
As I relate our grand past to thee
So that thou may learn and like Tatapa be

Our tribe dates back many a century
Back to the year 26 B.C.
When a band of settlers traversed the country
Settling on a location near present-day Calgary
Settlers numbering thirty-three

Thirty-three men of integrity
Led by a noble group of three
Our namesake, Tatapa, and his wife, Baji

And the noblest of all, the noblest of the three
And of the settlers numbering thirty-three
A friend to Tatapa and his wife Baji
Our beloved founder: Humpwhiffle Horseradish McGee

They travelled to the mountains, to a peaceful valley
Carved by a river they named the River McGee
(Which was later claimed by some twerp named Mackenzie)

But back then, it was the mighty McGee
Named by Tatapa and his wife Baji
In honour of their friend, Humpwhiffle McGee

It was there that they settled, there in the valley
The thirty-three men of integrity
With Tatapa, Baji, and Humpwhiffle McGee
To lead the settlers, and thus to be free

So the settlers and their leaders three
Tamed the land and the River McGee
(Later claimed by that twit Mackenize)
And set up shop there in the valley
The very first industry the west did see

And what was it the west did see?
What was the profound industry?
The industry set up by McGee?
Stop asking questions and you will see

McGee set up a brothel, there in the valley
As grand a brothel as you ever did see
(Well, as grand as you get for 26 B.C.)
A brothel at the mouth of the River McGee
(I hate that bastard Mackenzie)

And so, Humpwhiffle McGee was filled with glee
Glee at the brothel on the River McGee
Glee at the money it would bring for he
He and his merry band of thirty-three
Thirty-three men of integrity

Well, the astute reader will plainly see
Thirty-three men does not a brothel be
Thirty-three men of integrity
And no one else as far as the eye could see
There at the brothel on the River McGee
Thirty-three men, alone in the valley
Alone with Tatapa’s wife, the chaste Baji
Thirty-three men of integrity

For Tatapa was away quite frequently
Fishing for food in the River McGee
And Baji would often get quite lonely
Did I say thirty-three men of integrity?
I meant thirty-three men of tenacity

So the tribe did thrive to 2001 A.D.
(Thanks, in no small part, to Baji
And the thirty-three men of tenacity)

And even today, you will see
We adhere to the same tenacity
(Though not quite to the same degree)
And in a pinch, we can fake integrity

There are those of you who question my honesty
You say to yourself, How can this be?
Thirty-three men of questionable integrity?
A man named Tatapa and his chaste wife Baji?
A leader named Humpwhiffle Horseradish McGee?
I don’t buy it. You’re lying to me.

Well, believe what you might I say to thee
Believe what you truly believe to be.
But let me take you back to 26 B.C.
To a cool night in mid-February
To a room in the brothel on the River McGee
(If I ever lay my hands on that Mackenzie)

Tatapa was away as he was quite frequently
Fishing along the River McGee
Baji, on this night, was feeling quite randy
As was our founder, Humpwhiffle McGee

And nine months later was born a baby
Born to Tatapa’s wife Baji
But not to Tatapa (although that’s what he did see)
Born in secret to Humpwhiffle McGee

And on that night early 26 B.C.
After the boy was born to Baji
Humpwhiffle said, My dearest Baji.
There is something I must confess to thee

What is it? What troubles thee?
My name is not Humpwhiffle Horseradish McGee, said he,
I changed it when I was not much older than three

Baji looked at her leader incredulously
But why? Why did you change it? asked she
Humpwhiffle looked at his feet dejectedly
The children would laugh. The children would tease me.
They thought my old name was funny.

Baji replied, "No. That can not be.
How could they laugh at one as noble as thee?"
"But they did laugh. They laughed at me.
They taunted and mocked and ridiculed me.
But not when I became Humpwhiffle Horseradish McGee."

Humpwhiffle wrapped his arms ‘round Baji
And sobbed for an hour until no tears had he
"Are you ashamed? Are you ashamed of me?

I lied to thee

I am not the man you think of me

I am not the noble Humpwhiffle Horseradish McGee"

Baji stroked his head tenderly
Cry no more, my noble McGee.
For I will name our son after thee
After the true name of Humpwhiffle Horseradish McGee
So that the future will know of thee
And know what you brought to this valley
This grand brothel on the River McGee

So what does this have to do with me?
What bearing does it have in 2001 A.D.?

Well, that child, the child that was born to Baji
The boy that bore the true name of Humpwhiffle Horseradish McGee
His ancestors live on right here in Calgary
They live among us, among you and me
The ancestors of Humpwhiffle Horseradish McPhee

 

When I initially posted this, Chris was quick with a response:

I did not know Humpwhiffle, and he didn't know me,
For he lived long ago, in 26 B.C.
But it wasn't Horseradish who visited Baji,
On that fateful night by the River McGee,
If my sources are right (and why shouldn't they be),
It was one of the locals called Haberdash Baley!

Friday, March 05, 2010

Google Web Toolkit has proven an interesting beast to code with. It’s not every web framework that encourages you to use passive view so strongly. That’s thanks partially to gwt-presenter which makes it pretty easy for views to be stupid. In most cases, the presenter even handles wiring up event handlers for the widgets.

Here’s a small excerpt of a view:

public class LiquorStoreListView extends Composite implements LiquorStoreListDisplay {

   Anchor addStore = new Anchor( "add store" );

   public LiquorStoreListView( ) {
      FlowPanel panel = new FlowPanel( );
      panel.add( addStore );

      initWidget( panel );
   }

   public HasClickHandlers getAddStore( ) {
      return addStore;
   }
}

This is missing a bunch of extraneous stuff as is the presenter below:

public class LiquorStoreListPresenter extends WidgetPresenter {

   LiquorStoreListDisplay display;
   EventBus eventBus;

   @Inject
   public LiquorStoreListPresenter( LiquorStoreListDisplay display, EventBus eventBus ) {
      this.display = display;
      this.eventBus = eventBus;
      bind( );
   }

   @Override
   public void onBind( ) {
      display.getAddStore( ).addClickHandler( new ClickHandler( ) {
         public void onClick( ClickEvent event ) {
            Window.alert( "Adding a new store" );
         }
      } );
   }
}

The magic is in the use of interfaces for the widgets. In this case, the Anchor widget implements HasClickHandlers which means the presenter doesn't need to know anything about the widget except that it implements a method, addClickHandler.

This falls apart a little when you have more dynamic user interfaces though. For example, what if each liquor store in our list contains an edit and delete button? Maybe we can expose them as a couple of ArrayList objects, I suppose. But that leads to much madness. And by "madness", I mean the angry kind, which isn't nearly as fun as the crazy kind where you're allowed more latitude at the daily stand-ups.

The reason exposing the edit and delete buttons as an ArrayList to the presenter is icky is because you need to figure out which row was selected. Which leads to some pretty funky implementations, some of which require you to maintain a separate list of click handlers and/or domain objects on the presenter which need to be kept in sync with the view.

Instead, I've started delegating a tiny bit more responsibility to the view. That is, it will wire up the click handlers which in turn, fire off custom events that have more useful data in them.

Here's a sample method in the view:

public void addLiquorStore( LiquorStore store ) {
   int lastRow = storeTable.getRowCount( );
   storeTable.setText( lastRow, 0, store.Name );
   storeTable.setText( lastRow, 1, store.Address );
   Anchor edit = new Anchor( "edit" );
   edit.addClickHandler( new EditStoreClickHandler( store ) );

   private class EditStoreClickHandler implements ClickHandler {

      LiquorStore store;
   
      public EditStoreClickHandler( LiquorStore store ) {
         this.store = store;
      }

      public void onClick( ClickEvent event ) {
         eventBus.fireEvent( new EditStoreEvent( store ) );
      }
   }
}

Then in the presenter:

public void onBind( ) {
   // ...

   eventBus.addHandler( EditStoreEvent.TYPE, new EditStoreEventHandler( ) {
      public void onEditStore( EditStoreEvent event ) {
         LiquorStore store = event.getStore( );
         // Get the store data and display it
      }
   } );
}

May seem like more work but I like the separation a little better. Alternative is to store the store ID in a hidden field and do some DOM manipulation to get it. But I always feel dirty if I have to do that in GWT.

Kyle the Impassive

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Copyright © 2010 Kyle Baley. All rights reserved.
 
CATEGORIES
.NET General (18) alt.net (4) altnetconf (9) ASP.NET AJAX (40) ASP.NET MVC (29) Bahamas (1) Bahanet (9) BDD (1) Brownfield (21) Career (10) Castle (1) Code coverage (1) Code review (2) Coding Style (6) Communication (1) Community (18) Conscientious Coding (35) Continuous Integration (11) dasBlog (12) Development (16) DevTeach (4) Domain (2) Environment (4) Estimating (1) Featured (14) Flamingo (10) Games (1) Google App Engine (3) GWT (9) Hardware (6) Java (2) Javascript (7) Linq (2) Livelink (6) Lucene.NET (2) MbUnit (1) Metrics (2) Miscellaneous (25) Mocking (4) NAnt (4) NHibernate (12) NInject (1) Office (3) Office Development (6) Open Rasta (1) Patterns (6) Presenting (14) Professional Development (15) Refactoring (10) ReSharper (11) REST (3) S#arp Architecture (5) Security (3) Software (11) Sundry (19) TDD (19) Tools (22) User Interface (6) Utilities (9) Visual Studio (8) VSTO (1) Web development (12) Windows (3) Working Remotely (17) Workplace (3) Writing (6)
 
LATEST POSTS
 
POPULAR POSTS
 
 
ARCHIVE