Posts from 5 December 2014

Actually, that's not quite accurate… with HTML being as verbose as it is, today quickly became "snippets day".

For those of you who are unaware, snippets are short bits of text which, when followed by a <tab>, autocomplete into a common pattern. So today was filled with a bunch of things like opt<tab> turning into

1

<option value="option">option</option>

or =<tab> turning into

1

<%= %>

which are both really annoying to type normally, but super-easy to deal with when you can get them in a couple keystrokes.

Why does this matter? Today was all about views, which generally entail setting up proper routes and controllers (as mentioned yesterday, and which happened much faster today), and then generating dynamic HTML using .html.erb (Embedded RuBy) files called by the appropriate RESTful controller. So the faster the code comes out of you, the more time you can spend thinking about the crux of problems solving instead of typing. Just writing out the sequences of shift/non-shift characters can give me conniptions… which might be good practice, because I've noticed that I never learned to properly use the rightmost two fingers on my right hand while typing. I should probably only try to learn one thing at a time.

Anyway, so I was concerned that doing views would be really tedious, but Ruby is so DRY (Don't Repeat Yourself) that it's actually quite fun to write a good view method, even though it can be awkward inserting erb inside proper tags, interlaced with html. And since you're trying to avoid repeating yourself, writing good dynamic HTML can be quite a fun little puzzle to put together…

So, all in all, views were much more fun than I expected, and the backend—migrations, models and controllers—were much easier the second or third or fourth time around.