Monday, March 24, 2008

Assorted bitches about ASP.NET and Ruby on Rails.

(all text belong is my opinion, not yours. Keep your goddamn hands off my opinion if you know what's good for you, buddy.)

ASP.NET is my wife, Rails my mistress

Little background: people consider me a .NET guru. I'm not, really. I'm just not as stupid as most of the ASP.NET developers you'll encounter in certain environments.

You can get any old average joe to start a new project and fuck it up from the get-go, but it takes a special breed of programmer to go back and fix the fucked-up project without trashing the parts of it that works. So it stands to reason that most of the contracts I get are dealing with fixing the sins of mysterious "precursor" developers.

The Precursors are a race of highly advanced developers, who shun the trivialities of modern day development as we understand them.

For instance, here is some world-revolutionizing code I found buried deep within the bowels of a project I inherited:

/* the following code has been anonymized; seeing it in it's true form might be too much for your eyes. */

public string IsValid() {
/* ... snip ... */
string is_false;
if ((bool)data["is_false"])
is_false = "0";
else
is_false = "1";
return is_false;
}
/* The only consumer of IsValid is buried deep, deep within another function. Here is the relevant bits */

bool is_valid = false;
string result = IsValid();
if (result == "0")
is_valid = false;
else
is_valid = true;
Zen.

Now, imagine an entire project architected more-or-less in the same fashion, and you'll know what most of my work-life is like.

That's half the problem. The other half of the problem is that I've used Ruby on Rails.

Don't get me wrong. I like ASP.NET. We get along fine. But I love Rails. The "run away to France with her" kind of love.

Have you ever been sitting there, hacking away in ASP.NET, watching this block of C# code get longer and longer... then, for a moment -- just a brief, fragment of a moment -- think about how you would have done it in Ruby. That, friend, is a moment of utter infuriation, a moment in which you realize that Ruby + Rails would have been 2 lines of code, max (4 if you have a brain-exploison) and you're on your 20th or 30th line of query-string manipulating twisted logic because the people who created ASP.NET haven't actually used it for any extended period of time outside of the "PetShop" scenario.

That's the only way I can explain why some of the ASP.NET framework is the way it is: they designed first, used second. Designed for programmers by someone else.

ASP.NET: "Making the easy things hard, and the hard things possible."

Yeah, OK. Whatever.

Don't get me wrong. ASP.NET isn't awful. A lot of sites run ASP.NET. Like, uh, MySpace. I just find that when you know what you want to do, you can't just go for it. There's always some stumbling block in your way. It's like being in front of your destination, but walking 2 blocks to the left, taking one block forward, then walking the two blocks to the right to get there. Uncool.

But, that's my opinion. Your mileage may vary, and probably does. I get 45/48 miles to the gallon, though! WOO HOO!

By the way:

CodeSmith, what the fuck?
CodeSmith is apparently some kind of code generation utility. People make templates for it and crap -- shit I've never really cared about until some developer I was working with but not monitoring closely enough ("He's a big boy, what's the worst that could happen?") decided he was going to use a proprietary solution for our project's ORM stuff.

Specifically he used .netTiers, which is free, but since .netTiers can only be used via CodeSmith,
it is essentially proprietary.

I only discover this a month or two later when a million thousand bugs crop up because the developer has left but forgot to update the DAL / etc before he left. Yeah, that's totally my bad. Whatever, though, right? All I have to do is run the generation utility. I download .netTiers, find this CodeSmith thing and then realize it's a closed-source application we didn't have a license for.

Part of that is my bad -- he was jumping up and down going ".netTiers is the BEST!" and I was like, "whatever dude, just get it done." In retrospect, considering the damage he's done, if I could go back and change it all I'd start by throwing my car at him if I thought it would go the distance.

Anyway, CodeSmith has a 30 day trial -- no big deal, we only need to regenerate once for now, and we can migrate to a free solution later: the .netTiers crap is way too convoluted for a project this size anyway.

What happened next totally blew my mind.

OK, OK, wait, alright, first the program hung for about 5 minutes before spitting out a raw exception on what is easily the most base and obvious error you'd expect an application to catch, and display nicely, but the mind blowing happens right after.

BUT RIGHT AFTER THAT

The program's generation suddenly stops, politely informing me that my 30 day trial only works with sample databases.

Yes, you heard that right...

Someone went to all the effort and dedication to make an application run off a 30 day trial, but then restricted the 30 day trial to sample databases, so actually trying it out is impossible.

How. Useless. Is. That.

It took me a few minutes to figure out why they did this: essentially it appears that people use CodeSmith because the guy before them used CodeSmith and the guy before THAT guy used CodeSmith -- generational crap, basically. I've read stories about it and stuff but never walked face-first into it before until now.

For those of you slow on the draw, or not really sure of what I'm talking about:

Imagine downloading a game demo. After installing it, you eagerly double click the icon.
However, instead of being plunged into ZOMBIE SMASHING MAYHEM, the splash screen politely asks you to buy the full game if you're really interested in zombie fun, and then starts playing a low-resolution video of other people playing the game.

Yeah, it's that stupid.

Anyway, I just bucked up and spent 20 minutes tweaking the generated files by hand. We'll be ripping out all the .netTiers stuff and replacing it with SubSonic or w/e at some point in the future no doubt.

Monday, March 17, 2008

RSS vs Atom

So, who won?

And what about Media RSS? It looks useful, but is there broad support for consuming it?

Man, Google has never failed me more. Seems like no one is talking about Media RSS.

Sunday, March 16, 2008

My six hours is your eight -- or, why my working hours are better than yours. :3

Snazzy title, eh?

So, just a few months ago I had someone quizzically ask me why I was only billing 30 hours a week -- while their salaried employees clocked a steady 9 to 5, 40hrs/wk. Wasn't I being unproductive by almost 10 hours less?!

Well, as the title states, that's because my six hour workday is equivalent to your office's eight hour workday.

Let's answer this question with some math.

First, your employees have lunch breaks, right? How long is that? 30-45 minutes?

So, really, right from jump your employees are only working 7:15 a day instead of 8.

But they clock in at 9 and leave at 5, right? If they're not overachievers (nothing wrong with you guys xD), that means they came in at 9:00AM and left at 5:00PM. So, how long did it take them to get up and running, getting setup, etc, etc? 5, 10 minutes? Likewise, they have to get ready before they go -- that's another 5, 10 minutes, to shut down their computers, clean up their desk, put away their things.

So, we're down to about 7 hours of work in an 8 hour workday.

Except it's not a straight 7 hours of work, is it?

Your workers take frequent breaks throughout the day. Sometimes they get up and go to the water cooler and talk for 5 or 10 minutes. Sometimes they just zone in-and-out throughout the day because you won't stop bothering them (stop bothering them, seriously, they'll do their TPS report later). What about when they take breaks to stretch and clear their head? Or when they need something from a co-worker that's busy with something else?

Before you know it, your fabled 8 hour workday is really 6 hours of work and 2 hours of interruptions, breaks, lunch, and snacks.

Now, consider 6 hours of work for a contractor -- 6 hours of uninterrupted work. Well, it is interrupted, by lunch, dinner, and assorted breaks, but we're not billing you for that, are we? I don't think you'd be too happy with seeing "LUNCH BREAK (BRK/LNCH)-- 1 HOUR" on your weekly invoice anyway.

When the invoice hits your inbox and it says your contractor "only" worked 6 hours a day (30hrs/wk remember?) that means we're working more-or-less the same amount of time your salaried employees do, except it probably cost you less.

So, there you go!

PS.
The numbers might be slightly exaggerated. That's because I'm terrible at math.


Saturday, March 15, 2008

ATTN: AMAZON.COM

Get with the program already and let me pre-order mp3 releases and other digital downloads.

I can't put them in a wishlist, I can't "favorite" them somehow so I get alerted when they're released. It's totally not cool. I want this techno album that's not available until the 18th, but I keep forgetting it exists. ;(

Wednesday, March 12, 2008

Rails IDEs: NetBeans vs Apatana RadRails, take 2

If you're like me, you stopped using Aptana RadRails right around the point they went closed source and started rolling with NetBeans instead, which at the time was an arguably superior IDE that was also free, cash-wise. I guess most of us figured that RadRails wouldn't be getting any serious love after it's acquisition / whatever.

Well, let's time-travel to March 11th, 2008, where, suprisingly, Aptana RadRails 1.0 was released.

This is completely subjective opinionated review of NetBeans + Ruby vs Aptana RadRails, free version vs free version. I don't particularly care about what's a part of Eclipse or what's all Aptana, FYI, so take that in mind. In fact, I'm writing it up as I use it on a project right now.

Some stuff I like about Aptana RadRails:
  1. * Faster than NetBeans. Waaaay faster. Loads faster, runs faster.
  2. * Less memory usage than NetBeans.
  3. * Faster, "locks up" less than NetBeans. Also, no "Mystery of the Disappearing Cursor / Caret" issues.
  4. * Visual unit test results.
  5. * Immediate window during debugging! Wah-hoo!
  6. * Error checking puts a red 'X' next to files that have errors in them. Baffo!
  7. * Subversion interface is better than NetBeans by a long mile. It's Subclipse, but whatever, it rocks.
  8. * Sweet toolbar menu that lets you jump to view / test / model / controller associated with a file at the click of a button.
  9. * "Outline" view is a bit better than NetBeans.
  10. * Tag matching in HTML files works better than it does in NetBeans, which often just gives up without warning.
  11. * Love the Servers view.
  12. * Love the Rails Console stuff.

Some stuff I hate about Aptana RadRails:
  1. * Migrations suck. NetBeans gives you a killer database migrations context menu where you can select the version number for quick up/down migrations.
  2. * No clear way to import an existing Rails project (I only figured it out because I had used Aptana RadRails at one point in the past).
  3. * Immediate window during debugging needs some serious, serious polish. Seriously.
  4. * Have to press a button and wait like 20 seconds before the help text for a rake task appears. Would rather seem that text inline or somewhere easy to glance over.
  5. * Have no idea how the Rails Plugin tab is supposed to work. Looks pretty, though.
  6. * By default, Ruby Explorer view shows active gems... clutters up the UI quite a bit when you're dealing with a non-trivial project.
  7. * NetBeans has way better string editing support. Highlight a string in NetBeans and press " and the entire selection will be surrounded by quotation marks (foo bar --> "foo bar"). Highlight inside of a string and press # and you'll get insta interpolation ("foo bar" --> "foo #{bar}").
  8. * Some syntax highlighting isn't as nice as it is in NetBeans. Navigate to the end of a paraenthesis or an "end" statement; both do highlighting in NetBeans, but Aptana only handles the former. That's a pain when you're trying to sync up "end" statements after a long night of work.
  9. * Doesn't open up files generated by script/generate by default, which is annoying, because why wouldn't I be ready to edit the files I just generated?!
  10. * Still a really annoying issue of certain lines being highlighted in gray for no apparent reason.
  11. * In general, colorization inside of Aptana RadRails sucks. Out of the box, NetBeans is much better at this. NetBeans is easily the best if you go for the optional ruby colorization plugin recently offered. I'm poking through syntax coloring options right now for RadRails 1.0 and it doesn't seem like there's any way to extensively customize it into something less sucky.
  12. * Error checking is hit-or-miss. Doesn't seem to refresh fast enough -- if I make a modification to a file that causes an error and quickly fix it, occasionally the error tag never goes away -- or it changes to report an error on perfectly valid syntax.
  13. * I just got a freakin' exception as it tried to perform code completion ("Content Assist"). Man, 3rdRail did that shit too. SWALLOW YOUR EXCEPTIONS. Log them somewhere or something. I was busy coding something when you the exception popped up. Not cool.

That's about it.

RadRails is OK, but I think it needs polish in general. As I understand it RadRails 1.0 was a one-man mission; not trying to harsh on the guy's work, just spittin' it as I see it.

I've gotten so used to NetBeans 6.0 and its creature comforts that I find coding in Aptana RadRails to be a real style-cramping exercise (I just finished up what I was doing in RadRails so I could switch back to NetBeans just now).

Your mileage may vary.

If you're using NetBeans 6 for Rails development, seriously consider getting the "Extra Ruby Color Themes." The Dark Pastels theme is a winner.