surf
10/12/2006 8:47:00 AM
I have been working on building a common library that represents
fields as weighted sets.
I am more familiar with Rails know than I was when I started this. I
decided to post this because I was concerned I may need to show my code
in a job interview.
Below is a code sample of how the sets are declared. The example is of
3 different sets.
I map each set element as a name of the element to a symbol of length
one. Then the set is
stored in the database field as a char and a digit (since it's
weighted). so
"w3u4a0" is the set [windows:3, linux:4, aix:0]. The obvious weakness
is that I can only really have around 26 elements in the set type, but
that seemed ok for what I was doing. If I list my SQL tables from SQL,
the sets are partially descernable more so than just numbers are.
Possibly some bit map could have been used, but it might have been
harder to read from a select. I also may have doubly weighted sets as a
type such as represented by "w32l44". It all works fine as long as each
weight is one digit. Anyway, I just had a java code review at a job
interview and realized the extent to which people can critique your
code so that inspired me to post this here in case I had to use my code
for a job interview etc.
{:platforms =>
{:windows => :w,
:linux => :l,
:unix => :u,
:aix => :a,
:solaris => :s
}
},
{:frameworks =>
{:rails => :r,
:j2ee => :m,
:dot_net => :d
}
},
{:work =>
{:telecommute => :t,
:contract => :c,
:permanent => :s,
:part_time => :p
}