Sunday, April 06, 2008

I Believeth, I Believeth, Don't Die Tinkerbell...

Battlestar Galactica 4-1 "He That Believeth In Me"

I'm relieved, frankly. Not surprised, exactly. I liked Season 3 more than a lot of people seemed to, and I'm optimistic that Ron Moore and his crew understand what the problems were and how to avoid them. Still, it's good to see the show starting out it's final season with a strong episode.

This was basically the episode I was hoping for, with two extra plusses, and one kind-of minus.

Spoilers Ahead, I suppose

I really liked where they took the Final Four Cylon story. After three seasons of asking "What does it mean to be a human", they inverted it -- what does it mean to be a Cylon? What does it mean if your spouse, or best friend, or your whatever the heck Lee and Kara are, turns out to be Cylon? Does it matter? Should it? Great questions, and I can't think of a previous SF work that's attacked the basic what-is-human question from this angle.

The specific pieces of the storyline were well-done. Anders' nerves about going into combat, Tigh's general Tigh-ness. The bit where the Cylon Raider scans Anders and get's the blip response was very cool.

But what really made the episode was the way that Starbuck's return integrated with the Final Four. Of course everybody would think Starbuck is a Cylon trick -- half the audience thinks so too. In the show, this allowed the characters to all talk about what it would mean to be a Cylon over the uncomfortable glances of the Fantastic Four. A really clever piece of writing structure.

The negative is the Baltar storyline. Not only does this put Baltar back in another situation where he's separated from the rest of the crew and in a place with creepy customs, but the whole thing is way too much like the telepath underground from the final season of Babylon 5 for comfort. (Personally, I wouldn't be surprised if the attack on Baltar was staged to make him stay with the cultists. But then, I'm cynical.)

  • Some great acting work all around -- watch how much of the episode is carried by the reactions of the Fab Four. And James Callis' facial expressions were the most bearable part of the Baltar story.

  • I thought that the tension between Lee and Adama was maybe resolved too quickly given how intense their argument was. I'm assuming the writers have bigger fish to fry.

  • I watched this one on hulu.com, since I don't get Sci-Fi on my cable system, and they pulled out of iTunes. Overall, it wasn't bad. The video quality was worse than the iTunes files but still watchable. The biggest problem was the interspersed commercials -- not that I'm inherently against the commercials, just that they aren't synched right. Two of the breaks came about a second after the actual episode act break and one of them came right in the middle of Baltar being attacked. Annoying.

Friday, April 04, 2008

BDD: Book Driven Development

recipes.jpg(This one is also on the Pathfinder blog, but since it fits in here, I wanted the full text here...)

Jay Fields, who has been posting a very nice sequence of nuts-and-bolts Ruby and Rails guidelines, pauses to talk about creating examples. It's a topic I've wanted to write about here for a while, and this is as good a lead-in as any. Plus, I'm generally interested in how principles of software development apply or don't apply in odd cases, and software being developed specifically for example purposes certainly qualifies as an odd case.

For Professional Ruby On Rails, I knew that I wanted to run a single example application through the book. I had some grand visions of it being a "real" application or at least a real example of coding best practices. For best practices, I think it's pretty good on a method-by-method bases, but has some weaknesses as an entire app, for reasons that I think will become clear.

The first question was exactly what I wanted the sample application to do. On some level, this is a superficial question -- who really cares what the fake app in the book does? At the same time, certain application structures would make it easier or more plausible to discuss certain features. And I had a list of features I wanted to cover -- legacy databases, users and roles, navigation, and graphics. Ideally, the sample app would have some kind of consistency that would make it reasonable to have these features.

In addition, I didn't want it to be a thinly-veiled version of a site that everybody would recognize, and I wanted it to be something that I could type every day for six months without going crazy.

One of my first ideas was to resurrect an old Web 1.0 joke for my killer e-commerce plan: a web-based store for selling and delivering gasoline. But I decided that the gag was a lot less funny with gas in the $3 per gallon range, and I also decided that I didn't want the fake site to be primarily an e-commerce site.

Brainstorming ensued. I almost did a social networking site for pets, but I decided that was too silly, subsequently discovering that there are already a zillion pet social networking sites...

Eventually, I settled on Soups OnLine, a soup recipe-sharing site. It had the advantages of:

  1. Having a data model that could plausibly handle RESTful nested resources (recipe and ingredients)

  2. Having an actual user model.

  3. Being a plausible site, while still being silly enough to keep anybody from taking the whole thing too seriously.

The first problem came up almost immediately -- site design. I felt that a site that was just dull HTML would not be credible or interesting, but at the same time, I didn't really have the time or resources to create a full site design from scratch, nor did I want the book to become about site design. My solution, which I'm not prepared to defend to the death, was to integrate a template from freewebtemplates.com. This kind of sideswipes the whole issue, providing reasonably good-looking site without having to get into the weeds debating CSS minutia.

Over time, the example mutated away from a normal application development process in a few interesting ways.

The nature of the book-writing itself was a strong anti-agile push, in much the same way that any large body of documentation is. Changes in code structure affect the tests, which is fine, but also affect some amount of text in the previous 300 pages, which there's no easy way to find. (As you can read in this post, the issue affected not just me, but also the editors on the book). At least once, a late change in Rails invalidated a helper method I used in an early chapter. Not a big deal, except I also used that helper method to demonstrate a test structure later in the book -- I wound up keeping a shell of the original method redirecting to the new Rails method.

Also, some features that I had hoped to get in, didn't quite get there -- because I ran out of time or because they didn't with the chapter structure. (If you read the book, you'll see some early structures that imply that the app will eventually convert between English and Metric, which I never quite got to.) Again, this is the kind of thing that happens in all the time in real projects, but is hard to smoothly redirect when there's all that pre-existing text describing the earlier plans.

Sometimes, the sample app has more features than a real app would, rather than less. Since the book tries to cover multiple plugins or ways to accomplish things, Soups OnLine wound up with far more plugin load than a normal app would -- a regular app wouldn't normally have RSpec and Shoulda and Dust, or RMagick and MiniMagick and ImageScience. Inevitably some conflicts happened between multiple plugins trying to cover the same space, making the final code somewhat wilder than I'd really like. (If you've read the book and want to experiment with the outstanding code, it's probably easiest to work with around chapter 9, before Globalize and the image plugins are added...)

Ultimately, of course, as Fields concludes, it's the author's fault if the example doesn't help the user understand the issues at hand. It's my job to understand the constraints of the form and still try to present as realistic an application as possible while explaining how to to build similar applications.

Tuesday, April 01, 2008

Book Recommendations

I've been meaning to do this sooner, but, wow time flies...

Here are some brief comments about books I've read so far this year and would recommend. I think I'll pass on doing negative reviews here at the moment, unless I can make a larger point somehow.

Captain's Fury, by Jim Butcher

Book four in the Codex Alera series continues pretty much everything that's enjoyable about the series. I particularly like the way Butcher continues to move the story along, as well as how he's resisted the easy way to manage the hero and his lack of fury powers.

The Dragons of Babel, by Michael Swanwick

So about fourteen years ago, Swanwick published The Iron Dragon's Daughter, which was, I think, the first prominent example of a crossover between common fantasy icons and dystopian SF icons. If I remember correctly (always a dubious assumption) a lot of people (meaning me) weren't quite sure what to make of the weirdness. I don't think The Iron Dragon's Daughter is a great novel -- it's very episodic, for one thing -- but it is one of the most inventive and memorable novels you'll ever read.

The Dragons of Babel is marketed as a sequel, although I don't think there's any particular crossover beyond tone and some place or character names -- I don't remember Iron Dragon's Daughter having much plot to continue. It does however, continue the same tone as the original, a world that freely mixes fantasy elements with ideas from "the real world", and with a certain, say, lack of reverence toward High Fantasy.

The title Babel is a city, somewhat loosely based on the biblical and Mesopotamian myth, but populated with all kinds of fey, including ghouls and their corrupt city alderman leader, underground horse keepers, a mysterious throne with an absent king, guns, spells, and con men.

It's still fairly episodic, but I think it holds together as a coherent story better than Iron Dragon's Daughter, and it'll certainly mess with your head. In a good way. Mostly.

God Save The Fan by Will Leach

Leach is the editor and proprietor of Deadspin, which is the pre-eminent sports blog if you are a certain kind of fan -- irreverent? immature? Dunno, but it's one of my favorite sports web sites, serving up sports news and analysis while not stinting on pictures of drunken, partying quarterbacks.

The book is essentially Leach's attempt to make the Deadspin worldview explicit. (Although only one piece in the book is taken directly from Deadspin, regular readers will recognize many of the running jokes...) It's a collection of essays with the common goal of recovering sports from the people who take them too seriously. It's kind of hit and miss, but the best pieces are worth your time, and Leach has probably my favorite take on the steroid issue -- which is we're sick of it, please stop moralizing over it.

The Invention of Hugo Cabret, by Brian Selznick

I think this book is the longest work to ever win the Caldecott Medal for children's book illustration. Most Caldecott winners are your basic short kids picture books. Selznick has written a 500 page novel, about half of which is told through words, and about half through wordless pictures.

The story takes place in Paris in the 1930s. Hugo Cabret lives alone in the Paris Metro station, winding the clocks through a series of out of sight tunnels, and repairing a mechanical automaton rescued from a fire by his late father. Eventually, he comes to the attention of an elderly man who runs a mechanical toy shop in the station. The early history of French silent film is involved, along with an image you've surely seen of a rocket ship hitting the man in the moon square in the eye.

The pictures carry a lot of the story load, and they are moody and atmospheric without losing clarity -- it's never hard to follow the story, and you can't easily do things like slow zooms in pure text. There's a nice meta twist at the end, too. Definitely track down this unique and interesting book.

Lincoln and Douglas by Allen C. Guelzo

Somehow The Daily Show and The Colbert Report became my main sources for new non-fiction book recommendations (Stewart has almost completely stopped having actors as guests in favor of non-fiction authors, Colbert never really had many actor guests to begin with...). Guelzo was on The Daily Show, since books on the buildup to the Civil War really pack in the ratings.

The book is interesting, if not as dazzling in prose style as your super top-notch non-fiction books. It certainly focused on some areas that were relatively new to me. Notably, how the feud between Douglas and James Buchanan affected the race, and how East Coast Republican leaders didn't really support Lincoln out of the probably-vain hope that Douglas would reveal himself as a Republican. Guelzo also covers the various political pressures that affected Lincoln's message as well.

The interesting "what-if" scenario here is what would have happened had Douglas not chosen to debate Lincoln -- he had not much to gain from the debates as the prohibitive favorite. Absent the fame from the debates, there's no way Lincoln is the nominee in 1860. But absent the questions he had to answer in the debates, Douglas is much more likely to have cobbled together the Southern states into a coalition that could have elected him (adding a Southern VP, possibly). Where it goes from there is anybody's guess, especially since Douglas would have died months after taking office (although absent the debates, his health might have been better...)

The Mirador, by Sarah Monette

Book three in a series. One of those cases where the author settles character situations at the end of a book, then in order to write the next book in the series, she has to roll back some of the plot and character gains. That's what this book feels like -- the three main characters, acting mostly in harmony at the end of the second book, spend a lot of this book rehashing the arguments and conflicts from the last book.

That said, there's a lot in the book that does work. Monette does a nice piece of writers indirection, hiding the identity of an important character for a while. The characters and plot all move forward, maybe reaching new understandings in the end. Still looking forward to the next book.

New Amsterdam, by Elizabeth Bear

I read Bear's first novel (Hammered), thought it was okay, but never went back to the series. Since then, she's jumped her way around several genres, and the description of this one was compelling enough for me to check back in. It's alternate history, the difference point not quite spelled out, but America is still a British colony, and New Amsterdam remained a Dutch colony until the early 19th century when it was given to the British.

Our two lead characters are Sebastian de Ulloa, a centuries old vampire (the book favors "wampyr") and Abigail Irene Garret, a forensic sorcerer. Together they fight crime. Really.

The book is a series of connected short stories that eventually connect enough to roughly form a novel (some, if not all, of the stories were published separately). The early stories are mostly standalone, and have a certain Agatha Christie meets Bram Stoker kind of feel. Later stories build on each other, as both Sebastian and the British Crown find their positions in America become increasingly untenable.

I liked this book for it's atmosphere and for the main characters, I think it would have been even better fully structured as a novel -- I think it might have drawn out the supporting characters a bit more. The mystery elements give the story some texture, but the magical background behind the crimes is a little opaque to the reader... not a problem exactly, just a comment on what kind of mystery story this is. Plus, I'm an easy mark for any novel with the British Crown still ruling America. (If I met Richard Dreyfuss, I'd probably ask him what it was like to work with Harry Turtledove.) I'm hoping for a continuation to this story, and I'll check out some of Bear's other fantasy work in the meantime.

T is for Tresspass by Sue Grafton

Grafton is one of the few really best-selling authors that I read, and one of the things I like about her recent work is that she's been able to avoid having Kinsey Milhone solve the same case over and over again. In this case, the point of view goes back and forth between Kinsey and a sociopathic predator posing as a home nurse, the better to steal large sums of money from the neighborhood elderly recluse.

The mouse in this game sees Kinsey coming from a mile away, and manages to manipulate her into losing her temper and seeming unhinged to any authority figure Kinsey is inclined to consult. That's frustrating for Kinsey, but interesting for me -- I generally like watching the hero have their strengths used against them judo-style. The book is tense, although the actual ending struck me as a bit too easy.

It's also kind of interesting to watch Kinsey's stories, which take place a few months after each other and are therefore still in 1988, increasingly become period pieces. I think Grafton is increasingly referencing current events to make it easy for the reader to remember the time frame, and not wonder why Kinsey doesn't use a cell phone or the internet.

Coming soon: Matthew Hughes Magestrum series. New Lois McMaster Bujold. The third book in John Varley's Mars series. Jim Butcher's latest Dresden novel...

Friday, March 21, 2008

My Favorite Monkeys

New post at Pathfinder on monkey patching.

Monday, March 17, 2008

Beep Repaired

I don't know what this says about me, or anybody else for that matter...

I've been a huge Tom Lehrer fan ever since my 8th Grade Social Studies teacher decided to warp all our minds by playing "That Was the Year That Was" during a reading period. (It was 1985, so it's not like the recording was current or anything...) I was pretty instantly hooked, and a few years later when his albums were re-released on CD, bought them instantly, and have more-or-less memorized them.

I also became aware of the existence of the musical Tom Foolery, a review of Lehrer's songs that had apparently even recorded a cast album somewhere along the line, but not anywhere that coincided with a record shop I ever saw. I had always kind of wondered about it, and about a week ago, sort of randomly popped it into an iTunes search, and was really, really surprised to see the album actually show up. In DRM free iTunes plus, no less.

The album also has 24 reviews of which break down into: a) this isn't Tom Lehrer, b) Tom sings all these songs better, c) when is iTunes going to get real Tom Lehrer, and d) they don't even use the real lyrics, and e) who are these whiney English people pretending to be Tom Lehrer. People seem to be genuinely angered that anybody else would even bother to record Lehrer's songs (in addition to being somewhat confused as to what this recording actually is -- for example, the "wrong" lyrics were actually written by Lehrer for the production...). Oy.

Well, I wasn't about to let 20 some-odd random strangers dissuade me from an album I've been looking for for almost twenty years. Although I did pause for a microsecond or two.

Preparing for disappointment, I downloaded the album.

And you know what, it isn't Tom Lehrer. It's also actually pretty good. All in all, I like Lehrer's syncopated, ironic style better on most of the songs, but it's not true that the English cast sings the songs with no bite. It is true that they have better-trained voices than he does, and that works in favor of some songs and against others. Still, it's nice to hear some songs in character -- "Poisoning Pigeons in the Park" is cute as a duet, and I liked most of the adult lyric additions to "Silent E".

The really dark ballads don't all do as well, but the uptempo songs are great. There are a couple of cases where the accents invalidate a rhyme or two, but overall, I had no problem with these people singing Lehrer's songs. (It was a little weird to hear them using so much of his monologues to introduce the songs...) So, I guess it's Random English Singers 1, Random Internet Commenters 0, at least as I keep score.

One last geeky thing... like a lot of live recordings made for vinyl, the tracks begin with the actual start of the song and end with the introduction to the next song. This is fine in a record album, where you would use the track breaks to find the beginning of the musics, but it's really irritating in an iPod, mix-and-match world, since any song that comes up ends with the introduction to then next song that isn't going to be played. This really bothered me for this album, since the introductions really do need to be tied to their actual songs.

But these were DRM-free songs, and I can be an own-your-media type on occasions, so I took them all into GarageBand and re-split the tracks so that the introductions are on the same tracks as the actual song. Took under an hour, and only that long because I didn't know that GarageBand had a global preference for export quality that was set too low. Much better that way.

Speaking of iPod, mix-and-match worlds, someday I really must introduce my iTunes random playlist generator...

Monday, March 10, 2008

The Average Programming Book

One weird aspect of being a published writer is that you get very little information about sales. You see your own numbers (several months after the fact), but there's no larger context, and no sense of what a reasonable expectation of sales might be.

Which is why I love it when O'Reilly Radar puts up one of their periodic looks at the computer book market. I haven't pored over stat line like this since I collected baseball cards when I was ten.

I'm going to assume you've gone and followed the link, and post some further thoughts, rather than rehash the points already made.

So, the average programming book sold about 1100 copies in 2007. Given the probable distribution, I'd imagine the median is significantly lower, probably under 1000, although I have no way of knowing for sure. Obviously that conflates a lot of things, new books/old books, general books/specific books, but it seems to be a reasonable baseline.

It's not clear what that means for total sales, since I don't have a good sense of how long a particular book is viable. Jython Essentials, which is nobody's idea of a best-seller, is still selling the odd few copies a month, and 2007 was it's sixth calendar year of sales, (it probably just slipped below the 1100/year figure based on 2007).

You might expect that the per-unit total is larger for the larger language markets, but that doesn't seem to be the case. In fact, three of the top ten languages have much lower per-unit figures (Java, C, Visual Basic). Presumably, this is because the larger markets encourage specialized books in a way that, say, the Groovy market doesn't. Yet.

It does seem to be the case that markets whose share is growing have high per-unit sales and vice-versa. This makes sense, especially when you factor in the lag time that publishers operate under. Growth markets result in high sales for the relatively few titles available, then the average gets driven down later on as more players enter the market. (The most interesting counter example is PHP, which maintained a pretty good per-unit sales rate despite an overall drop.)

Quick thoughts:

  • Ruby has the highest per-unit sales rate in 2006 and 2007 (books are placed based on what language the examples are in, so this includes all Rails books). It's still a very strong growth market, though. (But I wonder what the average is if you subtract the two Dave Thomas books...)

  • Python passed Perl, for presumably the first time since ever. That's really weird sounding. If you'd told me when I bought the Pickaxe book in 2001 that six years later Python would outsell Perl, and Ruby would outsell both of them combined... It's weird.

  • If the trendlines come even close to continuing, C# will be the biggest language market in 2008. That seems strange too... but I guess the Microsoft Bubble of Tools is pretty big.

Saturday, March 08, 2008

iPhone SDK

I'm trying to figure out exactly why I'm so psyched by the Apple iPhone SDK announcement. The basic announcement wasn't a surprise, and I don't even own an iPhone. I did, however, dig out my Cocoa programming book and start studying.

Further thoughts:

  • The tools themselves seemed somewhat slicker than what was expected -- a lot of Mac developers were pleasantly surprised that Interface Builder was included (although apparently it's not in the first beta). There was a lot of speculation that the SDK release was delayed over security issues, but it also looks like polishing the tools took some time.

  • The demos were exceptionally well done, a very nice range of choices, and the continual push of how easy it was to make them. The quality of the demo is clearly one of the reasons that I'm excited.

  • As an aside.. say your boss came up to you and said you're going to fly to Cupertino for two weeks to build something in the super-secret iPhone SDK, which you will get to present in a full-on Steve Jobs media event. How many nanoseconds would you need to wait before accepting?

  • Let's see, the iPhone 2.0 comes out the end of June. So... by August 1, it should be the top mobile gaming platform going, right? Those were some seriously cool looking games...

  • The terms were more open than I expected. It's particularly nice that Apple is allowing the developers to set the price. It's particularly nice that they specifically included "free" as a price. They seemed to emphasize that Apple was going to try and get as many apps in front of developers as possible -- I'd take the inclusion of AIM as a demo as a sign that even things that AT&T might not be thrilled with will be allowed.

  • The general sense of the existing indy Mac community is that the 70/30 split is reasonable given what Apple is offering. It'll be interesting to see how the price points play out. (As pointed out by Jens Alfke, the App store model enables an entirely new class of micropayment software)

  • Still a number of questions: how will developers manage limited betas? Will developers be allowed to have the download be free, but have a separate license authorization? What about free but add supported (like Twitteriffic)?

Early line, here's a short list of people or apps off the top of my head I expect greatness from:

  • MobileTwitteriffic, already essentially announced. The trick here will be improving on the web UI.

  • Red Sweater, apparently Daniel is considering porting Black Ink, and maybe MarsEdit.

  • Ambrosia Software. For a really great game -- Sketch Fighter would work...

  • The Desktop Tower Defense guy. The UI would be tricky, though...

  • Somebody to do the killer To-Do list or GTD app. Omni?

  • A really cool doodle/draw program.

I think this is going to be a very fun ride...

Wednesday, March 05, 2008

Cuts Like A Knife

SF Movie Review: Battlestar Galactica: Razor

(Continuing the enlargement of things I write about on this site, and I think this will be the last post containing a disclaimer about topics...)

I'm not sure what this says about me or my relationship to this show, but the following is all true:

  • I bought this DVD the day it came out (I don't get Sci-Fi at the moment...)
  • I then let it sit for three entire months while waiting for the right time to watch it in one sitting.
  • I finally decided that I'd watch it in pieces, so I started it at about 10:45 at night.
  • Got so caught up in it that I watched it all the way through, then read Jacob's incredible TWoP recap before sleep.

The movie is made up of several nested flashback stories (don't even try to use this movie as an introduction to the Galactica universe...), mostly unified by the person of Kendra Shaw, whose official title might be "Highest Ranking Pegasus Officer We Never Saw Before". Shaw arrives on Pegasus about fifteen minutes before the original Cylon attack, and has a front row seat for the craziness hinted at during the first time through the Pegasus story. Later, she becomes Lee Adama's XO, and leads a mission to a mysterious Cylon outpost dating from the first Cylon war. Add in a couple of flashbacks as to what the elder Adama and Cain were doing on the last day of the first war, and you've about got it.

The basic issue with a this movie, which is designed specifically not to be necessary to understand the main story, is for the show to justify it's existence as more than a way to move DVD's at Best Buy. I think it does, not so much at a plot level, but in the way that it deepens the Pegasus story, already one of the show's best storylines.

The Galactica story has always revolved around about three questions, how do you deal with overwhelming loss, how are you supposed to act in the name of survival, and how are you supposed to treat a mortal enemy. Razor encompasses all three. The earlier Pegasus arc was, in some ways, a little too easy -- Cain fits very neatly into the model of Crazy Commanding Officer Who Goes Too Far. By taking us through the all the steps from beginning to end, Razor makes it harder to dismiss Cain as a lunatic -- it explains her actions without excusing them. Kendra Shaw, who pretty much wears a sign at the beginning saying "I'm Not Crazy" gets drawn straight into the heart of it all. As a result, Razor ends up being a very dark story even by Galactica standards.

  • My list of bedrock Galactica questions doesn't include the question of whether the Cylons are human. While that's frequently a topic of discussion on the show, it's clear to me that the creators of the show know the answer to that question... they use the human/robot question as a way of getting at the deeper issues.

  • I liked the subtle ways in which the movie placed itself in the Galactica timeline, the exact number of survivors in the credits places it, plus there were a couple of background references to major events in the last half of season 2.

  • Have they ever mentioned on the show exactly what caused the first Cylon war to end so abruptly? That's a possible plot issue to be dealt with in season 4. Or, I suppose, the on-again, off-again Caprica miniseries.

  • Moore's commentary is very interesting -- as with many other Galactica episodes, this one changed dramatically in editing. Essentially, they turned the entire movie inside out, and what was originally the framing sequence became the ending mission, and the original meat of the movie became the framing sequence.

Monday, March 03, 2008

Using Active Record For Migrations

New post on the pathfinder blog:

Using ActiveRecord to Migrate Legacy Data

Enjoy!

Tuesday, February 26, 2008

Buy My Book! (Please?)

223888 cover_df.pdf (3 pages).jpgThis week, my book Professional Ruby on Rails will be officially released. You can see sample chapters here, and you can buy the book at Amazon (affiliate link).

This book is designed to meet the needs of an intermediate to advanced Ruby on Rails user. The first wave of Rails books could not assume that the user had any pre-existing knowledge of Rails. As a result, they spent a lot of time covering the basics. The target reader for this book is somebody who has already read one of the basic books and now has to apply this knowledge to building a complete web site all the way from conception to deployment.

Written over the summer and fall, all the sample code in the book uses Rails 2.x, specifically including RESTful structures, respond_to, new migrations, cookie-based sessions, and other new features.

The book covers the kinds of tasks that nearly every site needs to handle -- user models, database performance, time zones and internationalization, creating common JavaScript navigation elements, REST web services, and graphics. Where there are commonly used plugins to support those features, the book covers those as well.

In addition to the application itself, there are other parts of the Rails life cycle. The book covers many of these issues including how to manage a Subversion repository, how to use Rake to simplify common tasks, Capistrano for deployment, RailsBench and profiling tools, generators, and plugins.

I wanted to include comprehensive and integrated coverage of automated testing. In addition to a chapter dedicated to advanced testing tools, nearly all of the sample code in the book is presented with its associated tests first. I believe this promotes the use of test-driven development and gives examples of how to test complex Rails code.

I had a lot of fun writing this book. If you are a Rails programmer, this book will improve your programs, and hopefully save you time and effort. If you're interested, please check out the samples, and buy the book. Thanks.

Technorati Tags:,

Sunday, February 24, 2008

10 Print "Favorite Books, 2007"

For my first real non-techy post on this site (I'm a little nervous about that....), here's one of my favorite things to write about -- a list of favorite books that I read in 2007.

All the books on this list were published recently enough to qualify as "new". I also group books in the same series more or less on whim. My tastes... well, they tend toward Fantasy and SF, beyond that, you'll just have to infer from the list.

First up, the honorable mention, all these books are definitely recommended. All links are to Amazon affiliate pages.

Honorable Mention

  • Cursor's Fury, Jim Butcher. This is book three of the Codex Alera series (book four came out in January '08). The series is notable for likable characters, tight plotting, and a very interesting fantasy world based on the Roman empire. This particular book has a well handled reveal of secrets, including clues that had been staring the reader in the face since page one of the first book.

  • Extras, Scott Westerfeld. Book four of Westerfeld's exceptional YA Uglies series. Maybe down a slight notch from the first three, but still an interesting and fun book. Westerfeld has a knack for aligning his SF worlds with the concerns of his YA readers, but the book is also worth reading for adults.

  • First Among Sequels, Jasper Fforde. This one is book five in a series, in this case Fforde's funny and off-the-wall Thursday Next books. It's about fifteen years later, Thursday is still fighting bad guys in and out of books, in this case, she's assisted by two different fictional versions of herself. This series is kind of like what Douglas Adams might have come up with if he had decided to parody the English Lit canon. Only with more croquet, dodoes, vampires, and neanderthals. This book also has a great (read: clever and silly) time travel paradox.

  • Ha'penny, Jo Walton. Much less funny, this is a sequel to Farthing, Walton's alternate history world where the British made peace with Nazi Germany in 1940, ceding the rest of the continent to German control. Like the first book, this is chilling in it's matter-of-factness as Britain increasingly becomes a police state. (There aren't many more disturbing phrases in an alternate history than "President Lindburgh"...).

  • Halting State, Charles Stross. The only non-series book in the entire Honorable Mention list. That's really odd. Near fiction SF that takes off from a daring bank robbery inside a World of Warcraft like virtual game. Moving forward from there, the stakes get much higher, since anybody who can crack the encryption used in the game can do... well, pretty much anything. This was the last book to fall off the final nominee list, it's an excellent, mind-warping SF book. Stross is kind of hit-and-miss, this is one of his hits.

  • The Lies of Locke Lamora & Red Seas Under Red Skies, Scott Lynch. Right up until the actual last book I read in 2007, this was my favorite new author of the year. It's a dark series (projected to seven books) about elaborate con games in an urban fantasy environment. The first one reads like a violent cross between The Sting and China Mieville, the second one start that way, but veers off into a long pirate digression. The first book, on it's own, would probably have squeaked in the nominee list, the second one is a little weaker, but still has its moments.

  • Melusine & The Virtu, Sarah Monette. One novel, published in two parts. Another dark fantasy, an extremely well written mood and character piece about two half-brothers, one a wizard gone insane, the other an assassin turned cat burglar. (Boy, that makes it sound kind of goofy -- it's not.) The book oozes atmosphere.

  • Ragamuffin, Tobias Buckell. Sequel to Crystal Rain, this book opens up the universe and has a much more space-opera feel. Includes a fantastic SF set piece that takes place down the axis line of a cylindrical space-station, involving Newton's second law and machine guns.

Also recommended, to one degree or another:

Always by Nicola Griffith, Heart Shaped Box by Joe Hill, Kusheil's Justice by Jaqueline Carey (last book off the above list), Magic's Child by Justine Larbalestier, The Merchant's War by Charles Stross, Precious Dragon by Liz Williams, The Sharing Knife: Legacy by Lois McMaster Bujold, Sixty Days and Counting by Kim Stanley Robinson, Spook Countryby WIlliam Gibson, The Sons of Heaven by Kage Baker, Soon I Will Be Invincible by Austin Grossman, The Sword Edged Blonde by Alex Bledsoe, and White Night by Jim Butcher

The following books are the actual nominees for whatever mythical award I give out -- my favorite books of the year. This was an excellent year, all of these books are highly recommended.

  • Blindsight, Peter Watts. The essential quote about Watts is from James Nicoll, "Whenever I find my will to live becoming too strong, I read Peter Watts." This is a grim book about the limitations of the human mind -- if you think your mind is actually good at stuff, be prepared to have that idea debunked forcefully. This is a first contact book with a very alien race, but it's completely subversive to the normal ideas of a first contact book. And it has SF vampires.

  • Harry Potter and the Deathly Hallows, J.K, Rowling. Odds are that you've already read this if you have even the slightest interest, either way you're probably not interested in what I have to say about this one. I just wanted to point out that, as a longtime Potter fan and Rowling supporter, I was a little worried that she wouldn't stick the landing. She did -- the book is a very satisfying end to the story.

  • The Last Colony, John Scalzi. Book three of the Old Man's War series, paying off on a series of hints in the earlier books that the surrounding universe is much more complex then originally let on. This book has more of an intrigue/spy feel than the earlier two, which were more military. Scalzi is trying very hard to write SF novels that are accessible to people who don't normally read SF. This does not mean the books are dumbed-down or uninteresting, just that you're actually going to be able to recommend them to more people who will enjoy them.

  • The Name of the Wind, Patrick Rothfuss. This was my favorite new novelist of the year. The funny thing is that I could come up with a list of plot elements that would make this sound like the most derivative thing ever -- it's got a magical university, the kid from nowhere who's the most talented wizard anybody's ever seen, dark forces afoot, the older hero being dragged into the game one more time, takes place in an inn. All that said, the execution of the book is outstanding. The characters are far more interesting then the plain list would suggest, and the sentence by sentence writing is very good.

  • The Queen of Candesce Karl Schroeder. Book Two of Schroeder's Virga series, which takes place on maybe the best SF big object since Ringworld -- a giant, hollow planet, filled inside with atmosphere, and dozens upon dozens of smaller worldlets, the size of small towns and smaller, that spin to create their own gravity. It's a space opera if space had air. This book takes place on a very small, but strange, part of the larger world (the first book was basically an end-to-end tour of the place). The world building is amazingly good, the worldlet that the story takes place on is covered with countries the size of mansions that spend all their time in deep intrigue over centuries-old grudges.

  • Un Lun Dun China Mieville. It seems like this one kind of slipped past a lot of people, maybe they thought it was just another adult writer trying YA because it's a big market. In fact, it's a funny and clever subversive take on Narnia-style other worlds, and it has enough wordplay to qualify it as The Phantom Tollbooth for the 21st century. This is the kind of book where The Chosen One is out of action on page 35, where a character is told that there is a long list of Trials That Must Be Done and says, in effect "I don't have that kind of time, just tell me where the last one is..." You'll never think about fantasy quests in the same way again.

  • The Yiddish Policeman's Union, Michael Chabon. Alternate history novel on the premise that the US saved 4 million European Jews in World War II and housed them in a protected reserve in Sitka, Alaska. Where they settled in and created a unique, Yiddish-based culture. Only now its 2007, and the lease is running out. On top of all that, it's a murder mystery. I was ready to love this book on premise alone, and the book more than lives up to the premise. As an Ashkenazi Jew, Sitka, Alaska is my lost culture, and Chabon makes it seem absolutely real -- I want to see this place as much as I've ever wanted to visit a fictional book. This just became the first novel ever to be nominated for best novel for both the Mystery Writers of America's Edgar Award, and the SF Writers of America's Nebula award. Hands down, my favorite book of the year. Update: My source for the Edgar/Nebula has made a partial correction, pointing out that "Jeffrey Ford's The Girl in the Glass was nominated for the best novel Nebula and won the best paperback original Edgar in 2006". Still, Best Paperback Original is not, I suppose, Best Novel...

Friday, February 22, 2008

Shipping!?

Amazon is now saying that Professional Ruby On Rails is in stock! I haven't seen my copies yet, and I suspect Amazon purchases will actually go out next week, but it's a real page and everything.

The link to purchase is right here.

I've also added a running list of errata and updates. Check back on that every now and then.

Much more on the book over the next week.

Tuesday, February 19, 2008

Lesser Known Test Processes

New post on the Pathfinder site. I had fun writing this one. It's on some lesser known variants of test-driven development.

http://blogs.pathf.com/agileajax/2008/02/lesser-known-te.html

Monday, February 18, 2008

State of the Blog

This is for any intrepid readers out there who have been following this blog for any length of time. Executive summary: this blog should be getting more content (and more varied content) in the future. Really.

Here's the thing. At the moment, I'm trying to maintain the following:

  • This blog
  • Entries on the Pathfinder Agile Ajax Blog.
  • A private blog where I review books and the like.
  • Two Twitter accounts (one for book updates, one for me)
  • Two del.icio.us tags published to blog sidebars.

All of which got neglected during the big book push.

That's clearly an insane amount of stuff to manage, and it was all suffering for it. On top which, dividing blogs between professional and personal/geeky content was not turning out to be pleasant.

That said, I obviously need to continue posting to the Pathfinder blog, what with them paying me and all. So the plan is this:

  • The private blog will no longer be updated. Since it is actually private, I'm pretty much the only person this affects.
  • Some of the topics that I would have posted there will now come here. I'll try to keep a technical focus (or at least a geekfan focus), but I'll be defining that somewhat more broadly.
  • However, issues that fall under Pathfinder's purview (meaning Ruby and Agile topics) will be posted there. I'll continue to add links to those articles on this blog.
  • The twitter account with book updates will no longer be updated -- my "real" account is now the sidebar on this blog.
  • The old del.iciou.us sidebar is also gone. That content will go into the twitter stream.

The goal is 2-3 Twitter updates a day for links or other short thoughts, and 2-3 larger blog articles a week. Fingers crossed on that last one. Stay tuned.

Monday, February 11, 2008

Hey, Free Book Samples!

As I've mentioned here a few times, I have a book coming out, "Professional Ruby on Rails", available later this month.

If you'd like a sneak peek, Wrox has put some samples online as PDF files. You can also just buy the book.

  • Chapter 1 -- This sets up the sample project used in the book, and talks about the new REST features in Rails.

  • Table of Contents -- Take a look at this to see if your favorite topic is covered.

  • Index -- A more detailed way to see if your favorite topic is covered. Also, maybe you collect indexes...

I'm not sure if the publisher plans on adding more sample content -- if so, I'll update this post.

Monday, January 14, 2008

Pre Macworld stuff

Haven't done an Apple post in a while, just a couple of pregame things I want to get down...

  • I would not have projected that the remaining three music companies would go DRM free on all other services just to spite Apple. It's probably their smartest business move in a while, at least for some definition of smart, but it's not exactly consumer friendly. It does make the Amazon store pretty compelling though.

  • For what it's worth, I find the Amazon store pretty good for downloading entire albums, but kind of a pain for just grabbing a bunch of unrelated tracks (the iTunes feature of being able to complete the set at the discounted album price is an advantage).

  • Tomorrow's keynote: A new iTunes with rental movies seems to be a forgone conclusion. I would probably use this service, assuming the price and terms were convenient, which I'm kind of skeptical about.

  • iPhone SDK is a probable announcement, but I also wouldn't be surprised if it was delayed a bit -- I think the original claim was for February.

  • The other hot rumor is some kind of subnotebook or tablet or whatnot. Any of the proposed specs sound cool and I suspect they'll sell a skillion of them.

More tomorrow, when there's actual news.

Sunday, January 13, 2008

Publication And Other Updates

First off, several pathfinder blog posts to catch up on...

In Rails book news, I'm now proofreading the final PDF versions of the chapters, which is the first time I get to see the pages in the actual final book layout. Which is pretty cool. I'm correcting them for obvious typos, a couple of things that have changed in the last month since I last proofed the chapters, and code layout issues. Should be back to the publisher by Jan. 18th, and they claim to have the book in their warehouse by about Feb. 12th.

You can still buy your copy in advance -- that's an affiliate link, in case you care.

In other books, I just got the wxPython statement for the quarter ending Sep, 2007. About 400 net sales, which was about what I predicted, bring it to a total of around 7200.

I also just got a Jython statement, same quarter, with 160 net sales on it, literally the highest it's been in years (a couple of quarters ago, the net sales were 2). I wonder if the fact that the Jython project has started moving forward again had something to do with that. Anyway, this makes it almost plausible that I might actually get a royalty on that book at some time ever.

Thursday, January 03, 2008

Versions: Another promotion from the comments

Somebody anonymous asks:

As most of the currently available books cover Rails 1.2, are you providing the code in the books also as Rails 1.2?

The sample example in the book is Rails 2.0, which was Edge Rails when I started, and I just validated all the tests against 2.0.2 last week when I turned in the finished code samples. Where there's a significant change between 1.2 and 2.0, I tried to note it in the text, but I would want to claim that I got all of them.

That said, most of the techniques in the book are applicable to 1.2 applications, although some tweaking may be needed.

There are a number of reasons for this, but mostly it boils down to a) differentiating from books that are already on the shelf and b) giving the book as long a life span as possible. Maintaining two separate versions of the sample application was not feasible given the time constraints.

Ruby version, for what it's worth, is 1.8.6 -- I felt that 1.9 was too experimental to be working with during most of the writing.

Sunday, December 30, 2007

Professional Rails Online?

In response to the commenter who asked if there was going to be a beta book.

UPDATE: Clearly I should ask about these things before I post. Jim Minatel from Wrox added the following in comments:

  • There will be a PDF about six weeks after the print book, meaning end of March or thereabouts. There will also be an Amazon Kindle version, eventually.

  • Also after 6 weeks, the book will be available via Wrox's online subscription service: http://wrox.books24x7.com.

  • It won't be on Safari, apparently Wrox books aren't part of the deal there (which I actually was kind of wondering about). Meaning I still haven't placed a book there)

I now return you to my earlier, ill-informed, blather...

Unfortunately, I'm pretty sure the answer is no. Not only doesn't Wrox tend to do that kind of thing, at this point, the book is do to go to press in about two weeks, so the amount of time to get feedback would be sharply limited.

At one point, I was told that sample chapters would be available online before release, but I don't have any information on whether there will be an e-book available. I don't think there will be a direct purchase of a PDF, but it seems as though Wiley just joined the Safari book store, and the book might be available there. I'll try and find out for sure this week.

Tuesday, December 25, 2007

Another Publication Update

Just got the next version of the book chapters for my examination. I'm not 100% sure exactly where these fit in the process. It looks like they've had a good look-see from a copyeditor, largely for style, clarity, and consistency. (Any lingering "we" sentences seem to have been pruned, for example).

They produced a book-specific style guide, which is a listing of canonical forms for things like plugin names, capitalization of commands or tools and the like. It's kind of interesting to see if I can remember where each name or command was used.

Anyway, I'm supposed to have these turned around by Jan 2, so I'm reasonably sure we're still good to go to press in mid-January, and be released in mid-February.

Sunday, December 09, 2007

Things I Learned

Some things I learned about Rails and writing while working on this book:

  • The great benefit of working on a project like this book is that it enabled me to compress about two years worth of research into Ruby and Rails tools into six months. In my case, this was a great opportunity to really dig into some tools to find that I've only been using a fraction of their power and also really get a sense of how elegant and flexible the tools are.

  • Ever since I learned how to type back on an actual typewriter in the mid 80s, I've always followed the old-time typographical convention of two spaces following a period. Which was burned into my fingers despite multiple people telling me that was a silly and counterproductive thing to do in the brave new world of proportional fonts. In fact, on the wx book, I actually did a global search and replace for a period followed by two spaces to get the manuscript to correspond with the publisher's expected conventions. Somehow, I managed to break that habit while writing this book.

  • The hardest stylistic thing for me to get around was avoiding using "we" and "us". In other books and articles, I tend to introduce examples by saying things like "Now we should type the following" or "Let's see how that's implemented". Wiley/Wrox house style, though is to avoid "we" and write the examples as "Now you should type the following" or "I'll show you how that's implemented". Even more preferred is avoiding the pronoun altogether with "Here's how that's implemented" or "type the following". I'm not saying one way is better or worse -- I find the "we" style to be conversational, the Wiley editors clearly disagree. It did take some getting used to, though.

Thursday, November 29, 2007

We're In Production Now...

I turned in the last chapter of Author Review on Monday, and Professional Ruby On Rails is now in production. Target release date is still mid-February, final page count will be in the range of 450.

I was able to keep the test-first nature of the code going through nearly all of it, which I'm really happy with.

The table of contents looks something like this (in theory, still subject to change...)

Chapter 1: Setting up a new Rails project using REST

Chapter 2: Using Subversion on a Rails project

Chapter 3: Users, secure logins, email authorization, etc...

Chapter 4: Rake, writing build tasks, and using CruiseControl.rb

Chapter 5: Navigation elements, including menus, tagging, search, and pagination

Chapter 6: Database topics, including legacy databases, relationships, and security

Chapter 7: Testing tools: RCov, RSpec, ways to test views and helpers, and so on.

Chapter 8: Rails and JavaScript. Using Rails and Ajax plugins for some common tasks. RJS. Testing RJS.

Chapter 9: ActiveResource, generating and reading XML data, including RSS feeds

Chapter 10: Time and Space. Managing time and time zones, using Globalize for internationalization

Chapter 11: RMagick, ImageMagick, MiniMagick, and other graphic tools. Gruff and Sparkline charts.

Chapter 12: Deployment with Capistrano and Mongrel

Chapter 13: Performance benchmarking and optimization

Chapter 14: Using Ruby metaprogramming in your Rails application

Chapter 15: Using and creating plugins. Testing plugins and generators

Chapter 16: ERB replacements and JRuby

Appendix A: Things to download

Appendix B: Other tools inspired by or similar to Rails

Two Pathfinder Blog Posts

Two things on the Pathfinder blog.

  • Agile Publishing, on publishing experiences and agile methods.

  • Live Ruby: Testbed, an attempt to work through a small test and metaprogramming problem live and on the blog.

Enjoy.s

Saturday, November 10, 2007

Heads Up

Wow, I haven't been here for a while. Sorry about that. Here's the deal...

The Rails book initial draft went in about a week ago, more or less on time. (Well, on time for a slightly revised schedule). My understanding of the current schedule is that the author review phase will continue through November. After that, it goes to production, where I get another crack at revising thing that have changed. It goes to press toward the end of January for publication mid-February. If everything continues smoothly.

I'm pretty happy with how it turned out. I think I said almost everything I was hoping to. The main constraint was the tight schedule -- I'm hoping to get some newer features and plugins in during author review.

Oh, and I had another Pathfinder blog entry a few weeks ago. This one is about the CDBaby Rails/PHP thing that was kind of a flap way back then.

That's all for now, I'll try to get back updating the Twitter feed and get back to writing here and on the Pathfinder blog more regularly... Thanks.