After doing a tutorial like the InstallFest “not-so 15 minute blog” series you may be left wondering how to go ahead and create your own application. After all you probably didn’t want to make a blogging application, but instead you’ve got your own wonderful idea and you’re still a little unsure about how learning to make a blog gets you any closer to creating your own application.
The most important thing to remember is that almost every application can start out small and be built up. The challenge is to narrow down the scope of your idea to the absolute bare-minimum. In the blog application we first started off by creating a Post “resource” and then built up extra functionality from that point.
Thinking in Resources
The best way to think about your application is to think about a single block of data that you’d like to perform operations on. This block of data is a resource. Rails makes it easy to perform generic actions on each resource Creating, Reading, Updating and Deleting (CRUD). This is exactly what we did when we scaffolded the Post resource. We created a small piece of data and allowed the users to interact with it.
The first challenge of starting small is to figure out what your application’s main resource is. In the blog it was the Post model, but in a Timesheet application it might be the either a TimeEntry or a Timesheet resource. Some applications (like a Timesheet app) have two resources which form the core of the application. This mirrors the core of the functionality in the blogging application where we had Posts and Comments. One of those models will naturally attract more logic and become the “main” resource.
The benefits of building your app like this are many, but mostly it allows you to refine the functionality of your application without becoming attached to a particular design or interaction.
Top 10 tips for Starting Rails
- Keep your idea small and simple.
- Implement the most basic thing that could possibly work. That means ignoring design and fancy interactions.
- Spend some time learning Ruby too. Rails will seem much less “magic”.
- Attend community events like RoRO Sydney.
- Read the Rails Guides, particularly the Getting Started guide, Migrations, Action Controller and the Layout and Rendering guide.
- Learn to read the documentation. On OS X there’s a popular offline documentation browser called Dash which is strongly recommended.
- Try to keep your methods small and focused. Methods should be less than 10 lines long!
- Don’t be afraid to ask for help. Stackoverflow and IRC are both excellent places where you can get help for free.
- Use git and github to store your code. Even consider making your first application open source so that people can easily help you out.
- Attend InstallFest and Development Hub (optional but recommended).