Tuesday, September 30, 2014

Our Mission is Complete

The Mission that we chose to accept - Call of Duty - We're on a mission

Our terms of engagement were nothing less than Victory; we have succeeded and overcome the damage of the lull that preceded us into battle, we now stand victorious.

The Battle against the Zombies is a different story, let them not overcome us again, keep firing, keep stockpiling your ammunition, keep recruiting new warriors, keep engaging the Enemy!

Congratulations Code Review!

Code Review Graduation Meta Post

Monday, September 29, 2014

Code Review Graduation!

Come and Celebrate with us all at Code Review!

We have made the leap to full fledged site on the Stack Exchange Network!

If you have some code that you want someone to just take a quick peak at bring it by today, there are plenty of people there reviewing code on a daily basis, all the big languages are represented (and even some of the less popular as well)

Friday, September 26, 2014

Logo Coding With KTurtle

I took a free laptop and installed EdUbuntu so that my daughter could have her very first computer, kids are so spoiled these days.

To my amazement I found something that reminded me of my first programming experience with Logo about 20 years ago, a program called KTurtle.

KTurtle uses the same commands as Logo (as much as I can remember), they are very similar at the least, so I took it on myself to relearn the language so that I could teach my daughter to code and hopefully learn more in her school years about programming that I had during mine.

Well over 3 months ago is when I created a short script to create a Tic-Tac-Toe bourd 4 times on a single canvas.  My code is rather sketchy to say the least, it is a different type of Coding than I am used to, but the more I coded in it the more I wanted from it because I have become accustomed to the ways of C# and the various shortcuts that come with it.

Logo will really force you to come down a couple of levels with your coding, you have to create a lot of things that you take for granted with languages like C#, VB and Java.

As bad as my code was, there was another reviewer on Code Review that was also willing to learn KTurtle to help me out with my coding skills so that I could teach my little girl, we both learned some things along the way as well like save before trying to run, especially on Windows... ugh!
KTurtle likes Linux much more than it likes Windows.

I am sure that I will be back in there writing more code sometime this fall and/or winter.
What I would like to finally accomplish is a Turtle that will play the game with you as many times as you like and then eventually  move on to other games that I can code with the Tiny Turtle, and hopefully pass my passion for coding to my Children while I do this.

Check out my Question about Tic-Tac-Toe boards and learning KTurtle(Logo)

Is my code nice and neat for a Tic-Tac-Toe board times 4?

And make sure to upvote the wonderful answers that I received as well!

Follow me on CodeReview:  Malachi

For those of you who don't know what Logo is, check out their website @ http://el.media.mit.edu/logo-foundation/index.html

Also check out KTurtle  @

If you do some searching you can get KDE for Windows which will allow you to run KTurtle on your Windows machine, Just remember that it is ornery especially on Windows.

Thursday, September 25, 2014

Confusing Errors for a Confusing Feature? I disagree.

I follow Eric Lippert's blog "Fabulous adventures in coding" and his post today (Confusing errors for a confusing feature, part one) talks about a "confusing feature" and it's "confusing errors" of which I disagree.

I don't think that these errors are confusing at all, let me give you a little background of the issue before we begin.

Eric speaks about a feature in C# that requires unique meaning of variables throughout a block of code, something that means that you can't create a variable with the same name twice in the same block of code(scope), and you can't create a variable of the same name in a child scope either because it would make the variable ambiguous.

Eric says that he has a love/hate relationship with this feature, it keeps him from coding bugs into his applications occasionally.

What Eric doesn't like about this is the error that occurs when you try to declare a variable twice in the same scope.

 class C
     static void M1()
         int x2;
             int x2;

Gives an Error on the Inner x2:

error CS0136: A local variable named 'x2' cannot be declared in
this scope because it would give a different meaning to 'x2', which is
already used in a 'parent or current' scope to denote something else
Here is the direct quote from Eric after he says this,
It is no wonder I get mail from confused programmers when they see that crazy error message! 
What is crazy about that error?  It's in plain English, if you declare a second variable named the same as a previous variable it will overwrite the previous variable.  If this was something that the coder did intentionally then they should know that they don't need to declare the variable a second time and that they should just reassign the variable, on the other hand, if it was unintentional then it is probably bad naming on the part of the programmer.

I can see this being an issue when looking at some of the bad naming schemes that come across Code Review.  I know that the example code is just example code, but we come across code where the variables are listed nearly in alphabetical order

 class C  
     static void M1()  
         int a;  
         int b;  
         int c;  
         // ...  
         int x2;  
             int x2;  

and the meaning behind the variable is a lucky guess or only known to the original coder, kind of like Magic Numbers, but this is straying from the point of both posts.

The second thing (and third thing) that Eric says about this error is

And while we’re looking at this, why is 'parent or current' in quotes, and why doesn’t the compiler differentiate between whether it is the parent scope or the current scope?
In which I reply, the variable exists in both scopes, parent and child, meaning that where the error occurs the variable is in the current scope as well as in the parent scope, it already exists in scope.

This all points to naming, why should you need two variables named the exact same thing in the same scope?  You shouldn't it points flaws in the logic of the code you are trying to write.

RubberDuck from Code Review has from time to time pointed to one of Joel Spolsky's post titled "Making Wrong Code Look Wrong" and I think that trying to declare the same variable twice in the same scope falls under things that look wrong, because it is wrong and is a bad programming habit that C# didn't want invading from C++.

After those two statements Eric continues on to the next point and doesn't explain why doing this is a bad thing or how to keep from making this error in the future.

If we flip things around and try to declare the variable after one has been declared inside of a child scope the error message is a bit different.

 static void M3()  
         int x4;  
     int x4;  

Produces the following error:

error CS0136: A local variable named 'x4' cannot be declared in
this scope because it would give a different meaning to 'x4', which is
already used in a 'child' scope to denote something else
The compiler creates locations for all the variables ahead of time, scope is a means of use, or a map. If we have two cities right next to each other, with the same name in the same state, but in different counties it would be confusing regardless of which one is seen first, so why is this concept so confusing?


I am sure that there is method to his madness in this post seeing that it is "part one" in the series of posts.

This post is more me thinking out loud about the whole thing and I should note also as a disclaimer that I didn't follow the directions and read the post he linked to before writing this post, for everyone's sake here is the link

Simple names are not so simple, part one

I look forward to the life long journey of learning, and the next post (whoever's it may be)

CodeReview User: Malachi