On Nov 26, 2007, at 1:33 PM, kevin cline wrote:
way? If not, I think I’ll take a crack at it. It would likely look
something like this:
validates_field
‘field_name’, :isRequired, :isAlphaNumeric, :hasMaxLength => 10
Which would ultimately just translate and inject definitions into
Rails’ existing internal structure, but at least I can read it field
by field (and with a number of explicit easier-to-read keywords I’ll
borrow from my past work).
This took about ten minutes to write and test:
Cool. I started someting similar, but the send idea was a good one
that should help finish the exepriment. Thanks for exploring it for me.
Making up new keywords from your past work is fine if you are the only
one who will have to read this code. But you will slow
understanding for all
the developers who read AWDWR and are familiar with the standard
names.
But once they use my way, I’ll speed them up because they won’t spend
five minutes mentally compiling what all the rules are for a given
field by hunting through all those inverted rules, and they won’t
spend time deciphering, remembering, and making typos in their regexs
for the common stuff. Regex is handy, but it’s a speed bump every
time you have to read it or write it.
Rails has lot sof neat stuff. Rails isn’t perfect. So, I’m working my
way through it and trying to decide where I need to spend time
filling in holes and providing alternatives that I think are better
from my past work. Some is just different, but a few I believe I had
better. I understand the advantages sticking to what’s provided, but
I think this is an area worth improving. The current method is quite
cumbersome to read, write, and maintain IMO.
Also, your use of camelCase is non-standard and will make other Ruby
programmers think you are just an unreformed Java hacker.
I’ve never liked underscore words. A line of rails code feels like
someone took a shot gun to it and filled it full of holes. Can’t tell
where phrases stop and start because it’s so full of empty spaces.
Not to mention how awkward it is to type. Conforming is fine (I
understand the advantages), but I hate that I have to conform to
something so ugly.
Right now I’m focused on just learning how Rails and Ruby do their
thing. Trying to do that and switch all my styles isn’t working –
functionality first, style second once I get used to thinking in Ruby.
I’ll conform by the time I publish something.
– gw (www.railsdev.ws)