Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Thursday, August 5, 2010

Why is Knitting Like Software Engineering?

On a quick side note:  I (and my computer) managed to survive a second try at yoga.

Now on to why you started reading this post in the first place.  You were just trying to know how I was going to relate those two topics!  These topics may seem to be unrelated but I have come up with a quick little explanation.

During software engineering process you often toss out more code than you finally use in the end.  The tossing out can be for various reasons:  found a better way, changed the design of other components, not needing the component, redesign, it only was needed once and was really short, combining multiple similar components, etc.  I think I remember something about tossing out 70% of the overall code written for a project.  Anyway, throwing away and starting over is often a requirement or a good thing.

Knitting has frogging.  (No I am not making that term up my non-knitting friends.  Need proof:  read this).  Frogging involves completely starting over or preparing the yarn for a new project.  Like with software engineering, frogging happens for a bunch of reasons:  mistakes, dropped stitches, deciding that the project does not work with the yarn/needle size, you just don't like the project, need to make the item bigger or smaller, etc.

Summary:  Both are hard to do, but it is often for the best.

Friday, July 23, 2010

What's in a name? (Or Notes to Self Regarding Coding)

A couple of months ago (read: end of spring semester), I started writing so code (in java if anyone cares). It all started when I wanted to test some I was considering for my research. Attempting to be smart, I decided I would just write the program for reuse later. Now, that was not my mistake. The mistake was what came next: thinking I would brilliantly name all of my classes really good long descriptive names. My logic being that months later I would easily be able to use the code for the final intended purpose!

I have learned a new lesson: really long names are often just as problematic and did I mention a pain to type? However, I had no problem trying to figure out what was what. I think that was mostly due to the massive comments I left myself too. I have heard the wisdom that descriptive names make the code more "self documenting".

So the question really is: is there a balance between being descriptive and just being silly? Is it better to have names that are only 5-15 characters long? Or is 25+ characters just right or too long? Is it only really long when it gets over 45 characters? (OK I feel like the Goldilocks of programming at the moment...) Does the long names actually make the code less clear?