My Secret Life as a Spaghetti Coder
home | about | contact | privacy statement | getting started with cfrails
A while ago, I was working with a problem in C# where where our code would get deadlocked, and since someone must die or several must starve, I thought it would be nice to just toss a "try again if deadlocked" statement into the exception handler. I muttered this thought on twitter to see if there was any language with such a try-catch-try-again-if construct. 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 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