Best Way to Bundle

Thanks to the RubyRogues Episode on Bundler, I learned the best way to use bundler. You want to always use the “pessemistic” version numbers for a handful of reasons. gem 'rails', '~> 3.0.3' gem 'rspec', '~> 2.7.0' This allows the most efficient resolution of gem dependencies (in this case, any version of rails from 3.0.3 up to and not including 3.1, and any version of rspec from 2.7.0 up to and not including 2.8) and the added benefit of allowing you to easily patch everything safely using only bundle update. ...

March 14, 2012 · 1 min · Mark Simoneau

Always Fight for Simpler

If there is one thing I have said over and over again in one form or another, but never seem to learn completely, it’s “Always Fight for Simpler.” Everything could be simpler. Sure, we think it can’t, but it can. Don’t assume you need a feature in an app, a gadget in your life, or a certain amount of money… fight first for simpler. Ask yourself, for any given situation, what the simplest possible solution to the problem is. Maybe it’s not good enough… but maybe it is. Fight for the simplest solution and go from there. ...

March 8, 2012 · 1 min · Mark Simoneau

Complexity and Elusive Perfection

About three or four times a year, I find myself wishing my application wasn’t so complicated. I wish I was some stud developer who always made the right architectural decisions and didn’t back myself into a corner. I read about OO ideas regarding change management and coding for change even when you don’t know what that change is and mostly, I find myself baffled. Hindsight is 20/20. I can see easily how the decision that seemed good at the time to make a Model.seed! method that allowed you to specify all the department data in the database AND change it in the app was a bad idea. I can see that allowing users to change values of reports from within the reports, like a spreadsheet without using the adjustment-as-a-line-item pattern is now a bad idea… but we’re 3 years on and it’s just not something we’re going to be able to convince the users to change or the management to invest the money in fixing. ...

February 29, 2012 · 2 min · Mark Simoneau

Octopress

I am trying out Octopress as a new blogging engine. I have seen several people use it and I appreciate the lack of PHP :)

February 28, 2012 · 1 min · Mark Simoneau

My Ideal GTD App

I have been a long time user of Things by Cultured Code, but they have been very slow implementing a couple of features that would really enhance the way I use GTD, namely time based reminders, location based reminders, and cloud-based syncing. So I went out looking. Producteev looked pretty good, but it is woefully underpolished. Firetask also looked promising, as did Wunderlist, but both left something to be desired. Toodledo had nearly everything except a native app. Omnifocus looks like it has all the features, but is so complicated and ugly that I don’t like it. ...

January 26, 2012 · 3 min · Mark Simoneau

Don't Use DateTime in Rails 3

Rails 3 has good TimeZone support built in, but you have to use the right Date and Time classes to get full support. If you have this set in your application.rb config.active_record.default_timezone = :local, then you really need to use Time so that it properly identifies itself as being in the local timezone and not in UTC when passing to the database insert. ree-1.8.7-2011.03 :001 > DateTime.parse('2011-11-27 12:00:00 +0000') => Sun, 27 Nov 2011 12:00:00 +0000 ree-1.8.7-2011.03 :002 > DateTime.parse('2011-11-27 12:00:00') => Sun, 27 Nov 2011 12:00:00 +0000 ree-1.8.7-2011.03 :003 > Time.parse('2011-11-27 12:00:00 +0000') => Sun Nov 27 06:00:00 -0600 2011 ree-1.8.7-2011.03 :004 > Time.parse('2011-11-27 12:00:00') => Sun Nov 27 12:00:00 -0600 2011 So basically, Time.parse always returns the value in the local timezone, DateTime.parse always returns the value in UTC. To get complete compatibility, always use Time.parse. Trust me, I learned the hard way :)

November 29, 2011 · 1 min · Mark Simoneau

Code Kata #1 - Supermarket Pricing

Taken from Code Kata’s by Dave Thomas The basic premise of this Kata is asking how you would model super market pricing. What is the price of an item? What is the cost? How do you handle price-per-pound? Buy 2 get one free? What’s the value of stock? It’s interesting, and I thought I’d take the time to blog through my thought process. I’d like to iterate over the design and see where it takes me. First task is to represent a product. ...

October 14, 2011 · 4 min · Mark Simoneau

Scary Complicated or Richly Awesome?

When you look at a new piece of data, most of our initial reaction is in relation to the complexity of that data. Usually this scares me, but after you get to know the data, the more the merrier! What was scary becomes rich and awesome. How do we move from scary complicated to richly awesome? Comprehension, comprehension, comprehension. And what is the best way to grok something like that? Dive deep into the guts of the code or the task and find out why the data is there and what it does. Why was it modeled that way? In what way could it have been modeled different? Do I have the power to change it? Is it a good thing to change it? Do I understand the system fully enough to see the richness of the data and of the model itself? ...

September 27, 2011 · 1 min · Mark Simoneau

Feedback Loops and Estimation -or- What Rubik's Cubes Taught Me About Making Software

Estimation is hard. It may not be listed as one of the top two problems in computer science, but it’s at least a close third. Over the years I’ve gotten to try all sorts of methodologies for estimating. Waterfall, Agile, Points, Stories, Requirements, Features, Epics, Pomodoros, Billable hours… you can go on forever with the Jargon of Management, trying to get information from a developer about how much longer The Client has to wait until The Feature is finished. ...

April 4, 2011 · 3 min · Mark Simoneau

Migrating Serialized Columns in Rails

I recently switched a serialized column in Rails from one type (Hash) to another (OpenStruct) and ran into a little problem when I tried to migrate, namely, that loading the model threw a SerializationTypeMismatch error. Hmm… how am I going to get at the base YAML and translate all of these without being brittle? The answer is to copy the column, nullify it, and the load the raw YAML manually: ...

March 3, 2011 · 1 min · Mark Simoneau