April 28, 2008
If you are working on a branch and want to abandon it, what do you do?
It’s easy to remove it from your local repository:
$ git branch -d mybranch # delete branch "mybranch"
And then how do you remove it from a GitHub repository? This works:
$ git push firstname.lastname@example.org:<my_account>/<my_repository>.git :heads/<mybranch>
But there’s an easier way. Scott Chacon suggests:
You can also do (assuming ‘origin’ is the name of your remote):
git push origin :mybranch
Scott Chacon is the author of the Git Internals book from Peepcode.
April 25, 2008
Most web applications are built by teams of software developers and graphic designers. When software developers build their own sites, they tend to reuse designs they’ve used before or borrow from sites they like. Sometimes they’ll ask a graphic designer to create a few icons or propose a fresh look and feel. For their part, graphic designers tend to want to create the kind of eye-catching design that will win design awards for innovation and creativity. In my experience, most developers and designers are only dimly aware that there is a profession called “Interaction Design.” With any profession, there is a body of knowledge and expertise, and in Interaction Design, it’s all devoted to developing the optimal user experience. Most web applications need interaction design. At a minimum, developers and designers would do well to familiarize themselves with the accumulated body of knowledge from the interaction design field. And, if possible, get an interaction design expert on your team.
I’ve begun collecting favorite sources of information about interaction design:
and I’ll add to this list as I find more.
April 18, 2008
I’ve been looking for a Rails example app that demonstrates “best practice” development techniques and provides basic features, to be used as a “skeleton” starting point for development of a new project.
I’m primarily interested in finding an app that is written for Rails 2.0, that implements a RESTful architecture, and uses RSpec for specifications/testing. Optimally, it should implement authentication (using restful_authentication) and authorization, provide an interface for users to manage their accounts (or profiles), and provide a rudimentary administrative interface for adding or deleting users. I’ve looked at a number of open source apps (see the post Survey of Rails Example Applications).
There are three open source social network apps for Rails that come close to fulfilling my requirements. I’ll compare them here.
LovdbyLess is a social network platform from the development firm Less Everything. It is hosted on GitHub at stevenbristol/lovd-by-less. It is RESTful and uses Rails 2.0 but not RSpec or restful_authentication.
RailsCoders is the example app from the book Practical Rails Social Networking Sites, published by Apress. It’s a full-featured app and it is RESTful. The author chose to implement his own authentication (using RESTful principles) rather than using the restful_authentication plugin. The app was written for Rails 1.2.3, not Rails 2.0, but an upgrade is relatively easy. It has Test::Unit tests but not RSpec specifications/tests. As of April 11, 2008, it is hosted on GitHub at abradburne/railscoders, where the author has begun work on a new version of the app.
The authors Michael Hartl and Aurelius Prochazka built a social network app named RailsSpace for a book of the same name. RailsSpace doesn’t meet my minimal requirements (not Rails 2.0, not RESTful, no RSpec) but Michael Hartl is taking the lead in developing a new social network app named Insoshi, which improves on RailsSpace. It is hosted on GitHub and development has been funded by Y Combinator, a venture capital incubator. Insoshi is a Rails 2.0 app, full-featured and RESTful, uses restful_authentication and RSpec, and thus meets my requirements.
April 13, 2008
The most popular revision control system for an open source Rails app is Git.
I installed Git using MacPorts with
sudo port install git-core.
After installing Git, I installed the Git bundle for TextMate.
I signed up for Git hosting at GitHub. The process is nearly self-explanatory but I consulted two tutorials, A Tutorial Introduction to Git and Setting up a new Rails app with Git. I discovered I needed to create an ssh public/private key pair on my local machine and add the public key to my GitHub profile before I could push the app to the GitHub repository.
I’ve found two screencasts about using Git wih Rails, from PeepCode and Using Git to Manage and Deploy your Rails Apps from Scott Chacon.
GitHub has their own Git Guides but the best instructions I’ve found for using Git are the Git Guides from the Insoshi open source project.
April 13, 2008
I start any project with a revision control system. On projects of any complexity, I know you absolutely need the ability to make notes about what you’ve changed every time you make an improvement. And you need the ability to roll back to an earlier version when your improvements weren’t improvements. You also get the bonus of off-site backup of your code (assuming you use one of the many no-cost or low-cost repository hosting services).
A few years ago, the only alternative to proprietary revision control systems was the open source CVS. On occasions, it could make grown-ups cry. Subversion (SVN) has become more popular recently and it’s widely used on both open source and closed projects.
If I’m doing a project just for myself or my minions (that is, with a single point of ultimate authority), svn is the best choice. There’s nothing extra needed when you want to use svn on Mac OS X version 10.5 (Leopard); it is included when you install the Developer Tools package. You’ll just need to sign up for a repository hosting service.
For an open source project, there are good reasons to prefer Git, as detailed here by Dr Nic Williams. Git is the distributed revision control system created by Linus Torvalds (the creator of Linux). The most popular choice for a Git repository hosting service is GitHub.