My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement | getting started with cfrails
I've been working on a couple of .NET projects lately. Maybe you could tell from a couple of my whinings (I won't call them rants), but I'm not entirely sure of what I'm doing yet.

I'm finding that I'm working against the platform. .NET and I are butting heads, and although I'm getting work done, I can't imagine it is really as hard or time-consuming as my initial experience has been. More...

Hey! Why don't you make your life easier and subscribe to the full post or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!



Something's been bothering me lately. It's nothing, really. ?, ?, null, nil, or whatever you want to call it. I think we've got it backwards in many cases. Many languages like to throw errors when you try to use nothing as if it were something else - even if it's nothing fancy.

I think a better default behavior would be to do nothing - at most log an error somewhere, or allow us a setting - just stop acting as if the world came to an end because I *gasp* tried to use null as if it were a normal value.

In fact, just because it's nothing, doesn't mean it can't be something. It is something - a concept at the minimum. And there's nothing stopping us from having an object that represents the concept of nothing. More...


I don't like to have too many microposts on this blog, so I've decided to save them up and start a Programming Quotables series. The idea is that I'll post quotes about programming that have one or more of the following attributes:
  1. I find funny
  2. I find asinine
  3. I find insightfully true
  4. And stand on their own, with little to no comment needed
Here's the fourth in that series. I hope you enjoy them as much as I did: More...


TeamCity is a build server from JetBrains that I'm starting to like. It checks your code out, builds it, and runs your unit tests against the compiled source code (among other things), continuously integrating your code each time someone checks-in a change to the repository (or on-demand, if you'd like). Oh, and it's a bit faster than CruiseControl as well (At least for me).

It's free for many applications - those where you won't use more than 20 user accounts, 20 build configurations, 3 build agents, and don't need anything more than the standard web-based authentication interface. (A build configuration is a way of building using a build agent - e.g., you could build based on a .NET solution file, ANT file, or many other ways. A build agent appears to be the computer itself, though I'm not sure of that yet.) More...


One cool and sunny winter day, a beautiful young woman named Kate Libby (a.k.a "Acid Burn") was writing some mean code. That code was part of a new system that would integrate aspects of the Organization's SharePoint site with its Active Directory and various databases. (Kate had since grown out of her hackerish ways.)

It was early in the morning when the piece of code had finally passed all the tests and was ready to deploy - just about two hours into the day. At this rate, Kate would be at the pub by noon for a couple of pints, and then off to play a game of pickup Football in the early afternoon down at the park by her office. More...


Something's been bugging me lately about ASP.NET: I can't seem to remember to type runat="server" every time I write a line of code to display a server control.

For normal HTML elements, I understand the necessity of using the attribute when you want that element to be tied to the server. But I can't seem to figure out any other way to run a control that's been prefixed with the namespace asp.

So why does ASP.NET require such a silly, useless bit of text for everything it does?

I can think of three reasons: More...


A note to myself (a .NET neophyte) and others who may not know how ASP.NET works:

I was writing a user control (we'll call it ContentBoxVariation) in ASP.NET which composes another (ContentBox). Both have a public property Title, with getters and setters.

You might call ContentBoxVariation in an .aspx page like this: More...


Since the gift buying season is officially upon us, I thought I'd pitch in to the rampant consumerism and list some of the toys I've had a chance to play with this year that would mean fun and learning for the programmer in your life. Plus, the thought of it sounded fun. Here they are, in no particular order other than the one in which I thought of them this morning: More...


String fullName = new StringBuilder().Append(firstName + " " + middleName + " " + lastName).ToString();


When looping over collections, you might find yourself needing elements that match only a certain parameter, rather than all of the elements in the collection. How often do you see something like this?

foreach(x in a)
   if(x < 10)
      doSomething;


Of course, it can get worse, turning into arrow code. More...


I just wanted to highlight a couple of interesting ideas I saw on InfoQ this morning:
  1. Somewhat-open classes in Java: I hadn't known about JavaRebel until now, but it looks interesting. It sounds as if you can do open-class type things, but they don't seem to market it on that aspect - instead, they focus on the time it saves you by not having to "redeploy or restart."
  2. That sounds quite a lot like another language where you're working in the abstract syntax tree itself. So I found it good timing that InfoQ also mentioned several implementations-in-the-works of Lisp on the .NET platform. Hey Grant, why don't you join one of those teams?
Do I have any votes for polyglot programming?


Like many of you, I got into programming because I wanted to make games as a kid.

Wolfenstein Title Screen It was around the time games started looking better and being more complicated than Wolfenstein 3-D that I started thinking I'd never be able to make a game. Sure, I could do Tetris or Minesweeper, but how in the world could I ever match the game play and graphics of a Quake or Diablo. Let's not even get started with Halo 3 and Call of Duty. More...


Here's a WTF I ran into the other day (partially pseudocode):

XmlDataDocument goto = new XmlDataDocument();
goto.Load(".\\locations.xml");

XmlNode gotoThisUrl;
if(referer == "http://www.someplace.com/directory1")
{
  gotoThisURL = goto.SelectSingleNode("gotoOnDirectory1");
}
else if (referer == "http://www.someplaceelse.com/directory2")
{
  gotoThisURL = goto.SelectSingleNode("gotoOnDirectory2");
}

Response.Redirect(gotoThisURL.InnerText.Trim(), true);

It was actually a bit more complex than that (probably 3x as many lines), but with the same purpose. There were literally two places from which to choose to direct the request. And no, the application wouldn't take incredibly long to compile. I felt like it was quite a bit of overkill.


The last bit of advice from Chad Fowler's 52 ways to save your job was to be a generalist, so this week's version is the obvious opposite: to be a specialist.

The intersection point between the two seemingly disparate pieces of advice is that you shouldn't use your lack of experience in multiple technologies to call yourself a specialist in another. Just because you develop in Java to the exclusion of .NET (or anything else) doesn't make you a Java specialist. To call yourself that, you need to be "the authority" on all things Java. More...


For the dynamic language weenies (or otakus!), we have John Lam's Getting Started with the DLR: ToyScript. John is the driving force behind IronRuby, and the post provides a link to download ToyScript, "a quick starter kit for folks interested in building languages on top of the DLR."

Also we've got Visual Studio Shell, which InfoQ reckons will compete with Eclipse. Will be kind of cool to see what pops up on that front.

News courtesy of InfoQ: (ToyScript/DLR and VS Shell)


Don't forget to (learn how to) unit test it using XMLUnit.


I take my second weekend in a row (mostly) off of a computer, and look at all the cool things happening!

Adobe releases AIR (previously known as Apollo) and Flex 3 public beta, both products have been on my list of things to do for quite some time, still with no action taken.

Ruby (MRI) released bug fixes in version 1.8.6. JRuby officially went 1.0 (though it has yet to be posted to the website as I write this). And Ruby.NET released version 0.8 (IronRuby uses its scanner and parser, according to the article -- and this happened a couple of days before the weekend). More...


Often when we make a change to some code, if it is not properly designed, the result is that cascading changes need to be done throughout the application because bugs will ripple through the system. That's one of the ideas behind why we want to have low coupling between classes. We also have unit testing to combat the effects of this, but let's just suppose we haven't written any, and haven't used JUnit Factory to create regression tests.

Given that there is a lot of code out there that isn't quite perfect, wouldn't it be nice to have a tool that could analyze changes and where they would affect other code? I can imagine how such a tool might work, but I haven't heard of one before now (that I recall, anyway).

So the point of it all: I heard something about BMC and IBM teaming up on such a tool (my understanding is that BMC started it, and IBM later joined the project). I'm assuming it'd be in Java, but does anyone have information on this? Can anyone confirm or deny the story I heard?


What if we had functions compile(String sourceCode) and runCompiled(BinaryData compiledCode)? What could you do with it? Could it act as a closure, and bring really dynamic coding to traditionally static languages, perhaps allowing dynamically named variables and functions to languages without them (and much more!)? Could we store our code in a database and mix and match chunks, building programs based on a SQL query?

What do you think? Useful or useless?


Peter Bell's presentation on LightWire generated some comments I found very interesting and thought provoking. (Perhaps Peter is not simply into application generation, but comment generation as well.)

The one I find most interesting is brought up by several people whose opinions I value - Joe Rinehart, Sean Corfield, Jared Rypka-Hauer, and others during and after the presentation. That is: what is the distinction between code and data, and specifically, is XML code or data (assuming there is a difference)? More...


A couple of days ago, InfoQ reported on Jasper, an ORM for .NET (available here).

One of the things I never liked about .NET (or VC++ before that) were the reams of code it would generate. Of course, that's better than just hand coding everything, but it was a hassle to keep up with. It contributed to this vicious cycle where I never knew how anything worked, had horrible God-Classes, and had access to the code it generated which meant that sometimes I needed to know how some of it worked, but never took the time to learn (which may have taught me how it worked if I had used it correctly!). Of course, I was young, conceited, and generally "unconsciously incompetent" about programming back then (has anything changed? =) ). In any case, they are starting to implement the idea of synthesis, and it shows why run-time generation (what I keep calling synthesis) really trumps generating code in files.

It doesn't yet work in C#, but I would expect as they keep adding dynamic features to the platform, it eventually will.



Google
Web CodeOdor.com

Me
Picture of me