Postings tagged with frameworks
Named versus positional parameters
I can’t stand positional parameters, and I don’t understand why we don’t use named parameters everywhere. For instance:
<%= link_to ‘log out’, {:controller => ‘/user/tools’, :action => ’logout’}, {:post => true, :confirm => ‘Are you sure you want to log out?’} %>Just seems silly to me. You pass in the link text as the first parameter, the URL parameters as a subsequent hash and then the “HTML options” as a hash following that one. Confusing the issue more, you can leave out the {} when you’re only passing in one hash of options.
The problem I have with this is I have to expend the mental energy to remember what order I need to pass things in, and it’s just easier to remember concise, descriptive names.
Example:
<%= link_to :link_text => ‘log out’, :url_options => {:controller => ‘/user/tools’, :action => ’logout’}, :html => {:post => true, :confirm => ‘Are you sure you want to log out?’} %>It’s slightly more typing, but at the advantage of creating self-documenting methods that are just easier to work with.
Rails Observations
So – work has pushed me to using Rails. We’ve been wanting to do Rails work for a while, and I helped land a project that is a good fit: it’s big enough and should fit into an MVC paradigm nicely – plus it doesn’t need e-commerce or complicated shipping logic like many other End Point projects seem to.
I was initially hesitant to learn a new framework. . . I don’t know if this was intentional or not, but it was put out to me thusly – “if you don’t do this project in rails, we’ll get someone else to, even if it means hiring an outside consultant.” The surest way to get me to do something is to tell me I can’t. :)
I’m relatively new to rails, but not new to web development generally.
Other web development frameworks1 I’ve gotten (more or less) good at over the years:
And others I have a more-than-passing knowledge of:
I was also a longtime MySQL fanatic until I came to End Point and discovered that a database can be more than a glorified storage engine: It can also save you oodles of development time and protect your data. All hail Postgres!
Here’s where I plan to keep track of my Rails process and what quirky things I discover along the way.
1 Where “web development framework” has a VERY loose definition.
