MustModify Blog: Recent Posts

Ruby Hash constructor -- useful, unintuitive

March 12, 2009
I've been confused in the past about the behavior of "Ruby's Hash constructor":http://ruby-doc.org/core/classes/Hash.html#M002868 . Now that I've looked at the documentation, I have to say I think it violates the principle of least surprise. A default hash returns nil any time you access a key with no set value. The default value can be...


How does Parsing fit in to the OO landscape?

February 05, 2009
I've been working on a Ruby library for accessing the "NefFlix API":http://developer.netflix.com/docs/REST_API_Reference . It's good fun, but it's brought me to some pain points that don't fit in to my "OO is king" worldview. My current struggle revolves around parsing. Should an object know how to parse its data from some external data...


it's Valuable -- like attr_accessor on steriods

January 30, 2009
Take a look at the "ruby gem named valuable":http://valuable.mustmodify.com I recently worked on a Rails project where most of the domain-related data came from a HyperCube database, rather than a relational one. I have to admint, albeit begrudgingly, that it provided a lot of value. Conversely, the interface was crazily complicated, and...


Rails says, "SQL Server does not exist or access denied."

January 23, 2009
Using SQL Server 2005 with Rails 1.2.6, I got the following (less than helpful) error message. --- OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server       SQL Server does not exist or access denied.     HRESULT error code:0x80020009       Exception occurred. --- database.yml: ---yml development:  adapter:...


Introduction to Unit Testing in .NET using TDD

December 19, 2008
Test Driven Development - noun, also TDD  - The step-by-step process of creating an application that is well tested by codifying expectations as tests, then implementing the solution to that test. As implied by the name, the tests drive the implementation, instead of meandering randomly through the code, changing things willy-nilly. TDD changes...


TDD with .NET - implicit conversions

December 19, 2008
Continuing the "TDD in .NET":http://blog.mustmodify.com/search/label/TDD%20with%20.NET series...  namespace EduTest{          public class NameTests     {                  public void name_can_be_implicitly_converted_to_string()         {             Name mick = new Name();             mick.FirstName = "Mick"           ...


TDD with .NET - null coalescing for defaults

December 19, 2008
Yet another post in the  "TDD with .NET":http://blog.mustmodify.com/search/label/TDD%20with%20.NET  series...  There are some fun tricks that can make code a little bit more elegant for advanced coders, though newer developers will take some adjusting. Suppose there is a business rule that when a name isn't valid (as defined by is_valid),...


TDD with .NET - object validation

December 19, 2008
Using the code from the "Introduction to TDD":http://blog.mustmodify.com/2008/12/introduction-to-unit-testing-in-net.html post, I now want the Name object to tell me whether or not it is valid. Let's suppose that the business rule is that names must have a first and last name. I add this to the Name class: ---csharp         public bool...