Contribute to the cause
Note: Bookmarker is a work in progress. If you’re interested in contributing, contact Jeremy Weiland.
So what is Bookmarker and why should I care?
Bookmarker is a simple web application written in the Ruby language using the Rails framework. The application is designed as a learning resource for guiding newbies through the process of building a web application. Through hands on experience, we hope you’ll better understand some of the notorious framework features like ActiveRecord, migrations, plugins, associations, and more.
Hey, passing unit tests can’t be worse than reading another boring tutorial.
So how do I go about this?
As a prerequisite, download and install ruby and rails. See the instructions here for more details. You’ll also need Subversion and some sort of database, preferably MySQL.
This course assumes you have all the above installed and configured correctly. You’ll have to look elsewhere than here for help on getting any of the above set up. If you have any helpful suggestions I should mention to newbies, lemme know.
The guided programming course uses Subversion, Rake, and the Rails testing features to manage a guided development process step-by-step. Navigate to the location in which you want to work. Type the following at the command prompt:
svn co http://svn.cvreg.org/repos/bookmarker/tags/stage_1 bookmarker (please don’t use just yet)
Subversion will then go about the process of copying the code for Stage 1 to your machine. This project is a skeleton – not unlike running the rails script to create a new project – except that we’ve already written the tests which a basic bookmarking application would have to pass in order to work. These tests can be invoked using the ‘rake’ command at the prompt. However, we’ve created a special task to manage the learning process and give you hints on where to start.
Typing ‘rake grade_me’ at the command prompt will run unit and functional tests that have been provided, all of which will fail because you haven’t yet written the code to implement the basic features for this first stage of the project. The rake task will remind you of some of the things you need to write in order to make the tests pass, but you’ll have free reign more or less to implement the code. We’ll tell you where to look for help and even give hints, but there will probably be some trial and error involved if this is your first time with Ruby and Rails (just like any initial experience with a programming language). Just remember that the code you write to pass the tests will simultaneously build the application, feature by feature, so let the tests guide you.
Once you’ve written all the code needed to pass the tests for a particular stage, the grade_me task will check out the next stage’s code from the Subversion repository. At that time further hints on how to proceed and pass the new tests will be provided. Keep in mind that as you check out new stages, your original code will be replaced with code from the repository. This code is commented, so be sure to review it to compare what you did to the way we coded it (it’s a great way to learn the cool little tricks of Ruby and Rails).
What’s the point of all this?
By the time you finish this guided programming experience, you should have a grasp of the basic concepts needed to build a Rails application. After that it’s up to you to learn more about Ruby and Rails, though hopefully the hands on time will give you the foundation you need to navigate more advanced topics. Also, pay attention to the implementation of the unit, functional, and integration tests – they demonstrate how tests can be used to catch errors and specify application behaviors.
Have a great time! We did writing it.
Peace,
Jim, Jeremy, and the CVREG crew.
