Richard Bucker

REVIEW - Build Awesome Command-Line Applications in Ruby

Posted at — Apr 15, 2012

Having a great respect for the fellows at PragProg and having many of their titles it’s easy to find something to criticize. When I purchased the book “Build Awesome Command-Line Applications in Ruby” I had great expectations. I had skimmed the table of contents and I thought that this would be a great way to supplement my Ruby education since I was already heading in a Rails direction.I maintain that even though I have WebApps development in _________ (fill in your favorite language) I have always needed command line scripts to manage the DB, config, or some other function that I’d need to repeat but did not want to do manually; specially when there were multiple steps.So I had high hopes. Now that I look back at the TOC I think it might have been better as a guide or best practice instead of 195 tomb. (what do you call a paperweight that is made out of paper; even if it’s e-paper)?The TOC: Have a Clear and Concise Purpose - that goes without saying. It’s “the UNIX way”. Be Easy to Use - same. But take a look at TornadoWeb. Their command-line tools are pretty cool. The make it trivial to manage the command line. You could even go so far as to make the process dynamic or data driven if there was a use for it. Be Helpful - plenty of tools for python and perl developers here. I particularly like the perldoc tools. It makes man pages very easy to write. Play Well with Others - this is a nice checklist that makes good sense. Specially when writing those quick and destructive apps where if the task does not complete the data will be left in an unknown state… therefore we need to capture certain signals like CTRL+C. Delight Casual Users - this one is kinda insulting that it took more than a page to recommend “good default values”. Make Configuration Easy - This is the same as #5. Distribute Painlessly - Just about every language publisher has some sort of novel way to publish new modules. GO, Perl, Python, Ruby, Lua… some are better than others. Test, Test, Test… -  That goes without saying. TDD (Test Driven Development) is at the heart of some new cough Agile techniques. There are some tools like Cucumber that are designed to be more English like with it’s Grammar. Since I’ve only skimmed that subject I’m not sure whether it’s better than Python’s nose or CPAN’s test. (Ruby also has RSpec). Be Easy to Maintain - This is a subjective comment. Sometimes one-file is a better idea. They seem to have missed comments completely. And the discussion between comments and well written code is never discussed. Add Color, Formatting and Interactivity - This chapter had so much potential. I like that they wanted to discuss color and formatting. Their use of table formatting made be very happy. But they missed ncurses and curses (from the same family). Assuming that at least one person was going to be a unix or OSX programmer… Not to mention that every Rails screencast I’ve ever watched was done on a Mac.At this point I have not learned much other than my 20 bucks was not well spent. And frankly I think that Dave and Andy should withdraw this book. It does not live up to any potential that I had in mind when I bought it.PS: I botched my article title so I had to go back to pragprog for the title. That’s when I realized it “Build Awesome Command-Line Applications in Ruby: Control Your Computer, Simplify Your Life” was really an extreme exaggeration and there was no way that they were going to live up to it. (I don’t feel cheated because I got to write this critique but it was not money well spent.)