The title is misleading, I guess. I am not starting from scratch. I actually decided to restart the C# book and there are a few reasons that, I at least think, are good enough to start at the first page. I decided to do this probably two weeks back. There had been a large amount of time between me actually opening the book and working on the activities that I felt I would benefit from going back and playing again. Reinsert enough credits to play again.
Two weeks have now passed and I am to the first lab between chapters four and five. Seems pretty quick, right? I will say that the first four chapters went faster the second time around. I did not have to spend as much time looking things up or going back to reread. I guess the first time through those chapters did something, I could remember most of what was going on. I hope that my knowledge from last time will help me finish the first lab before too long. I also guess that if I get really stuck I could reference my pooping dog app from last time, I am going to try not to leave a trail behind the dogs as the run this time.
Although I could remember a lot, I still tried to take better notes this time around in hopes that I won't have a situation requiring me to start from the beginning again. I may have to reference the book, or maybe just my notes. Who knows? Perhaps, after I know how to really code, I won't need to reference the book or my notes (will I ever be that good and make it through the level with all my hit points?).
The next series of blog posts will be me going through my notes and putting them on the blog as a reminder of what I did to have a reference that will be forever immortalized in the cloud as everything in this day and age will soon be (does anyone else use Office 365 to have access to all their computer files?).
Why not start now on posting the Cliffs notes? I hope someone finds this useful and not too redundant from my previous posts.
The first item I found useful, that I did not use before, was the class diagrams. I thought last time I would skip making those and just type everything in code itself. These are easy, and easy to make in any program really, and help to visualize what should be in each class. Here is one class diagrams for the start of my second round at Off to the Races
A few pieces on classes that I wanted to point out:
- Classes can do anything but generally only do one specific function
- Classes contain methods that perform actions
- The way you pass input into a method is through parameters
- Program will start with a method called Main(). - You can change the main entry point of a program
- Two classes can be named the same in the same namespace
- A class can span multiple files but you must use the partial keyword when you declare the namespace
Hello, variables! Variables MUST be declared before they can be used. Visual Studio will give you a red squiggly line if you don't declare it first. You can use the debugger to watch how the variable is changing. This will probably be useful when you are getting some output you aren't expecting.
Loops:
Every loop has three
statements.
- Set up the loop
- Second tells the true statement
- Third is executed after each time through the loop
If/else statements use logical operators to check if a condition is true. For all conditional tests you have == (equals), != (does not equal), > (greater than), < (less than), as well as >= and <= to use for checking your conditional statements. A few more points on conditionals:
- You can combine conditional tests by using the OR || operator and the AND && operator
- Set your variable prior to running the conditional test
Enough for today. I hope that writing these down, and maybe for the second time, helps cement them in my brain. I also hope that I didn't miss anything important. Oh, and my Git is still there with all the projects this time and I think I know how to use it a little better now (I better! we are starting to use Git for work).