Saturday, July 28, 2007
James Avery poses an interesting question in his "How long before ALT.NET becomes NOT.NET?" post.  I'm not really sure what it takes to get into the ALT.NET club, but from what I know I'm guessing I'd fit into the general "demographic".  Like James, I've also been wondering if and when more of the ALT.NET'ters will turn to Ruby on Rails (or alternates like Django).  I've thought about this a bit more lately since I've been spending a lot more time in Ruby and Rails.  In addition to wondering about other ALT.NET peeps, I've also thought a bit about where I want to go with my development efforts and whether I want to continue to focus on .NET as my primary means of making a living. At this point I don't see myself doing anything drastic.  Considering I only have 2 Rails projects under my belt and a heck of a lot more to learn about Ruby as well as Rails I think that's a pretty wise course to take.  I am going to continue on my path to learning Ruby as best I can, afterall it is my language for 2007.  I'm also going to continue to do projects with Rails, try and write a lot more Ruby and Rails related code from scratch (plugins make life way too easy), and evaluate if there is anything I've learned from Ruby and Rails that I can bring over into my .NET related work.  I'm also going to be keeping a close eye on IronRuby, and anxiously awaiting the day when they announce they can run Rails on top of it! 

At the end of the day, I believe learning Ruby, Rails, as well as many of the other things I'm looking into, will make me a better developer.  Whether or not I end up building the software I work on in .NET, Ruby, or Erlang doesn't matter much.  I think we all owe it to ourselves, as well as our customers, to question whether what we're using today is the best tool for the job.  We also owe it to ourselves to question whether we'd find more enjoyment in working with other languages and tools.  After all those questions are raised and answered we still need to make a decision based on where we are in life, what we have control over, and where we want to go in the future.

Perhaps before the migration to Rails starts, Microsoft will change its ways and learn a thing or two about what it takes to make ALT.NET developers happy.  Perhaps they'll realize that designers, wizards, and other magic isn't what where it's at.  Perhaps they'll realize that baking best practices into the platform is a good thing.  Perhaps they'll have a look at TextMate and realize it doesn't have any designers, yet Rails developers love it?!?!?  Perhaps they'll learn a thing or two from the success of Rails and stop the floodgates from opening.  What do you think?


 |  |  | 
Sunday, July 29, 2007 2:45:36 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [4]  |  Trackback
Scott Reynolds talks about how in order to make "real progress" we need to introduce some "shocks" into our "system" to get you out of our comfort zone and into a state of self improvement and growth.  I'm not about to get up on stage and do a Beastie Boys rap, however, I do think I could use a shock or two.

Sunday, July 29, 2007 1:46:42 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, July 16, 2007
Over the weekend I listened to the latest .NET Rocks episode with John Lam.  I'm very keen on seeing and hearing about where the IronRuby project is going, so I found the interview very informational.  Although I enjoyed the entire show, one particular exchange between Carl and John stood out.  About half way through, Carl asked John whether he thought developers who don't do test driven development (TDD) and unit testing should be working in dynamic languages.  John made the wonderful assertion that he doesn't believe programmers that are not writing "unit tests" should be writing code in any language, regardless of whether the language is dynamic or statically typed.   Following that statement, John went on to mention that whether or not the code is test driven isn't nearly as important as whether the code has unit tests since the "test driven" approach is "extreme" and "dogmatic".  While I agree that the key is unit tests, I don't agree that a test driven approach is extreme or dogmatic.  In my opinion its the most pragmatic approach to writing code that is well designed and well tested.  The fact is, writing unit tests after the fact sucks!  Especially if "after the fact" is days or weeks after the real code is written.

When I first got started with TDD I didn't really understand what it was all about.  Rather than figure out what this magical red-green-refactor thing was all about I decided I'd just write some unit tests once I had my code written.  After a couple projects using this approach I started to realize that I really hated writing unit tests after the fact.  It was because of this hatred that I got started with test driven development.

Rather than testing being a pain in the ass task that I had to do when I finished writing my "real" code, testing became an instrumental step within the process of writing the "real" code.  Since I was using tests to figure out what code needed to be written, it became a vehicle by which I could design the code I was writing, rather than an afterthought.  I'm sure there are people out there that write great tests after the fact, however, I'm not one of them.  For me writing tests first isn't something extreme or dogmatic, it simple the only way I can write high quality code with solid test coverage without going nuts.  For me, writing unit tests after the fact sucks.  For me, driving my code with tests is a joy. 

I wonder how writing tests first could be "extreme" and "dogmatic" for others, but for me its pragmatic?

   
 |  | 
Tuesday, July 17, 2007 3:58:39 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [18]  |  Trackback
 Wednesday, July 11, 2007
As I've stated before, my programming language for the year is Ruby.  I actually planned on learning Python or Ruby last year, but things didn't pan out.  Over the last 6-8 months I've been doing a pretty good job of getting myself on the way to learning Ruby.  As with any language the best way to learn it is to write something using it.  As we all know Rails has done a tremendous job of bringing people to Ruby.  I'm no different.  Over the last 6 months I've worked on two Rails projects and in the last week put one of them into production (well almost).  Since I'm half way through the year I wanted to put some thoughts down here, mostly for myself, but also for others who might be interested in a .NET dudes impressions of Ruby and Rails.

Before writing a book myself, I bought a good number of books on technical topics that I found interesting.  After experiencing what goes into writing a book, I find that I'm much quicker to pull the trigger on books that I think I might find interesting.  The amount of work required to get a book out the door is mind boggling to me.  As such I've purchased, and read, the following books to help me learn Ruby.
As you can see not all the books are strictly Ruby related.  Several are focused on Rails, one is focused on working with Google Maps with Rails, and one is to help me learn to work in my new favorite editor, Textmate.

In addition to reading the above, I've been checking out the source code for a couple of the more popular open source Rails applications as well as some of the more popular plugins.  While all of that has been very valuable, nothing is ever as good as actually writing code.  As such I've done several projects that I would have traditionally done in .NET in Rails instead.

The first application that I got started with (and which I'm still working on) is an application that helps geographically visualize key individuals within a social network.  The data for the individuals in the social network, as well as the data for the connections between individuals, is stored in flat files so I got my first chance to play around with the CSV parsing capabilities of Ruby.  I found the FasterCSV library very useful, and got off to a pretty good start with my first attempt at parsing the CSV files and getting them into my MySql database using my ActiveRecord model objects.  After the file parsing was done, I got a chance to build several administrative pages for the site using Rails, as well as the chance to experiment with some very useful plugins such as:
My second application involved setting up a site with paid membership.  The site has several administrative functions for the owner of the site, as well as a handful of features for those who sign up to be members such as exclusive downloads, advertising opportunities, and a members only forum.  In addition to be able to gain a lot more experience with the inner workings of Rails this project also led me to gain experience with:
So given all of the above, if your still reading, I'm guessing your wondering what I think.  In short, I'm becoming a pretty big fan of Ruby as well as Rails.  While Rails isn't perfect it does a lot of things very well.  Rails Migrations are the best solution that I've come across for migrating the schema of a database.  I can see why large teams run into some trouble with them, but for the projects I've been working on migrations have worked wonderfully.  While I'm a big fan of DDD, I also really like ActiveRecord in the right situations.  Being able to create a migration, run rake db:migrate, and have the column automatically available in my model without having to do anything makes developing with Rails and ActiveRecord very enjoyable.  Rather than dealing with the mundane tasks of writing scripts for adding columns, and then updating the associated data access and model classes, I can focus on the stuff that matters.  In addition to migrations and ActiveRecord I'm also fond of ActionMailer and the way that it allows you to create and send email, its far better than what's available in .NET land.  Next up, is the MVC structure that Rails uses for building the pages that make up the application/site.  I'm a huge fan of MVC/MVP for building UI's so it should be no surprise that I'm also a big fan of Rails implementation of MVC.  I really like having a single controller per model object, and having a nice organization to the views used by the controller.  I also really like the validation story for Rails.

As I learn new technologies I often times hack my way around until I get a good feel for what I'm doing and how things are supposed to work and be put together.  This led to me not writing as many unit tests for certain parts of the applications I was working on.  I did test drive most (if not all) of the logic I put into my model objects, but I slacked off a bit when it came to testing the controllers.  This is partly due to the fact that I was using scaffolding, and partly due to the fact that I was pushing almost everything into my model objects rather than allowing my controllers to get "fat".  As part of the test driving of my model objects I used the built in testing infrastructure, although I still want to checkout rspec.  On my latest project I also began experimenting with mocha which really helps with the testing of objects that have dependencies. 

So given all my recent exposure to Ruby and Rails one has to wonder how I rate it against my native "tongue", .NET.  I have to say I've had a lot of fun working with Ruby and Rails.  This is in part because its something unfamiliar and I really enjoy learning, but its also because both Ruby and Rails have a way of making developing with them very enjoyable.   I haven't enjoyed some of the deployments and such that I've had to deal with, but since I was learning a bit about how to deploy Rails applications on Linux it wasn't as bad as I expected.  I'm nowhere near hanging up my .NET toolbelt, but I am going to continue to do a lot of the work that I would have previously done in .NET in Ruby and/or Rails.

 |  | 
Thursday, July 12, 2007 3:11:07 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Monday, July 09, 2007
Glenn Vanderburg's "The Beauty of Ruby" JAOO presentation was recently published on InfoQ.com.  Glenn talks about some of "the subtle beauty that experienced Rubyists have come to know and love".  Over the last couple of months I've come across a lot of great content on InfoQ's Ruby section that has helped me to learn some of the subtle gems that exist within the Ruby programming language.  While reading books, and writing Ruby code are great ways to learn Ruby, its also tremendously valuable to hear experienced Rubyists talk about what they love about the language.  Below are a couple of my favorite Ruby presentations available on InfoQ.

 | 
Tuesday, July 10, 2007 12:46:49 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [0]  |  Trackback
The self proclaimed ninja's over at ActiveReload have unveiled Warehouse, a "web based subversion browser that doesn't suck".  Warehouse is a Rails app that allows you to view a subversion repository with a very slick web interface.  Rick and Justin spent the weekend when they weren't at RailsConf getting Warehouse started, and now a couple months later they've released it to the world. 

Tuesday, July 10, 2007 12:39:43 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Sunday, July 01, 2007
Over the last 2-3 weeks it seems as though 90% of the blogs that I'm subscribed to have been talking about the iPhone.  This is me succombing to peer pressure :) 

While I'm not *really* planning on getting one, I couldn't help but stop by the Apple store this evening on my way home from Sam's b-day party, afterall it was right on my way home.  As I strolled into the Apple store I was a little surprised that there wasn't more people inside, afterall this was the iPhone!....surely everyone in Marlton hadn't already gotten one....or had they?  Anyway, after strolling in and playing it cool, I mosied my way on over to the iPhone section of the store.  While the store wasn't crowded, maybe 10-15 people total, every one of them was playing with an iPhone.  In the 5-10 minutes I was in the store I heard at least 100 "wow", "oohhs", "ahhs", and "I want one"'s.  I'm not sure how many of them came from my mouth, but the that's beside the point.  In short, the iPhone is a very sweet device.  The screen is amazing, the experience is better than that offered by any other device I've probably ever gotten to play with.  In the short time I was in the Apple store, I browsed the web, checked out the calculator, did a google maps search, searched for videos on YouTube, browsed photos, looked at how you make calls, but more than anything I just admired the device that Apple has put together.  After leaving the store, I thought about what affect the iPhone might have on my life.  I can see a lot of people buying one, like a really lot.  I wonder how long it'll be before I'm one of those people.

Monday, July 02, 2007 1:25:24 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Friday, June 29, 2007
In reading blogs today I was extremely disappointed that I couldn't find any mention of new phones that are coming out soon.  In fact this entire week I haven't seen any mention of anything phone related.  What's a guy like me supposed to do? I need a new phone and nobody is talking about phones.  Whats the deal?

Friday, June 29, 2007 4:42:43 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [4]  |  Trackback
 Thursday, June 28, 2007
As Aaron mentions, one of our colleagues recently posted a "brain teaser" on the whiteboard at work.

A/BC + D/EF + G/HI = 1

All variables are unique digits from 1 - 9. Two variables next to each other is equivalent to 10 * var1 + var2. For example, if B = 2, C = 5 then the result is 10 * 2 + 5 which equals 25.

Since my language of this year is Ruby, I figured out the answer with the code below.  I had some of the code sketched out in my head, but I wrote it after seeing Aaron's post last night, so the way I went about implementing it pretty much matched the approach Aaron took.   I should also mention that I'm a Ruby newbie so there might be better ways to go about writing the below code.  If so, I'd love to here them since I'm still learning what idiomatic Ruby is :)

#!/usr/bin/env ruby
class FigureItOuter
  def run
    set = generate_set
    while (calculate(set)) != 1
      set = generate_set
    end
    puts format("%d/%d%d + %d/%d%d + %d/%d%d = 1", set[0], set[1], set[2], set[3], set[4], set[5], set[6], set[7],set[8])
  end 
 
  private
  def calculate(s)
    (s[0] / (10 * s[1] + s[2])) + (s[3] / (10 * s[4] + s[5])) + (s[6] / (10 * s[7] + s[8]))
  end
 
  def generate_set
    s = []
    while s.size != 9
      n = rand(9) + 1
      s <<  n.to_f unless s.include?(n)
    end
    s
  end
end

# a/bc + d/ef + g/hi = 1
f = FigureItOuter.new
f.run


Thursday, June 28, 2007 10:59:49 PM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, June 20, 2007
I'm in the process of deploying a Rails app, and up until a few minutes ago I was having problems getting acts_as_attachement and attachment_fu to work.  I originally started development with acts_as_attachement since I was naive and didn't know there was something better.  After looking for a fix for the issue I was seeing, I came across attachment_fu and came to see that it was superior and would undoubtedly solve my issue.  It didn't....however, the upgrade process was painless and I got some extra goodies so all was good.  For those interested, the extra goodies include pluggable image processors (RMagick, MiniMagick, and ImageScience) as well as an option to store files with Amazon S3.

With attachment_fu installed, I was sure my problem would be resolved.  I suspected the issue I was having was related to RMagick image resizing since I'm deploying to a shared hosting account on TextDrive, and RMagick has quite a reputation for hogging up lots of memory and causing havoc on shared accounts.  After switching over to attachment_fu and to MiniMagick as my image processor I was still seeing my issue, so I realized it had to be something else.

Before going onto the solution, let me explain the problem that was occuring.  When I was submitting a form for an attachment_fu model I was immediately being redirected back to the index page.  Every once in a while the form would appear to be submitting, hang, and eventually hose the lighttpd process.  As I mentioned above, I first suspected the problem was related to image resizing being done by RMagick but I was able to reproduce the problem on a non image attachment_fu model object.  After digging around on the web and coming up empty, I ended up checking out the Rails log file to see if I could figure out what was going on.  Examining the production.log showed that I was going from the :new action, directly to the :index action.  Since I was submitting a form, I should have seen a hit on the :create action for my controller.  This led me to search google for a slightly better phrase which eventually landed me at this "Form doesn't trigger create in production" forum post, as well as this related post on Ruby Forum.

It turns out the problem is due to the way that attachment_fu stores the files uploaded on the file system.  attachment_fu stores the files in a folder with the same name as the model within the public folder.  This causes issues since the url for the controller, as well as the directory for storing files have the same URL.  Fortunately the fix is as simple as adding the following to your application.rb file.
def default_url_options(options)
{ :trailing_slash => true }
end

Deployment is such fun, isn't it! :)


 |  | 
Thursday, June 21, 2007 2:03:58 AM (Eastern Daylight Time, UTC-04:00)  #    Disclaimer  |  Comments [4]  |  Trackback