Archive for August, 2007

Time Breakdown for Developing A Rails App: Postmortem

Thursday, August 30th, 2007

With v1.0 MomentVille now launched, I was doing a bit of a postmortem on the process. I hope that this will help other new app developers judge how much time they might need to deploy a new app… I’d love to hear what others find for their breakdown in terms of percentages.

1 Month: Learning: First, before even starting, I needed to learn Ruby on Rails to sufficiently start (with no web dev background besides HTML with table layouts). I would estimate this took about 1 month. I did start developing the wedding website builder before feeling really comfortable with rails, but most of the time in the first month was just getting comfortable with rails and web app development. I also got a book on CSS (highly recommended for anyone who still considers using tables) and that was included in my learning time.

These are rough estimates, but I would roughly categorize my time for this app as follows:

time.JPG

~25% Prototype Development: Writing the core of the application.

~ 25% Code Adjusments:

  • Code Refactoring: cleaning up hackish or silly things I did because I was just trying to get something working, or I didn’t know better.I think this should be down along the way, otherwise you end up with nasty bandaids everywhere.
  • My Code Adjustments: making adjustments to my code so things were a little more friendly. Eg: making the polls more user friendly,
  • Shared Code Adjustments: Adjusting shared code that I used to fit into my system. Eg: making the authentication code use email address as login id, update InPlaceRichEditor for undo edits when cancel is hit, etc…

~ 25% Cross Browser Testing

  • Gosh, this was painful. I hope it gets easier over time. A lot of the testing I did was manual, because I was looking for visual inconsistencies which I couldn’t find a good way to test in Selenium. I wanted to make sure that the cursors were correct based on mouse position, and state of the app, etc… Ugh. Start testing on IE6 early. This was probably made more difficult by the fact that I have a large number of themes (styles) over which to test. More on this in a later post…

~ 13% Styles

  • This is probably higher than most will be, since wedding websites on momentville can have any of a number of themes.

~ 12% Test Code

  • Test Writing: Writing unit & functional tests in Rails is easy. You should start early. Honestly. Just force yourself to learn how. It’ll take a day, and save many more….
  • Selenium Tests: Selenium is a great tool for UI testing. Rails testing is great for business logic, model verification etc, but you need to test what it is like to drive an app to, and Selenium is great for this.
2
Tags: ,
Posted in Uncategorized |

MomentVille.com has launched.

Sunday, August 26th, 2007

A little background for the readers. This blog is maintained by a developer for MomentVille.com. It is a rails web app offer free wedding websites . It is a website builder that allows for fast and easy creation of wedding websites including photos, videos, guestbook posts, etc.

You’ll find that many of the posts on this blog lag what I’m actually doing by several months. This is because I want to take the time and go back to explain to others that which I wish I could have had explained to me. Eventually I’ll catch up and blgo about some of the cooler stuff I’m working on…

I just wanted to announce the launch of our app!

0
Tags: , ,
Posted in Uncategorized |

Rails Development on Windows – Gotchas with File Uploading

Thursday, August 23rd, 2007

So, developing a Rails App on a PC is usually pretty straightforward. For the most part, my code on a test machine can be upload to a linux server and work fine. Further, most code examples found online also work.

There is only 2 gotchas I’ve found so far, and they both have to do with file uploads.

1. File would be corrupt on Windows

I was using some code I found online to write a file on the server. It was an image file uploaded to the rails server, but when the image displayed on the webpage, it was corrupted. So, how could I get rid of the corrupted image? Here’s the solution from http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles

Note for Windows: to avoid corrupting binary files, you must call File.open in binary mode. Change the “w” flag to “wb”, like this:

2. File would not always upload on a windows server.

I was raking my brain over this one, but fortunately someone else had already solved it (which so far has been a very common trend in the rails world):

http://www.railsweenie.com/forums/3/topics/1257

It turns out that the file handling in windows is a bit weird, so you just have to wait for it to catch up….

So, how to deal with these in the real world? After all, in development its fine to wait for a second for a file upload, but that is not okay on a production web server….

Well, the way I dealt with it is by using configurations. I have to environment.rb files. One is called environment.online.rb, and the other is environment.rb. This was suggested by my web host. Since it is a shared host, the way a rails app is set to production mode is the flag

ENV['RAILS_ENV'] ||= ‘production’

In environment.online.rb.

When I deploy an app, I just use the .online file by renaming it. This is slightly less than ideal, since it isn’t very DRY (don’t repeat yourself), but since I don’t control the web server on a shared host, I don’t have much choice… Since I have 2 files anyway, I set another flag for myself, in this case I just have the flag:

ON_WINDOWS = false //in envrionment.online.rb

ON_WINDOWS = true //in envrionment.rb

I’m sure that ruby has a way of checking the platform, but this was just easier and quicker…

0
Tags:
Posted in 1 |

Mac vs PC for Rails Development

Saturday, August 18th, 2007

Every time I go to a Rails meetup, I also get mac-envy… It seems I am one of the few rails develoeprs not using a Mac.

I thought about getting a Mac. In fact, my fiance has one, and I get to borrow it sometimes, but I’ve decided against getting a mac for myself. The reason? The end user experience…

Most of the big rails names use a mac, and most screencasts show textmate in use. Textmate looks very powerful. I thouight about this for a while, but decided to stay with a PC for development. Here’s the list I was weighing:

Benefits of Mac: The rails community seems more mac oriented, apples sense of design should taken on by most web developers, textmate.

Benefits of PC: Most end users of any web app I develop will be using a PC. I need to feel what they feel.

The PC won out. There are some good tools for PC rails development. As I said in my last post, InstantRails is amazing. For editors I’ve used both RoRad & RadRails – preferring RadRails by a fair bit. There are a few ‘gotchas’ to watch out for, which I’ll post in a very short while…

0
Tags:
Posted in 1 |

I Want to Learn Ruby On Rails, but Where Should I start?

Thursday, August 9th, 2007

Great, you’ve decided Rails is worth learning, but you are completely new to it. How should you go about it?
Well, I looked back at the path I took, left out the bits that weren’t useful, and re-ordered things the way I think they would have been most useful.
Step 1 – Feel the buzz. You need the wow factor. The rails community has a ‘Show don’t tell’ mentality, so check out these cool and quick screencasts: http://www.rubyonrails.org/screencasts
Excited yet?
<yoda>You will be… You will be…</yoda>
Step 2 –> Next up: The view from 30,000 feet:
- If you are reading this, you may already have this view. But, just in case, here is a good introduction to Ruby On Rails. http://www.onlamp.com/pub/a/onlamp/2005/10/13/what_is_rails.html good overview
Step 3 – Get Amongst It!

Time to make an actual app! You’ll need to set some things up first though. I’m on Windows, so if you are using another environment, this won’t be too much help. You’ll find that a large portion of Rails developers are Mac users, but I think the number of Windows Rails developers will continue to grow. I’ll post more on that later.

Anyway, let’s get moving. You can find a good first tutorial here: http://instantrails.rubyforge.org/tutorial/index.html It is a modified version of another great tutorial, but is set to fit Instant Rails. It is slightly out of date so see some notes below. Instant Rails (http://instantrails.rubyforge.org/wiki/wiki.pl ) is a super awesome one click and you’re done Ruby on rails environment, complete with MySql. Two Notes:

  • The tutorial mentions MySQL-Front (no longer available). Get HeidiSQL instead: http://www.heidisql.com/
  • The tutorial also talks about webrick server. Instead, mongrel will be running, but that shouldn’t affect the tutorial at all.

Step 4 – Editor

You may also an editor. I’ve tried RoRad, RadRails, and Aptana (which actually bought and integrated RadRails). Aptana is easily the best though it’s constant updates occasionally break things for me, and some of the configuration options aren’t intuitive. You can get Aptana here: http://www.aptana.com/download_rails_rdt.php (follow the instructions on the right)

Step 5 – More In Depth:

So now you should understand the high level view of rails, and have made your first app.  Make a more fully featured app by following the 4 Days on Rails tutorial here:

http://rails.homelinux.org/ A good second tutorial

The next step is to buy, read, and follow the book Agile Web Development On Rails http://www.pragmaticprogrammer.com/title/rails/ This is a great resource and definitely worth the money.

I’ll post more about other resources soon, but that should be enough to get people started.

0
Tags:
Posted in 1 |