.comment-link {margin-left:.6em;}

I Hate Linux

Monday, August 01, 2005

So Unclean

While trying to debug a little problem at work today I ran a quick test and in doing so, used a coding construct that I haven’t used since high school. Never in my 2 years of professional coding, nor in the 5 years of college before had I used it. Not since my first programming classes in high school using Microsoft QuickBasic on the Macintosh has it been seen in my code.

What is this horrible construct?

goto

Of course, being the great software engineer I am... I don’t think it should be my fault... maybe it’s the environment, or the API, maybe even an adding issue in the CPU that caused it.

Is it Microsoft’s fault for including it in the C# language? No.

Is it the fault of Edsger Dijkstra who was never successful in his goal (as outlined in ‘Go To Statement Considered Harmful’) of having it left out of all higher level languages? No

Yes, I know that there are uses for it, I just am angry at myself for using it after such a long time without and have only myself to blame, and now... I must find a way to do penance (can you tell that I used to be a Catholic?).

Perhaps I should make a pilgrimage to the grave of Dijkstra and seek his forgiveness.

4 Comments:

  • Why do you ever, ever need to use goto?

    I programmed for many years in basic, from Applesoft in 1980 to Visual Basic in maybe 1995. I moved over to C and C++ and I haven't used a goto since then.

    Maybe the problem is that you are using dotnet.

    By Blogger Jeremiah, at 9:01 PM  

  • Jeremiah,

    You, sir, are a genius.

    Your writing is brilliant and clear.

    Unlike Brendan's dotnet programming and, indeed, the dotnet system itself.

    Good show!

    -Dan tdaxp

    By Blogger Dan tdaxp, at 6:17 AM  

  • Back in college I had a professor who passionately hated C/C++ and thought Pascal was the 2nd coming teaching a Programming Languages class. At one point, we began talking about some of the different views regarding goto.

    He told the story of him years ago while in school, working on a final project and running into a wall where he seemingly needed to use a goto, but he thought it wrong given his education up to that point and despite lots of other attempts, could not find another way. After much soul searching, he went to his advisor and said something to the effect of: “I’m in a position where it seems like I have to use a goto and I can find no other way... is that alright? Is it ok if I use goto?”

    The advisor asked, “Is goto supported in the language?”

    Puzzled the student replied, “Yes”, to which the advisor answered, “There is your answer.”

    Sadly the professor was right, there are times when you do need it, albeit quite rare.

    By the way, it is laughable to suggest that the problem is .NET given that Applesoft (and Basic in general), VB, C, C++ and most other languages you find out there not only have some sort of goto, but are also just as easy to build the puzzle I was trying to solve yesterday.

    By Blogger Brendan, at 7:09 AM  

  • Oh, Brendan... If only you had asked! Your entire employer's "enterprise" computing infrastructure is built on gotos! Seriously. Ask Jim. He'll tell ya. Or better yet, with a quick esearch, show ya.

    Yes, it's all legacy code, and yes, I tried my damndest to get rid of as many as I could during my time there... but sometimes the sheer weight of that task was too much for me, and I left in defeat.

    By Anonymous Ryan, at 11:36 AM  

Post a Comment

<< Home