Trevor Oke

3737844653

Rails and Merb to Merge

Great news!

Rails and Merb are merging. All of the great ideas that the Merb folks have had over the last little while will now be part of Rails 3.0.

To be honest, I don’t know much about Merb. The buzz was just getting loud enough for me to check it out. It looked to solve a lot of the problems that rails has, and I thought it would be worth a look.

I’m certainly going to now.

Shin Kicking Fun

I really feel like kicking IntraWeb in the shins sometimes. I was going to make a list of things that required shin-kicks, but the list was way too long and I started to look whiny.

Honestly, I’ve had more fun working with Joomla.

How Not to Get Realistic Estimates - Hard Limits

I’ve been looking through some freelancing site again. I often do this to keep myself abreast of emerging markets and to look for new gigs.

I’ve found that a certain segment of the gig-giving set like to give limits on how long a project should take. Not in the “we’d really like this finished by Friday” kind of way but in the “This should not take an experienced developer more than one hour - please ensure your estimate is less than this limit” kind of way.

Where are they getting this information? What makes them think that they are qualified to make this call?

Hell - I just found one today that read “I believe the right person can write this in twenty minutes.”

Twenty minutes!

I can’t think of any program that I could write for a person in under twenty minutes. Twenty minutes to get the spec, think it through, code up a solution, test the hell out of it, compile the solution, and then bundle the thing up and send it on it’s way. I’m a pretty quick programmer, but that’s just not going to happen.

Here’s a hint for the certain segment of the gig-giving set. Recognize why you’re bringing in an expert. Make your request as detailed as possible and ask for quotes with estimates from multiple people. You should start to see an average after you get some responses. This will give you a ballpark figure for how much time (and therefore money) to budget. If someone gives you a wildly overblown estimate you can either find out why (your spec might be hard to understand) or try to find out why.

You’ll be happier and you’ll get some responses from people who might actually be able to get you what you want.

Passing the Buck

I got called in to do a little support today. Nothing too big, but any little bit hurts my soul. One of our clients has a web designer that was trying to modify the left nav in one of our templates.

It’s a pretty common task. It’s one of the reasons I put a div with the id of “leftNav” in there.

So.

Anyway.

Their web guy tried to make their own div for the navigational elements and pooched it. Really badly. And then sent off a whiny email about how we won’t help them with anything.

I can see screwing up. Everyone’s done it. Everyone’s made stupid mistakes that they’re just completely blind to. Sometimes you’re just too close to the code. And sometimes you just haven’t learned enough yet.

Just don’t try to pin your mistakes on someone else.

Programming Rails With Script/Console

I’m completely enamoured of script/console. It makes working on rails so much easier. Fr’instance, I blew up a migration just recently and had to get rid of a rogue table. Just open the console and:

1
2
irb ActiveRecord::Base.connection
tables drop_table "rogue_table" tables

Another fr’instance. When I’m learning the interface for a new class, I often have to refer to it a few times. The consle along with some meta=programming goodness make this a snap. So, to find all methods with “tag” in it:

1
MyClass.methods.sort.grep(/tag/)

That’s it.

Nice.

Ironing Out the Wrinkles

Issues are starting to come in for Spice, and they’re getting solved just as quickly. As I said earlier, this is very much the part I like. Not only does it mean that all of the few remaining wrinkles are getting ironed out, it means that someone is using it.

Has_many_polymorphs

I’ve been trying to get some tagging working using Rails, and it’s supposed to be easy using acts_as_taggable. And it would have been. Except that acts_as_taggable has been deprecated. At least there’s a suggestion - has_many_polymorphs.

Unfortunately my install didn’t work properly. I kept getting “is not a taggable model” errors. And that just wouldn’t do.

Solution:

  1. move require ‘tagging_extensions’ to above the initialization block;
  2. add require ‘has_many_polymorphs’ right above that;
  3. restart Mongrel and console;

You should be good to go now.

edit

Of course, it’s right there in the documentation if I had just looked a little harder. Go Team Me!

Emacs and Rails

I’ve always kept emacs around for heavy text lifting. It’s always sitting open on my desktop and stuff I’m working on gets cut into and out of it all the time. The keyboard macros alone are enough for that.

That being said, I haven’t used it as my primary code editor in a very long time. I’ve been doing a lot of GUI work, and emacs isn’t really cut out for that. Add in the refactoring support that most modern IDEs and I’ve been quite willing to leave most of the work to another program.

Now that I’m doing a lot more in rails, I find that I’m in emacs more and more. I’ve dumped all of the other editors and i just spend all of my time in emacs. I’m using emacs-rails which is a minor mode that ties together the ruby major mode along with a snippet editor, links to generation and migration methods, easy and smart navigation (as in jump straight to the correct controller or helper), and lots of little things I haven’t got around to playing with yet.

On top of that, I get to keep all of the keyboard shortcuts that I’ve already learned.

I’m going to post more about emacs in future posts. I’ll probably show some parts of my .emacs file as well.

Converting to Rails

I’ve been working with Rails for the last week or so now. I’ve loved ruby since the first time I saw it, but I never got the chance to play around with rails. I’ve got too many PHP projects out there.

I finally got the chance to change that last week on a test port of some existing ASP.Net software. The existing codebase is a bit of a nightmare, mainly due to the type of programming that ASP.Net requires. All of the abstractions just feel wrong to me like there’s this great mass of people who just don’t really get what the web is all about. It’s really showing it’s roots. I love linq, and I love C# with the .Net library, but that ASP.Net crap has to curl up and die.

Anyway, back to rails. I’ve been coding PHP pages and sites for years now and I’m really comfortable with the language. So much so that I didn’t want to lose the advantages that experience bring with it. Because of that was using MVC frameworks built in PHP (Code Igniter is the best that I found out there).

I should have changed a lot sooner.

I’m just blazing thorugh the code base. My PHP skills are helping rather than hindering. The abstractions actually make sense.

I like it.

I’m not a fanboy yet (there are many places where rails would be far too heavyweight) but I do like it a lot.

Out the Door

Spice is now out the door and we’re running through all of the little changes that have to happen whenever you release something. Call me crazy, but this is actually the part I like.

I mean, I’m good at the greenfield design stage, and I do love the flash of creativity. But I much prefer this stage. The final extra-polishing that goes into making a product complete.

It’s pretty satisfying.