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.

1 comment:

Chris said...

Python is my language of choice when I'm not in C# so I feel you're pain. However some of the 3.0/3.5 stuff really makes the pain of c# bearable and dare I say even fun sometimes.

I tried RoR but really never got in to it. Too much magick.

I also used CodeSmith way back when before generics made it irrelevant. I now use CoolStorage.NET and haven't looked back: http://www.codeplex.com/CoolStorage

BTW, what is w/e?