Thursday, May 17, 2007

The 9 class HelloWorld app called Hyperion

I thought I should go over the start of this class before getting into anything new. So you know how every programing book or website starts out with same simple somewhat boring console line app that prints out something like "HelloWorld" to the screen well that is not the Hyperion Project. Buzz calls this his HelloWorld app but it a full console text game that has 9 classes and a struct for good measure. Buzz wanted all of us, who were new to programing, just follow along and promised it would all start to make sense. And you know what for the most part it did. Now I'm not going to say that there weren't things that totally baffled me like the whole get set properties thing, but it did what it was supposed to do. It got me used to the c# syntax, the c# express IDE and creative process of designing before you start hacking away at code. It made getting into the basics fun. Now for that get set properties problem I was have trouble understanding the answer came to me in a dream.Yes a dream. I had gone to bed after trying to wrap my head around the need for the get set method. I couldn't understand why they were needed but as I was dreaming about the code I heard Buzz say the word "encapsulation". Just the one word and I still don't now what it means but something just snapped in place I just understood why you wouldn't want to make all properties public. Some how my mind came up with the idea of the distance a car could travel and the properties that affect it like amount of gas, gas mileage, tire pressure, road condition etc. Now what I had come up with was that the car's distance could never be less the zero so you would have to make a check in ever piece of code that affected it which be a lot of extra coding and with it the more of chance for an error in the code. So what if you had just one place in code to make the check to see if something is going to make the distance less than zero? That is the reason for the get set so you can put one simple check in before changing the value. Now Hyperion was fun to code and I learn a great deal from it and when I have a chance to go back to it I think I will learn much more.

No comments: