Pathfinder Blog
Author Archive: Noel Rappin

Dealing With A Legacy

A couple of months ago, I wrote about auditing existing Rails applications en route to potentially taking them over.

In a related story, guess what I've been doing for the past couple of months?

Here are some tips, tricks, random thoughts, and cathartic rants about dealing with other people's code:
Continue reading »

Topics:

A Rails Story, Or An Engine That Really Could

A249796E-83DE-4602-97B3-13399365A522.jpg

Over at the official Ruby on Rails blog, DHH is asking people to share their Rails stories.

Okay, here's mine.

I can actually date this with some precision because I have an email that I sent to my tech-book agent Feb 11, 2005. She was asking me if I had any ideas for books to pitch. I did have one thing...

Continue reading »

Topics:

What’s In Your Junk Drawer?

Continuing my recent theme of utilities and the like that I can't do without...

For as long as I've been programming, I've built up a junk drawer of useful functions that I carry from project to project. The Ruby iteration of this is currently implemented as a Rails plugin that is one of the first things I add to each new project.

Here are a few of the utensils that I keep jammed in the back of the drawer.

Continue reading »

Topics:

I’m Cranky Because I’m Not Getting Enough REST

Can we talk about REST?

It's been about two years since the Simply RESTful plugin was added to Rails edge core, in that time I think I've learned the following two things:

  1. REST is a very elegant way to structure an external web-service interface to a web application.


  2. REST is kind of an awkward way to manage the internal structure of an Ajax-heavy web application.


I think you are going to have one of three responses. I'm betting on the middle one:

  1. "Everybody knows that"
  2. "You are a loser who has obviously not grasped the zen essence of REST."
  3. "You have totally changed my way of thinking"

So here's where I get into RESTful trouble...
Continue reading »

Topics:

Plugging Some Cool Tools

C04400BB-76E9-4857-8F62-AF06086EB855.jpg

Today on the program, I'm going to discuss a few Rails development tools that I've had the pleasure of using recently.

Footnotes

If you're like me, you like starting paragraphs with the phrase "if you're like me". You also used to use the TextMate footnotes plugin, then got frustrated with it in the Rails 2.0 timeframe when it didn't get updated for a while. Every now and then you'd sigh, and remember the days when you could click on a stack trace in your browser and open the associated file.

Continue reading »

Topics:

Many Varied Components, or… Multi Variable Complexity, or… Mainly Vanilla Coding

mvc-1.png (Image comes from the Rails Envy MVC public service announcements -- and I hope they don't mind)

Here's the question:

Describe the MVC design pattern as it is implemented in Ruby on Rails.



And the followup:


In an MVC design, where would you place complex business logic?



This is part of the standard phone screen we give to potential Rails developers. The expected answer goes something like this:

MVC stands for Model, View, Controller, each of which represents a section of the application. The model manages data and often persistence, the view manages presentation, and the controller mediates between user actions and associated models and views. Each of these three subsystems should have as little interaction with the others as possible. Complex business logic should go in the model, since that is the section that deals with business objects.

If your doing a phone screen with us after this, at least have the decency to phrase that in your own words...

I don't think of that as particularly controversial, although I suppose you could pick at the wording and details to taste. Interestingly, or oddly, or something, the recent stretch of phone interviews has had a nearly unanimous answer to the followup question: Controller (sometimes, to be fair, the answer would be controller and model, but with controller as the primary answer).

After a brief time-out to check my sanity and calibrate with some other people (like the video with guys from the picture), I came out of the process with the following few thoughts:

Continue reading »

Topics:

Project Website Part 5: Morph in 11 steps or so

BD3787F1-7967-4CE0-AF3F-AA9E36AD6AA3.jpg

Eventually in the course of developing the Project Website application, it was time to put the project on a staging server for client viewing.

Often we'll host that ourselves, but in this case I decided to try out Morph, which provides a relatively inexpensive virtual hosting environment for Rails applications, using the Amazon Web Services cloud. Even better, Morph allows you to set up a development environment for free. (The free version is limited in size and bandwidth, and they also apparently will shut down the server if you don't deploy for 30 days -- a limitation obviously not shared by the paid environments).

I was able to go from total Morph ignoramus to running deployed app in under two hours. After reading this you should be able to do it even faster. (Full disclosure: Morph and Pathfinder are co-sponsers of the WindyCityRails conference September 20, 2008. That doesn't really have anything to do with anything, I just wanted to mention the convference)

Here are the steps:

Continue reading »

What’s In Your Dock?

menubar.png

One of the things I like most about pair programming, or going to conferences, or sneaking a glance over somebody's shoulder at their screen is getting a chance to see the applications and tools that other people use to make it through the day. I often find myself walking past somebody and wanting to stop and ask them exactly what that interesting looking icon is for.

With that in mind, here are six things that you'd find on my dock, menubar, or command line history that help me get through the day. (I consider Quicksilver and TextMate to be in the Hall of Fame, and beyond this list.)

Autotest: Part of the excellent, if underdocumented ZenTest gem, autotest runs all your unit tests, then sits and reruns the appropriate tests when you save a file in your project. It also tries to run failed tests until they pass, which is very helpful if you have only one or two failing tests and you want to put some debug print statements in the code. Generally, if I'm coding in Rails, autotest is running.

Caffiene. Super-simple little utility that sits in the menu bar. When you click it, your Mac won't go to sleep. You can even set it to revert back to normal after a set time interval. This is always turned on whenever I give a presentation or client demo -- I always hate if my computer decides to sleep in the middle of my droning on...

Evernote. Note taking application. Boring, right? Not exactly. It syncs with a web account and also with an iPhone app. I've taken to putting clippings from Rails blogs there, to prevent the "I know I saw that somewhere" syndrome. Notes can also include pictures, and the web service attempts to do character recognition and allow you to search on, say, the notes you wrote on the whiteboard during that meeting.

TextExpander. Text macro utility, which comes with a set of HTML snippets that I prefer to the TextMate ones. I also define my command line aliases here because I hate messing around in Unix config files.

Twitteriffic. Okay, it's not exactly a productivity tool as such. But it's an extremely well designed piece of software. And with all the Mac and Rails developers I follow, it's nice to get a sense of what's going on. And, well, there are a lot of funny people who hang out there.

VoodooPad. Essentially, this is a personal desktop wiki, but rather than being an ugly web app, it's a pretty nice looking Mac app. I confess that I admire VoodooPad more than I use it, but I've recently started to put project-specific data there that is either too sensitive or too pointless to expose on our public wiki.

Hope this helps. What's in your dock?

Topics:

Integrating Design Drafts Into Your Rails App

F59E60E8-6EDF-44CD-8B30-989643692CBC.jpgThis one might be a little half-baked, I'd expect the implementation and features to change a bit over time. (Image from ArtCulture)

Nearly every project we work on at Pathfinder involves coordination between the developers and the designers. Over time, we've found that the more the design and development work can be integrated, the better everybody's work is. To that end, we like to have our designers work in CSS and HTML where possible, and to keep their designs in the same Subversion repository as the rest of the code. Being able to run a development environment helps the designers see their changes, and gives both sides immediate feedback on changes.

Here's a Rails hack that takes this one step further, allowing developers and designers to go back and forth between the current developer version and the design.

Continue reading »

Topics:

Project Website Part 4: Drag and Drop in jQuery

4BE91917-A3EB-4A6A-BB40-BC4A4F929926.jpg

Drag and drop is like those Nutty Bars snack things.

Allow me to explain.

I like Nutty Bars. But I never expect to like them. They are kind of funny looking, for one thing, what with that weird criss-cross pattern on the top, and the chocolate never quite covering the wafers. But when I get past that and actually eat one, it's actually kind of tasty.

Which brings me to drag and drop. Which I always expect is going to be an overwhelming pain in the neck (probably based on bad experiences using Java Swing). But whenever I manage to get over it and actually implement a web drag and drop, I'm always surprised at how easy it is using an Ajax framework.

jQuery is no exception.

Continue reading »

The App Store, iPhone, and You

IMG_0003.PNG
Kind of an interesting day in iPhone development land. Among the stories that crossed in front of my eyeballs today,

  • The first popular application to get bounced from the App Store for cause. (The game Aurora Feint could send your contact list out over the Internet in plain text. This appears to have been more in the line of an overenthusiastic developer error than a malicious ever overlord, so hopefully they'll be able to get back in the store.)
  • Update, Friday Morning Looks like Aurora Feint is back on the App Store with their update this morning. (In fact, Apple seems to have released a lot of updates overnight.) So, good for that, that's pretty close to how the process should work.
  • The first open source iPhone project that I am aware of, WordPress
  • The second open source iPhone project that I am aware of, Box Office
  • Word that Apple is seeding a beta of the 2.1 firmware and SDK to paid developers.
  • The possibility that the 2.1 SDK might lift the NDA that has prevented developers from discussing the development kit publicly.

I'm particularly excited by the release of the source code projects. So far, developing for the iPhone has resembled walking blindfold through a booby-trapped Indiana Jones cave, and seeing the source for successful projects can only help wandering developers.

Really, it's amazing that any successful software made it to the App Store launch given the limitations imposed on beta SDK development -- a tribute to some amazing developer work.

Which takes us to the murky world of Apple's NDA and the general air of mystery that Apple has placed over the entire process. The Aurora Feint team says that Apple has never contacted them over the status of their app. Some users report the app was deleted from their phones during a sync, others (like me) still have it. Many developers have posted updates to Apple with no clear idea when they will get posted to the App store. Dave Thomas posted about the trouble they are having writing iPhone SDK-related books.

I don't want this to be a rant -- the App store is full of amazing work, but for the benefit of the current developers, new developers, and the users who are coming to depend on this software platform, it's time to open up the lines of communication and let a developer community form.

Topics:

Resolved: Should schema.rb be included in your source control?

formidable_opponent.jpg

This issue provoked a comment in two separate recent posts, and hey, when the people talk in vast numbers like... well, two, we respond.

As you know, Bob, there are two ways a standard Rails application tracks your database schema. The first is the collected set of your migrations, which can all be run with rake db:migrate. In theory, the set of migrations run sequentially results in your database schema. Rails also maintains an automatically generated file schema.rb, which is updated when migrations are run. This file is a Ruby script representing the current snapshot of the database and can be loaded into a blank database using the command rake db:schema:load.

The question that arises is which of these two methods -- migrations or schema.rb -- should be considered the ultimate source of truth about the application's expected database schema? The answer has implications for your group practices. If you consider schema.rb to be the final source, then you will want that file in source control, and you are less likely to place effort into ensuring your migrations are always runnable from scratch. If you consider the migrations to be the final source, then you probably don't want schema.rb in source control but you do always want to know that the migrations run.

Continue reading »

Topics:

“Developing iPhone applications using Ruby on Rails and Eclipse, Part 3: Developing advanced views for iPhone” now available on IBM Developerworks

Part 3 of my series on developing web applications for the iPhone is now available.

This final series article looks at what you should do when the user reaches the end of the list structure and your application actually needs to display some content. iUI provides some useful features for content and form layout. It also covers some features that will give your application some extra polish, such as capturing the user's rotation of the phone and adding an icon to display on the iPhone's home screen.

Project Website, Part Two: Simple jQuery With Rails

project_website.jpg

This is something of a mix between what I've been doing on the http://www.pathf.com/blog/tag/project-website/ posts with my more typical "here's how you do something in Rails" post. I'm going to describe how to use jQuery to manage JavaScript and Ajax in a Rails application rather than Prototype and Scriptaculous.

Conclusions, Up Front

The benefits of using jQuery on a Rails project seem to be:

  • A lot of basic behavior can be specified with much less JavaScript then in Prototype/Scriptaculous, making it feasible for even somebody with my JavaScript skills to write complex behavior directly in JavaScript. I found myself doing things client-side in jQuery that I would have done with a separate Ajax call before.
  • In particular, certain kinds of behavior are almost ridiculously easy -- especially the case where you want every element of a certain kind to have similar behavior. So for instance, if you were, say, maintaining an iPhone plugin and wanted all links of a certain kind to trigger Ajax calls and slide left like a native iPhone app would, jQuery would be a pretty easy way to get there.
  • Creating a Web site that is functional without JavaScript is a much easier and cleaner process using jQuery.

There are a couple of costs, especially from a Rails application

  • You lose some or all of the Rails helper methods for writing JavaScript. You can keep some of the helpers by using the jRails plugin, but using that plugin minimizes some of the gains of using jQuery.
  • The biggest loss for me was assert_select_rjs and the lack of unit testing of jQuery behavior. As much as JavaScript development tools have improved, there are still gaps in testing browser-centric behavior.

Continue reading »

Screencast available

I've got a new screencast up, thanks to Jim Minatel at Wiley for helping put this together. Mac users might want to try this direct link to a QuickTime version, the main version is a WMV file.

The subject of this one is getting a Rails project started on Subversion, which is largely taken from Chapter 2 of my book.

I'm planning to update this screencast with another one on getting a Rails project started with Git. But I'd also like to open the floor to requests, if there's some piece of Rails functionality that you'd like to see visually.

Topics:

About Pathfinder

  • We design and build extraordinary applications for companies looking to make the next great idea a reality.
  • learn more

Topics

WordPress

Comments about this site: info@pathf.com