David Findley's Blog

My little home in the cloud.

April 2003 - Posts

Writing regex that doesn't get you beat up in the parking lot after work.
I have recently become enlightened in the ways of regex. Regex has really allowed me to do some things that would have been very difficult to do with just string manipulation. But alas, I am gaining a reputation for churning out incomprehensible code because of the regex that is involved. There is a great article over on the Show Us Your Code site that reminded me that sometimes its not cool to "do it in one line of code".
Ahh the good ol' days.
One of the very first computers I actually owned myself was a timex sinclair. I remember the days of writing a hex loader in basic so that I could hand POKE some assembly into the darn thing. Maybe in C# 2.0 they can add a poke keyword! bwahaha. Check out this great zx-spectrum emulator and let the nastalgia flow.
Programmer Haiku

Here's some programmer/general geeky haiku. Most of this can be attributed to my friend Ed Johnson:

Unitialized
Pointer to the mad chaos
Coat hanger in brain.

My pushing popping
Sublime recursive function
Shit! stack overflow.

My Comment on the BCL/FCL vs. primative types debate.

I've been reading some of the posts about BCL/FCL vs. primative types. It seems to me that the bigger question is:
Do you use the features of your tool? Here is an example:

In C# if I do this:

int a = 5;

Its the same as this:

System.Int32 a = 5;

I am of the opinion that you should use all the features of the language that you have chosen. If you start to code
only to the framework types where do you stop following that line of thinking? For example:

        lock (x) ...

is the same as:

      System.Threading.Monitor.Enter(x);

      try {

            ...

      }

      finally {

            System.Threading.Monitor.Exit(x);

      }

 
Should I code only using the framework types in this case as well? I say no. 
The using keyword is another example. All it does is insert a call to dispose.
      using (Font MyFont = new Font("Arial", 10.0f), MyFont2 = new Font("Arial", 10.0f))

      {

            // use MyFont and MyFont2

      }   // compiler will call Dispose on MyFont and MyFont2

 
This is more of what Don Box so affectionately calls "syntactic sugar". If I use these 
constructs in my C# code will I just become a coding diabetic from all the "syntactic sugar"?
Let’s just say that my opinion is "How sweet it is".
The only thing that I can think of to justify foregoing language specific features is CLS compliance. 
If you’re developing code to be used by any .NET language then you have to pay special attention to
language features that are not CLS compliant. This is usually very easy to check using a compiler
setting.
New kid on the blog.

Well, I'm still a n00b to the blogging community. I've wanted to get into it for a while now but just havn't found the time to get it all set up. Thanks to some prodding and general ridicule by my friends (Lance and Bob) I've finally got set up.

 

More Posts