Interview: Peter Cooper on Rails, Entrepreneurship, and Developing on Linux

Note: This is the first in a series of interviews I will be doing over the coming months.

Thanks for agreeing to do this interview. Can you tell us a little bit about yourself?

I’m Peter Cooper, a Ruby developer and author from the wild, barren north of England. I’m probably best known in the Ruby community for being the author of Beginning Ruby, published by Apress, as well as the editor of Ruby Inside, the most popular Ruby related weblog.

Your website lists you as a serial entrepreneur. Do you consider yourself a developer who happens to be an entrepreneur, or is it the other way around?

It tends to vary year by year! I’ll go through periods where I’ll happen to be developing more for other people, and others when I focus on my own projects. Having made a successful exit with two businesses in 2007, however, I’ve been leaning towards doing more for myself. I’m likely to drop the “enterpreneur” stick soon though, as it tends to be that I merely follow my nose and the business side of it just falls into place by itself. I’m more of a curious bumbler by nature.

When did you first discover Ruby on Rails?

Rails first came onto my radar in October 2004. It was reasonably primitive then but will still appealing. As such a nascent technology based on a relatively unheard-of language, I was more interested in poaching the ideas for my favorite language of the time, Perl, and began developing my own equivalent. I developed a whole application on my framework, but it was shaky and I decided to give Rails a try, while promising not to get too bothered about learning Ruby itself.

My first Rails application was for a client and I developed a whole photography site for them in perhaps a quarter of the time it would have taken me with Perl. At that point I was hooked, and I also began to venture into the Ruby on Rails IRC channel on irc.freenode.net which, at the time, was great fun.

What was it about Rails that appealed to you?

The biggest selling points were the abstraction and the speed / ease of development. I pride simplicity and economy above all, so developing Web applications in Rails was an eye opener compared to the clumsiness of Perl (I mean, take a look at mod_perl sometime!).

What does your development toolset look like? (editor, browser, etc)

Up till now, my development environment has been under OS X. I’ve stuck with MySQL for a database engine throughout, merely because I know it so well by now. Firefox was my browser of choice on OS X until Leopard, but now I mostly use Safari as it’s come on in leaps and bounds. I use Textmate as my primary editor, although I don’t know how to use any of the macro / snippet features.. it’s really just a text editor with syntax coloring and a file list down the side for me. I like to keep things really simple with little to remember.

At the deployment end of the chain, I use Linux, nearly always Red Hat Enterprise or CentOS.

You recently announced (on Twitter) that you were switching to Linux for development work, while using OS X for everything else. Can you explain what led to that switch?

As with most Ruby and Rails developers, my applications all end up deployed on Linux machines. While open source technologies make it easy to jump between different flavors of UNIX, something about OS X’s “everything for everyone” approach irks me when it comes to doing development work. It’d be like taking my city car on the track or putting a race car on the streets.. you can do it, but it feels better to have separate cars for different situations. While I don’t find Linux particularly useful for graphics work and general day to day use, it feels like a more natural operating system for developing on at the command line level. With the minimalist dwm window manager, you can even get all of the GUI control at keyboard level, meaning you can focus on work rather than moving pretty windows about.

I’m also attracted by the ability to run a single X11 server in my house, then be able to access the same development environment from different machines around the house without needing to sync up. OS X can be used as an X client quite easily, so I can be developing in the same environment anywhere and on any machine. I’m still in the process of setting all of this up though and working out the pros and cons for day to day use.

Do you have any must-have libraries or tools for Ruby?

I don’t tend to have many libraries or tools installed. I’m a big fan of the command line clients for things like MySQL, Subversion, and Git, and I don’t run my IRB with any elaborations. The only gems I tend to install are Rails, Mongrel, Daemons, Hpricot, and RMagick, although installing OS X Leopard has updated this somewhat. Mongrel and Daemons are my “favorite” gems. Mongrel because it makes building super-fast HTTP daemons so easy, and Daemons because it means I can forget all of the dull process involved in daemonizing and controlling applications and services I build.

You recently stated (also on Twitter, I believe) that JRuby was going to be a big growth area in the next few years. Can you explain why you feel that way?

There’s no escaping the fact that big businesses move slowly. Their technology departments can be frighteningly conservative and there’s often only one “approved” way to do things. This is especially true of deployment. Even medium sized companies freak out when you talk about installing Linux and putting your own Ruby / Rails stack on top. They need everything documented, centralized, and consistent. As such, the Java platform has become a real bedrock for servers and application deployment in the enterprise, and JRuby gives us the opportunity to target all of those established enterprise ecosystems by making Rails applications easy to deploy on JBoss, Tomcat, and other Java application servers.

JRuby is definitely the key to getting Ruby and Rails applications deployed inside most major companies whose ecosystems have no time for alternatives just yet. JRuby is definitely the direction you should be heading for these sorts of deployments, and I think this area is going to become significant to most profit-driven Rails developers very soon.

<a href=“http://www.amazon.com/gp/product/1590597664?ie=UTF8&tag=approachingno-20&linkCode=xm2&camp=1789&creativeASIN=1590597664">

You wrote a book on Ruby (which I recently reviewed). What books on Ruby/Rails do you recommend, aside from your own of course :)

My book is for people who either have a reasonable understanding of programming, even if they’re not that good at it, or people who have experience with languages other than Ruby and want to move across. For people with absolutely zero programming experience I’d recommend Chris Pine’s Learn to Program. For already experienced Ruby developers who want to become real hotshots and delve into the deeper mechanics of the language, I’d recommend Hal Fulton’s The Ruby Way. Both of these books cover totally different ground than Beginning Ruby and even complement it, depending on your skill level.

Most programmers have a list of programming languages they want to learn. What is the next programming language you are hoping to learn?

I’m an opportunist developer who tries to use the right tool for the job in order to quickly capitalize on some untapped market or niche. As such, I don’t tend to learn languages for fun, at least not to a deep level. I’ve taken a look at languages like Erlang, Haskell, Io, and even written a little Lisp, but don’t see any immediate reasons to learn these languages to a professional level. It’s certainly worth understanding their paradigms and styles, however, to take something useful back to your more productive environments. Lisp has certainly given me a big appreciation for a lot of oblique programming techniques.

You’ve sold two of your sites this past year. Were those opportunistic sales, or was this something you had planned to do all along?

Opportunistic sales. In the first case, with Code Snippets, I was approached by a friend who was interested in buying the site, but after checking with my network of contacts it turned out Rick Ross of DZone was also interested and the site made a great fit with DZone, the “Digg for developers” as I call it.

Now that you’ve sold these sites, what’s next for you?

Ay, there’s the rub! Most of the projects I’ve had success with have been tools or services that I’ve desperately wanted to use myself, so I’ve had a lot of motivation to see them through. When you don’t have any nagging wants, however, you have to really dig deep to come up with the ideas. I’m currently in a bit of a low gear, with it being the end of the year, as well as having sold two businesses this year, but I hope to get back on the saddle really soon and release some more projects next year. For the meantime, however, I’m keeping Ruby Inside updated as best I can and keeping my nose to the ground!


Coming Soon: Interviews

Beginning tomorrow, I’m going to be publishing a series of interviews. I’m going to start with notable people from the Rails community, but over time I would like to branch out into other areas. The first interview will be with Peter Cooper, whose book Beginning Ruby I reviewed recently.

In the coming weeks I will be publishing interviews with Geoffrey Grosenbach and Robby Russell, with more to follow.

If you have suggestions for other people I should interview, please leave a comment or send me an email (my email address can be found on my about page:http://larrywright.me/about).


Monday Question: What Source Code Management System Do You Use, and Why?

Monday Questions is a recurring series on Approaching Normal. For more questions like this, please visit the archives

I’ve been a CVS and SVN user for a number of years. Recently I’ve been watching all of the buzz around distributed SCMs, Git in particular. Git has been adopted by a number of projects lately, Rubinius being the one I noticed most recently. I took down my SVN repository when I moved web hosts, and haven’t put it back up yet. It seems like a good time to switch to Git (or something similar) if there’s a benefit.

So this Monday’s Question is: What Source Code Management System do you prefer, and why?




Rails Snippets - 11/29

Holy Shmoly, Ruby 1.9 smokes Python away

Initial performance numbers would seem to indicate that Ruby 1.9 (due by Christmas) will be lots faster.

Quoted-Printable: My .irbrc

If you spend a lot of time in IRB (most of us probably do), it’s worth taking the time to learn how to customize it. This is a good start.

Faker

Nice clean library to generate fake data. The home page says it’s a port of Perl’s Data::Faker library, which I’d never even heard of.


Book Review: Beginning Ruby: From Novice to Professional

I think Beginning Ruby: From Novice to Professional is a better first Ruby book than the venerable Pickaxe.

The previous statement is almost heresy in the Ruby community. Don’t get me wrong, you should own the Pickaxe. It’s a great book and certainly lives up to it’s description as “the definitive reference to Ruby”. However it’s much more of a reference book than an introduction to the language. And it’s huge - 864 pages. This is not a book you can just throw in your bag and carry around with you. It’s a book you would keep at your desk perhaps, dog-eared and coffee stained. In this role, it is ideal. As an introduction to the language, however, it leaves something to be desired.

Beginning Ruby, on the other hand, is an excellent (and I would argue more approachable) introduction to the Ruby language, written by one of it’s more notable users. Peter Cooper is well known, in both the Ruby and Rails community. He runs the Ruby-centered blog Ruby Inside, and has developed a number of applications in Rails, including the Snippets code repository, which was subsequently sold to DZone. Peter also has done a fair amount of writing over the years for a variety of sites.

The book is broken up into three primary sections, plus a handful of appendices:

  • Part 1: Foundations and Scaffolding - This is an introduction to the Ruby language. Starting with installation, and going through the basic structure of the language and it’s elements: strings, containers, and the like. There is a chapter on building basic Ruby programs that puts all of these concepts together. One nice bonus was a chapter on the Ruby ecosystem, which covers the various websites, irc channels, and other resources for Ruby developers.

  • Part 2: The Core of Ruby - This section covers the meat and potatoes of Ruby. It covers classes, modules, libraries, debugging and testing, databases, and advanced features. This is all tied together with a nice example application that implements a text-parsing bot. I liked that this application included unit tests, but it would have been nice if the testing was done test-first. This is a personal preference, but I think it’s a best practice and would like to see it demonstrated more in books like this.

  • Part 3: Ruby Online - As you would expect, this section includes some coverage on Rails. Its not exhaustive, and isn’t intended to replace a full-blown book on Rails. It does offer a thorough overview though. That’s not the sole focus of this section, however. Ample coverage is given to FTP, HTTP, and email, as well as raw TCP sockets and other networking type things. There is also a good chapter in here called “Useful Ruby Libraries and Gems”. The chapter itself is a bit misplaced as it has very little to do with the internet, but it is a very useful overview of a lot of the third party gems that you can install. I found myself using this section regularly on a recent project.

In addition to these sections, there are three appendices. The third appendix, called “Useful Resources” contains pointers to a lot of online resources which would likely be unknown to someone new to Ruby. I didn’t find much in there I hadn’t seen already, but I’ve been using Ruby for a little while. The first two appendices are a primer and reference for Ruby. These are both very good, and would be useful as references for a new developer (or someone who doesn’t have the entire ruby syntax committed to memory yet, like me).

Weighing in at over 600 pages, this is a comprehensive book. At the same time, it’s quite a bit smaller than the Pickaxe, which makes it much more portable (there’s also a PDF version available for $10 if you’ve purchased the dead-tree edition, for the ultimate in portability).

As with the last book I reviewed, this one appears to have been well technical reviewed. I didn’t notice any errors. I also enjoyed Peter’s writing style, which is concise but not dry.

In summary, if you want to learn Ruby, Beginning Ruby: From Novice to Professional is the book to buy.

Disclaimer: I received a free copy of this book from the publisher in exchange for a review. There were no conditions other than that, but in the interest of full disclosure, now you know.


Monday Question: Who Are You and Why Are You Here

Monday Questions is a recurring series on Approaching Normal. For more questions like this, please visit the archives

Feedburner tells me that I now have over 100 subscribers to my RSS feed. That of course doesn’t include the people who read this via Planet Ruby on Rails. In honor of this milestone, today’s question is: Who are you, and why are you here?. I’d like you to introduce yourself, and tell me why you come here.

Post your answers in the comments below.


MacBook Pro After One Week

So I’ve had the MacBook Pro for a full week now. Here’s my assessment.

  • I don’t at all regret the decision to get the refurbished model. I saved $400 and the unit appears to be flawless. That said, the Wireless Mighty Mouse I bought with it was D.O.A.

  • This thing is really, really fast.

  • Apple customer service is awesome. So the Mighty Mouse was dead. I called Apple’s tech support and explained the situation. The lady I spoked with didn’t ask any questions, she just immediately shipped a new one. No annoying “have you tried changing the batteries” type of questions - just an apology for the inconvenience and a new mouse on it’s way. This is what customer service should be like.

  • Leopard is really nice. Visually it’s beautiful, and functionally there’s a lot to love. This is my first experience with OS X so I can’t compare it to the previous versions.

  • I like the 3-D Dock. This has been panned by a lot of bloggers, but I think it looks really good. That said…

  • I hid the dock after the first day. With Spotlight, I don’t really need it. Because….

  • Spotlight is really, really fast and makes a very good application launcher. Hit Command-Space, and type the first few letters of the app you want to launch, e.g. ’ter’ to launch Terminal, ‘adi’ to launch Adium, etc. See the image below for an example of what I’m talking about

All in all, I’m extremely happy with it.


Book Review: Practical Rails Social Networking Sites

Summary

Rails Social Networking Sites walks you through the process of building a Web 2.0 social networking site (something like MySpace), called Rails Coders that includes the features you would expect in that sort of site:

  • User signup and management (based on restful_authentication)
  • Content management
  • Blogging (with web services)
  • Markup languages like Textile and Liquid
  • Mashups using Google Maps and Flickr
  • photo management (attachment_fu and RMagick)
  • Tagging

This book is not, of course, about building social networking sites, though that does serve as the exercise in the book. It’s about going beyond the basics with Ruby on Rails, and building something useful.

Rails Social Networking Sites is targeted at developers who have some experience with developing Rails applications. That said, you don’t need much. If you have read one of the other books on Rails or developed a couple of play applications, you’ll be fine.

Pros

There’s a lot to like about this book. It’s well written, and covers a broad range of useful topics. Here’s the things I really liked:

  • It covers useful topics in the context of a real-world application. Most of the Rails books out there (at least the ones I own or have looked through) cover the basics of Rails, and maybe a few additional plugins. Anyone building a real-world application will need to scour the internet for help with the other plugins available to do things like handle file uploads, user authentication, and the like. While this book doesn’t cover everything you could possible want to do, it covers a lot.

  • There is a very big emphasis on testing. It’s not TDD (see my note in the cons below), but in every chapter you will be shown how to build something, and then how to test what you built.

  • It’s current. The application is built in a RESTful style, and there is frequent mention of the changes/deprecations coming in the Rails 2.0 release.

Cons

There’s really very little wrong with this book. It appears to have been technical reviewed thoroughly, and as a result I didn’t find any glaring technical errors. That said, there are a few things about the book that I took some issue with:

  • The book frequently references blog posts as resources. This seems like a bad practice to me, as these urls tend to have a short lifespan. It’s very likely that many of these urls will be dead links within a year or so. To be fair, this is a book covering a rapidly moving technology, and it’s likely to be largely out of date in 18-24 months. Therefore, this may not be much of an issue. Still, it might be a better idea to link to the book’s website instead.

  • While the book does give ample coverage to testing (more than most books), it would have been nice if the testing was done Test First, rather than bolted on after the fact.

All in all, these are really minor points.

Conclusion

Overall, I really liked this book, and I believe it will be very useful to anyone developing with Ruby on Rails. Whether you’re on your first application or you’ve been developing for a while, you will find useful information in Rails Social Networking Sites.

Disclaimer: I received a free copy of this book from the publisher in exchange for a review. There were no conditions other than that, but in the interest of full disclosure, now you know.