Rusty Divine

Live, Love, Learn, Teach

Software Development Book Club

We want your opinion and point of view - and I bet you want to give it to us! So, how would you like to join a book club with your on-line peers?

After last week's post where I mentioned a community workspace I set up at work, Keith and Nola started doing some brainstorming on how we could do something similar with an off-shoot of this site.

Now, we need your ideas on how to set it up and what features it should have, and your opinions on how to make it interesting enough to make you want to participate. There's a common refrain that goes, "I'd love to, but I just don't have enough time." Well, that's only half true because if you really wanted to and looked forward to it, you'd make time to do it. So what would it take to make you look forward to participating?

Last week I read a good quote somewhere about professional development that went something like, 'Where you're at professionally in 5 years will have a lot to do with the quality of books you're reading today.' (if anyone recognizes that quote, post the link to its true source!)

So, we want to develop a list of quality software books to read together. Personally, I'm more interested in doing a chapter-by-chapter review of each book (one chapter per week, or one section per week) than reading an Amazon-style critique of a book. I want to glean the book's big-idea out of the individual points and "a-has" that each chapter has to offer.

There are two more questions I would like you to consider:

  • What software could we use (maybe Campfire?)
  • What three books would be your top picks? (you can have already read them)?

Ketchup on Rusty

Spring has hit Seattle like a damp blanket. It's better than the 30-days-of-rain from January though, and people are finally getting the moss scraped off their backs. The days are actually light for over 12 hours now, the grass is growing (I've mowed thrice!), and all manner of creatures great and small are crawling and flying.

At the onset of every winter, I say to myself, "This winter I am going to use my gloomy days off and dark week nights to ________," and by this time every year I have done none of it and wonder where the winter went.

One winter a few years ago, I was going to get abs that I could see. That didn't, and still hasn't, happened, although I am in fair shape. Every winter for the past 10 years I've determined that I was going to pass the Microsoft certification exams. I don't even remember why I wanted to do it in the first place, but I've intended to do it for so long now that it is something that just has to get done (I hope that will put it to rest even though MS changes the certification levels every three years).

Two winters ago my wife and I started a business. We did the business plan, created the website, filed the forms, and did some advertising. And you know what? Not even a single call! It was depressing. Since then, we've pretty much shelved the business, but the website is still out there. I have gotten a few calls, and it has actually picked up a bit lately. In fact, I'm working on my second $300 gig - woot - or I would be if I wasn't posting this (actually, I should say retyping this since the first time I posted this my browser crashed and didn't save anything).

At my day job my morale is pretty high. Even though I'm about 5 rungs too low on the corporate ladder to merit an office with a door, I've managed to negotiate my way into one. It's a tiny room between the men's room and the women's locker room in a narrow hallway with no exterior windows. The walls are like a fun house - none are 90 degrees, so the desk doesn't really fit in there. There's also this fan in the ceiling that I worry is the exhaust from the intake over the men's toilettes next door. But it's quiet and no one bothers me!

At work, I've also started a community collaboration site for developers in my region to contribute code, do book reviews, and discuss lessons learned. So far, I'm about the only one contributing anything though. My leadership style subscribes to the idiom of "Lead by example," but so far, that's not working. What have you done to motivate peers?

There's one guy who I asked to participate in the book club, and he agreed. Then later he said he wouldn't do it because he had two young children. I asked him what I could do to make it easier for him, and he told me to come read them to sleep at night :) So, I bought him a copy of Cat in the Hat on VHS and a copy of the book out of my own pocket and he was appreciative and said he'd participate. But, he still hasn't contributed.

That's the news from Lake Washington. Good night, and good luck.

Learning Design Patterns – Iterator Pattern

This week I'll be stepping through the Iterator Pattern in my series on design patterns plucked fromthis book and from examples on the Internet.

What is it?
The Iterator Pattern encapsulates the functionality for stepping through a collection of items. The iterator object implements the stepping; the aggregate itself does not step through its own collection.

The pattern generally has a few of methods like first(), hasNext(), Next(), isDone() in some combination. In some programming languages it is possible to step through an iterator using a For Each item in Aggregate....<code>....Next type of construct.

Where is it used?
Anywhere there is a group of items. An array list is a common example; an iterator would step through the array items until the end of the collection was reached.

But why?
The iterator separates out the functionality of stepping through a group of items into its own class - promoting one-class, one-responsibility design which gives the aggregate only one reason to change itself instead of two. Separating iteration out encapsulates the functionality so that clients can expect predictable results when reviewing a collection, which promotes polymorphism.

OK, and how is it implemented?

//Java

//create a concrete aggregate class
public class BookList {
	//create a collection of books
	Hashtable bookItems = new Hashtable();

	public BookList() {
		//constructor code
	}

	public void addBook(Book book) {
		//add the book to the collection
		bookItems.put(book.getISBN(), book);
	}

	//Return an iterator to step through book list.
	//The booklist uses a hashtable to contain its collection,
	//another object (say customerList) may use an arraylist
	//for its collection.  By creating an generic iterator for both
	//concrete aggregate objects, it promotes polymorphism.
	public Iterator createIterator() {
		//iterate through just the book items
		return bookItmes.values().iterator();
	}
}


//Our booklist uses a hastable, which provides its own iterator method.  
//a more generic collection may need its own iterator created, something
//like this:
public class BookShelfIterator implements Iterator {
	BookShelf[] list;
	int position = 0;

	public BookShelfIterator(BookShelf[] list) {
		this.list = list;
	}

	public Object next() {
		//implementation here
	}

	public boolean hasNext() {
		//implementation here
	}
}


//the iterator interface for BookShelfIterator:
public interface Iterator {
	boolean hasNext();
	Object newt();
}