When do you Start over?

About a month ago I posted that I had started on a Ruby on Rails project.  It was my first RoR project and I spent a couple weeks working on it, learning as I went.  One of the things I had deferred working on was User registration.  I had some done some reading and it looked like there were several viable Gems I could integrate fairly easily.

I have gotten into the habbit of taking my iPad to the gym in the morning and reading up on whatever project I am noodling on.  So I’ve done a lot of RoR reading while on the elliptical machine and came to the conclusion that AuthLogic would suit my rather simple needs.  So I kept working on the functionality I needed for the App, deferring User management for a later day.

I had to put my RoR project aside for 3-4 weeks while working on a Tcl based project for work but got back to it over the weekend.  I decided it was time to tackle the User login module.  Initially everything seemed to be ok, I could follow the examples and make things work but I kept running into little issues and I never got it to work reliably.  The lack of Rails 4 examples to use as a reference got me thinking (and concerned).  Maybe I should have picked Devise (the other Gem which seems pretty popular).

I created a simple RoR App solely to test Devise and it will very simple to setup and configure.  Great, let me fold it into the App I am working on.  Uh-oh.  Not so easy.  I am not sure if it was because Authlogic also defines a User model and there were some leftover pieces of it that were confusing Devise or it was something else in my App but after a couple hours of playing with it, I concluded what I was trying to do was a fool’s errand.

This got me thinking – was it time to start over?  Should I consider all of the work I’ve done to date a “learning experience”?  The more I thought about it the more I knew starting again was the right answer.  But I had so much other functionality already working I hated to throw it away.  Decisions, decisions.

In the end I decided to start over and being with the Devise user module.   I decided to make use of the Rails-Devise example application as a starting point as it will walk through a configuration processs where by answering questions it will generate the basis for a Rails App.  It is pretty slick.  I ran it a couple times to understand the impact of some of the choices but settled on a final configuration which has become my starting point.

I was very quickly able to add some of the functionality I had worked out previously so as painful as it was, I am pretty sure that starting over was the right answer in this situation.  Granted my problem was much smaller in scope than many projects and more importantly, it hadn’t been deployed yet so other than a release delay, my decision has not impacted the end user at all.  That isn’t always the case.

Working with Rails

Last fall I had written a post where I noted that I had a problem to solve at work which I thought might be well suited for Ruby on Rails.  Like a lot of side projects, this one never went anywhere but I did end up playing around with RoR enough to get an idea of how it works and how quickly things can be developed with it.

I do some volunteer work with our High School Booster Club and last year built them a WordPress based site which is largely used to facilitate the purchase of memberships.  While it seems like overkill, the plan is to use the web site to host more content relevant to the various athletic teams.

A couple months ago I was approached about how the Booster Club’s mobile app could be improved or replaced as the currently technology is being withdrawn and no longer supported.  I learned that the back end for the mobile app was extremely cumbersome to use and was a source of frustration for the people who maintain rosters, schedules, results, etc.

I am now working on a replacement for the Mobile App and the backend infrastructure.  Because we already have a WordPress site, I had considered using the WordPress site to host all of the data and leverage the WordPress JSON REST API plugin to serve content up to a Mobile App.  But I had some reservations.

jQueryMobileBookI’ve never done Mobile App development and in the interest of time, am not sure I want to take that on right now.  Based on my jQuery experience with WordPress, I thought a jQueryMobile web app might be a reasonable compromise.  I picked up a copy of jQuery Mobile Up and Running a while back when I had heard it referenced on a Podcast.  At the time I didn’t have an immediate application for it but it was interesting reading.  I dusted it off and realized jQuery Mobile would be a good solution for building a prototype mobile web app.

So now I have some thought in my head of a mobile web app I want to build but wasn’t sure about how to feed it.  While I could see putting all of the data in WordPress, I was worried about maintaining it.  I need something dead simple to enter rosters, teams, schedules, results, etc. into a system.  Ideally it should be accessible from a phone so scores can be quickly entered by unsophisticated users.

What I’ve decided to do is build a mobile first (maybe only) application using Ruby on Rails.  I have made all of my HTML views based on jQuery Mobile.  Within a week or so of working on it for a few hours a day, I have the basic application up and running on my Ubuntu VM.  I can set up teams, coaches, and athletes, and assign coaches and athletes to teams.  I have started on venues.  There is a ton left to do – events, schedules, user login, Google Maps, and a lot more.

While I am excited about how much progress I have made in a relatively short time frame, I am worried I am “doing it wrong” or have made a decision that will be difficult to unwind.  I’ve learned a fair amount about Rails in the past two weeks and much to my surprise, have not had to learn a whole lot of Ruby yet.

The ability to quickly add database columns and connections in RoR is pretty slick.  During my first couple of scaffold generations I was worried about getting the database “right” but having dropped some columns and added others, I’ve found it relatively painless.

While I am impressed with RoR, I am really impressed with jQuery Mobile.  It is pretty amazing how quickly a mobile web app can be assembled.  I’ve been using a regular web browser for developing my app and even using jQuery Mobile with a regular browser is pretty nice.  I had forgotten that the laptop I borrowed while my Vaio was being repaired has a touchscreen.  Using the app on Chrome with a touch screen is pretty effective at mimicking a mobile device.

I still have tons more to learn as I get ready to deploy the first build for some people to play with and populate with dummy data but I can already see other uses for Ruby on Rails.  I am still not a big fan of the Ruby syntax but I can live with it for the benefits and development efficiency I am seeing with Rails.

Time to learn Ruby on Rails?

Last Friday my manager approached me with a problem.  It is interesting problem, the sort of out of left field problems he likes to throw at me from time to time.  It is one of those problems that there isn’t a good solution for without developing something completely proprietary as it would have zero value to anyone else but the members of our team.

So what is the problem?  We have a bunch of text files that have diagnostic information about one of our products.  There is no way to do any analysis on this data because they are just ASCII text files.  Like lots of companies, we do lots of Pivot Tables and Charts in Excel to analyze data but in this case, I don’t think it is the right answer.  At least not initially.  We want to collect these text reports over time and load them all into a single database so the collective data can be analyzed.  We’re looking for trends in reliability and things like that.  Once all of the data is compiled into a database, we’ll likely extract slices of it for analysis using Excel but I don’t want to build up an “Excel database” – wrong solution to this problem.

I’ve been using WordPress, PHP, and MySQL for years so it is my “go to” solution for problems like this one.  I don’t see any reason to involve WordPress as it is really just a data parsing and database application that needs a minimal UI to upload the data and browse it.  I’ve done things like this in PHP previously but I am thinking this might be a good opportunity to learn something new.

learning_railsI had picked up Learning Rails a couple years ago when I considered Rails, for similar reasons, for another project which never went anywhere.  I dusted off mycopy of Learning Rails and for the last few days I’ve been reading through it while I was at the gym.

So far from what I’ve read it looks like a viable solution to quickly put together a solution which (a) needs a database and (b) will be very low usage.  I think the biggest challenge I’ll face putting something together will be parsing the ASCII file in Ruby (which I’ve never used) but I am sure I will be able to figure it out.  The format of the file is fairly regular with sections of data but each section is slightly different.  Unfortunately it isn’t something simple to parse like a CSV file.

This morning I created a new Ubuntu (also a first for me) Virtual Machine and used this Guide from GoRails to install and configure RoR.  In the course of two hours I have built a new VM, installed Ubuntu, and installed RoR.  I am ready to start playing around and see what I can do.

Depending on how this goes, I’ve got a couple other projects in mind that RoR might be a better solution for than building a WordPress plugin.  We’ll see …