Saturday, December 26, 2015

A Christmas GitHub

Well, I know that I am passed my week deadline. December seems to be a busy month, don't you think?

In the time since I last wrote, I was able to create a Github account using the name robertjorg and create a few repositories for the coding I have done. I first tried just one repository for all the code that I have done for the C# book. Maybe I should have kept just one repository for the entire book, but I decided I was going to break up the repositories by bigger projects. Each bigger project in the book will have it's own repository. Which is the better way? I still am not sure and am still learning about forks, repositories, and working together in GitHub. Maybe I will decide that I should have one repository for the entire book as a move along and discover more.

I had a great experience (and I am glad I wasn't developing something that I will need down the road)! I somehow deleted all of my code I had written for the book. I saw it there, then when I was moving from one repository to many, it was deleted. Not sure what I did, but I am glad I wasn't more attached to the code. I had saved the Day at the Races code on my Google Drive so that was easily recovered. I had one more chapter of code that I lost (to save time I went to the books website and downloaded the code). Lesson learned, when trying something new, make sure I have a backup so I don't lose the code. Then again, maybe GitHub removes the need to have to create backups as long as I am using it correctly? I was using the Desktop client, which seems to be pretty user friendly, and plan to continue using that (unless someone tells me there is a better way of doing things).

I found another GitHub repository that contains some code for A Day At the Races. I checked the solution for walbalooshi and it they did implement some of the same code that I did, but was pretty different. walbalooshi has three repositories with two appearing to be solutions for the C# book and only the projects (maybe they are two of the labs).  The Day at the Races as five forks. I am interested to learn if those that are forking that code are  forking to help make changes to the original code?

I hope to keep learning and using GitHub more. Maybe one day I will be a paying customer because I will need a private repository or two.


Thursday, December 17, 2015

A better understanding

Well, I now have a better understanding of the get set accessors. I think the blog is a great idea. I have a coworker, K.C., that has been reading all my posts and reached out a few hours after I posted on Tuesday. K.C. and I spoke about my questions on Wednesday.  My team leader, Taylor, read and knew I had questions as well.I made sure to reread pieces of the book and look at the code I had written for the chapter to try and gain a better understanding before speaking with anyone at work. I spoke a few minutes with Taylor and he helped with my understanding. K.C. and I spent close to half an hour going over my questions.

Now, what did I learn? First, just like I said last time, I need to go back and create a list of vocabulary used so I can stop confusing the terms. I will be doing that this week. Maybe writing down the words and their definitions will help me retain them better. K.C. was great and gave me some history that the book didn't present. A property is a C# creation and not known by other languages. Without the idea of property there will be a few more lines of code (it actually looked like A LOT more coding).

The get portion of the property is used anytime the property is read and returns the value of our private property. The set accessor is called when the public property needs to be set and in turn can set the private object in the class. Anytime the private object changes, there may be other objects that need to be changed, hence our private object.

Constructors, no return value. Constructors allow us to initialize the private fields in a class.Then to change our private property we have to go through our public property to change the private field. Using the property will change everything needed to change (the reason for our private property).

Automatic Property: public int MyProperty { get; set; } - C# automatically creates the private piece needed when using the generic structure.
Field: Variable declared directly in a class

I had some co-workers speak to me about how I was putting my code and programs on the web. I have just been using my Google drive. What about something like Git? I will be working on that and my definitions list. 

Tuesday, December 15, 2015

Privatey privates

Another week down. I understand why you want pieces to be private. I don't want everyone knowing all of my business and I am a pretty private guy. I like my privacy. There are certain things we all tell people and other pieces we keep to ourselves (or share with only a select few). I like the sentence at the beginning of the chapter that states "...good objects don't let other objects go poking around their fields." Enter encapsulation.

Encapsulation allows you to keep your privates private without impacting the integrity of your program. I can tell my class that, hey, this parameter or method is private and only this class can use it. It's like keeping a secret. The problem becomes, when do I make something private vs. public? I guess that is a subject that one really needs to think about when programming. Some pieces are ok to be viewed by the entire program while others we want to keep locked down, we just want to get it write to help with the readability and ability to understand our code. Nothing new to programmers that have been in the game, but I found this piece helpful.

To help with encapsulation you have properties, or the get and set accessors. I know, right? Honestly, I see that these work, but am fuzzy on the how they work. Ok, I reread a paragraph. It states "A property can be used to get or set a backing field, which is just a name for a field set by a property." I need to go back and keep a list of vocabulary words. I have to keep looking up what the different words mean. Anyway, I am fuzzy here, but I could just use the automatic properties and we will be all good right? I mean, type prop, tab, tab and it is done! Well, I still need to understand what this is doing to make the program work as expected in a clean way. Plus, I am sure just throwing gets and sets out there doesn't help with encapsulation and determining if I should have a public or private object.

More reading this week on this subject...watch for it

A screen shot from the program the book helped walk me through

Tuesday, December 8, 2015

A Day at the Races...Finally

Well the day has come. I finally finished the first lab in the C# book. The book reads that we should know everything you need to in order to complete the lab. I found there were a few things that either I glossed over or the book did not touch on the subject. That was moving pictures in the Windows Form. A quick Google search (yes I used Google in the lab) helped me understand that I needed to find the location of the picture and then I change the location by changing one of the points (X axis or Y axis). I then joked with my cousin (who is a much better coder than I am) that I didn't know how to move the dogs and he said to use dog.Move();. Great idea I said, except they returned dog.NotListen();.

Here is the opening screen of the wonderful Day at the Races app.
The dogs and the race track are 5 pictures and, as discussed above, the key was figuring out how to get the dogs move by changing the point on one of the axis. That movement is supposed to be random. The randomness comes between zero and four spaces forward (I decided to add 0 to try and make it more random). Well, it is random, but the races are always very close. You have to stay on the edge of your seat in anticipation.

And don't worry, you can see where the dogs have been! They leave a trail of...let's call it droppings. I tried a few different sets of code in the Run() object to fix this issue. I found that I was reliably able to get all the dogs to run at the same speed and finish at the same time, except it always had dog number one win. Hey, you could make a lot of money betting on number one! I found that if I used Application.DoEvents(); the droppings don't appear anymore, but the races get stuck in an infinite loop. Then if I add a break; the loop is broken, but all the dogs finish at the same time. I am thinking it maybe has to do with the order which I have the code written, but I tried rearranging and in some cases made it a little better, but generally made things worse.

This was the first project in the book that required multiple classes in order to run. I have a guy, greyhound, and bet class. It was fun trying to instantiate an instance of bet for the guy class (or is that backwards?). I have instantiated an instance or two at work, but I have not fully understood what or why I was doing it. I feel that having walked through having to write a  program that uses an instance of another class helped me understand these much better.

In the end I wasn't given much direction on how to write the code, just a skeleton frame. I added a few objects that weren't in the original skeleton I was given. I hope it was needed and that I am not just adding objects that aren't needed (I will say I used all the objects somewhere in the code).

I want to include the SLN so that if anyone wants to take a look and provide constructive feedback they can. This is the first time I have ever shared code, so I hope I included everything that is needed. If it matters I have the solution saved at C:\Source\Personal\CSharpBook\labADayAtTheRaces (maybe it matters for where it will look for the dog and racetrack pictures). Here is the code and sln files (code was written in Visual Studio 2015).

Well, here is the Day at the Races (don't worry, no actually money is exchanged so it is legal in every state). Have fun playing with Joe, Bob, and Al's money. Happy betting!

12/8/2015 Update - I was able to fix the dog droppings. The pictures were not not refreshing so each picture was left behind leaving a trail of the back of the dog legs. All it took was talking to my team lead about the issue and he said, "Try this.Refresh();" Easy fix. No more trails. (I have updated the link above).

Tuesday, December 1, 2015

My day at the races (or a few weeks...so far)

The C# book tells me I should know everything to make the day at the races app. Well, I may know it, maybe I am not spending enough time thinking about it. Or, maybe I am spending too much time thinking about it and I need to take a step back. Honestly, I did take some time off from thinking about the program. If you read my prior posts, I was in Orlando for a week at the Visual Studio Live! conference. It was very informative and was a great experience. Then it was Thanksgiving. Lots of food and family.

Now back to the app. I have the visual pieces done. The pictures of the dogs are waiting for the code to tell them what to do. I have the skeleton framework done for what I need to do. I also have one class done (I think, I haven't been able to test it yet as I need more of the code in to test that the betting section works).

Will I finish this week? We will see.

Thursday, November 19, 2015

Visual Studio Live! Last Day Sessions

Today marks the end of the sessions for Visual Studio Live! 2015 Orlando. I must say that it was a great experience. Not having done any tech conferences before I have nothing to compare to, but I feel the sessions were very informative and had good presenters.I would be interested to compare if I come back next year and have another year of coding experience. Will I go to the same sessions? Or, will I select more difficult classes? Would I stick with mostly Visual Studio classes? All questions that I hope that I will be able to answer next year. I think that I picked pretty good sessions for my level of knowledge today.

The first session I attended was Getting Started with ASP.NET 5 with Scott Allen. I actually have taken a few courses on Pluralsight. It was nice to be able to see him and put a face to the name (although Pluralsight has pictures it isn't the same as the real life version). ASP.NET 5 has some really great features. It can be used cross platform! That seems to be a theme we have been hearing this week, Microsoft is helping developers by providing solutions, either their own or through partnerships, that allow cross platform deployment. AWESOME! Microsoft really is trying to reach out to the younger developers/generation that may not be tied to the Microsoft way of life.

We saw another awesome enhancement with ASP.NET (and I believe we saw it working with XAML the other day) and that is that you can make changes to C# code while debugging. No need to stop debugging, make the change, and then start debugging again to see if the code worked. I can't quantify how much time that will save but I know it will be a nice chunk of time. There were a few other changes that were discussed like faster performance, no csproj file needed, and more. I am excited to take a look at everything else that can be done!

Next, User Story Mapping with Philip Japikse. I don' have many notes on this session but there is a reason. Philip actually made us be social and do an activity in groups of six to eight. By group activity I mean that we all had Post It notes to develop a story of getting up in the morning until we left for work all without talking. We did it without talking so that no one person become the Alpha and took control. We had to work through the entire process of making the story and then deciding what we didn't have enough budget for to complete. We create stories at work, but we are usually given the stories and epics that will be completed. It was a fun process and I hope to be more involved as I progress in my coding.

Third was XAML Antipatterns with Ben Dewey. Very informative! Ben showed the "Seven Deadly Sins of XAML." I hope to be able take what I learned and not commit any sins. The seven sins are:

  1. Thou shall not us Incline Formatting. We wouldn't do it on a website, why do it on the XAML?
  2. Thou shall not use hard coded colors. Oh the pain if you decide to change your corporate colors and you need to go find all the places the color was used.
  3. Thou shall not use bitmap icons. Think about scaling and clarity.
  4. Thou shall not set properties manually. Less code and not code behind.
  5. Thou shall not duplicate chunks of XAML. Take code and move it to a user control.
  6. Thou shall not wrap content repeatedly. I will be honest, I didn't fully understand this one. I need to research it more.
  7. Thou shall not use absolute positioning. Think about window resizing and how that will impact the view. You never know how a person will be viewing your app.
Great session!

Then Brian Noyes talked about WPF MVVM in Depth. We use MVVM at work and I went to this session to help gain a better understanding of MVVM and hopefully the why behind using MVVM. I learned that some benefits are it is maintainable, testable, and extensible. I have seen all three benefits at work, but I need to spend more time in the code to fully understand how this is accomplished. Brian told us about the different responsibilities of the Model, View Model, and View. I kind of understood before, but he helped me understand better why we would want to use each. He also talked about View-First and ViewModel-First. I am not sure which one we use at work or not sure exactly how to implement one of them. More reading for me to do.

The LAST session I attended was Readable Code with John Papa. John was a very good presenter full of funny gifs and funny sayings. Beyond the funny, John presented some really gems to take back and use. Some of them we already use, but it is always good for get it reinforced. I like a little piece of wisdom that John gave us. That is essentially that we need to write bad code to make it good. We have a chance to clean it up before the review, but all code starts bad. We then need to ask "Why" to everything. If we can't answer the question of why there is probably something missing or another way to write the code.

Closing remarks were good. There was a panel of the presenters that answered questions anyone might have. It was a nice closing session and good to get more candid answer from the speakers. I hope that I get another great conference experience next year and I hope I have more coding experience when I attend. Thank you Visual Studio Live! I hope to see you next year.

Wednesday, November 18, 2015

Visual Studio Live! Day Two Sessions

Another day down and another day of learning and hopefully I have learned how to hit publish and actually put a blog post out to the interwebs. I picked better sessions today, I didn't feel so overwhelmed and felt like I had a better understanding of what the presenters were discussing. Well, that is except for the dependency injection session I attended, but at least I was not like a deer in headlights like I was the first time I heard about dependency injection.

We started out with a key note by Don Jones and Brian Randell about DevOps. I am seeing a theme, DevOps is an important topic. On Monday I attend the Triple D session where we spent a lot of time talking about DevOps. There are numerous sessions on DevOps and there was today's key note speech on the subject. I agree and it isn't just something we will talk about today and not hear about it anymore. A lot of what they discussed we heard on Monday during the workshop. One new topic was an expansion of the why. There were two main reason: 1. Clients will get the product faster and will be happier (faster bug fixes) and 2. The competition may already be doing this and will have quicker time to market. If they deliver faster, how do you keep up? We have to adopt DevOps to remain competitive.

Next up, let's Write a Windows 10 App: A Basic Introduction to Universal Apps with Billy Hollis. I enjoyed seeing Billy earlier in the week and today did not disappoint. Billy has an entertaining way of presenting and is able to keep  The session was very helpful and although I do not code much in XAML (we have two applications that use it and I only code when we have bugs) I feel that I took away some good bits of information to help when I do code in XAML. Billy showed us some great tricks in XAML and showed some basic examples like how to do some layout. He kept reminding us that XAML does what it is told and each element has one job. A grid won't scroll, you have to had a scrolling control if you want i to do that. He showed how to get a tab like feel in Windows Universal App (after all that is where he was focusing with the XAML examples) and showed us other things such as data binding and data templates.  More things for me to take back and look more into.

I decided to stick with Billy and do his next session called Designing and Building UX for Finding and Visualizing Data in XAML Applications. First thing Billy told us is that he doesn't write too much XAML anymore. He uses tools to help him write the XAML. The tools have come a long way and provide much better XAML without much need to write it on our own. Billy showed us a cool cattle management app with smiley faces to show how the client feels. Better than a score, everyone knows what a frown means! How do you accomplish that? ScaleTransformations (along with layers). Really cool idea and I hope I can take it back and use it in our apps. Fluid movement behaviors when resizing windows, get the code from Blend. He gave us ideas on a lot of cool transformation ideas and tools to help with XAML coding. There are a lot of cools things that we can do to make apps look awesome.

I attended another session about Xamarin. This one was called Stop Creating Forms in Triplicate - Use Xamarin Forms with Matt Milner. I felt Matt spoke much more on my level from the session I went to yesterday. I learned something I hadn't heard about Xamarin, if you don't have a Mac it is hard to develop in iOS but if you have a Mac you can develop for both iOS and Android. Anyway, Matt went through an example of a cool Nerf gun inventory app, probably used to make sure his boys aren't hiding any of the guns. He showed how shared code can work on both Windows and Androids phone (emulator of course). It is pretty sweet how the Xamarin is able to take the same code and make it look like a native app on both platforms. Of course, it isn't 100% and you have to make some changes for the different platforms. He showed us how to do that. It is all a question of if the defaults work, or how to get the appearance you need. With each app you need to ask, which is right for cross platform, Cordova or Xamarin?

Then we go on to the dependency injection session. This was presented by Jeremy Clark and was called DI Why? Getting a Grip on Dependency Injection. Now we had talked about dependency injection at work once. In that discussion I didn't understand a word that was being said. So, I thought take the session with Jeremy and learn some more about it. After all, it was made as an introductory class. I still felt confused, and that is not Jeremy's fault. I walked away and talked through why I was still confused with my coworker, Peter, and started to clear some of my own questions by talking through why I was confused. Jeremy was great and Peter helped clear it up. I think I need to use dependency injection (luckily we already use it at work) to get a better feel for the how and hopefully help me with the why.

We finished the night with a Luau Dessert sponsored by Amazon. It was a fun time. I talked with a few new people and had some dessert. A good way to finish the night. One more day of sessions!

Visual Studio Live! Day One Sessions

Apparently I forgot to publish this yesterday. Major FAIL.

Another day down at Visual Studio Live! It has been another great day, The key note speaker was good this morning and the sessions were good. I may not have selected the best sessions to go to, but that is on me and not the presenters. Hopefully, I will choose the correct sessions tomorrow.

The key note speaker, Jay Schmelzer, started the day off with a speech on The Future of Application Development - Visual Studio 2015 and .Net 2015. Microsoft has added some great features in VS 2015 and .Net 2015. I think one of the biggest moves is the cross platform support and development that is now available. A few different partnerships allow this, Zamarin and Cordova. Another feature I thought interesting is the ability to enforce your own code standards. Pretty cool!

A feature I think will help when deugging issues is the new time elapsed shown in the right in the coding window. Not more finding the stop watch in Google! Oh man, there are more enhancements and awesome enhancements. I can't wait to start using all of them and actually being able to understand them better (I wrote down more enhancements in my notes, but was in so much Aw I didn't write down all the needed details and I don't want to screw up when the changes actually work). I have VS 2015 installed and am excited to use the enhancements.

The first session I went to was A Tour of Azure for Developers with Adam Tuliper. I should have read the description and title a little more but we are exploring options with Azure at work and I thought the session would help. I learned a lot about Azure and that there are a lot of services provided by Azure. The session was pretty much talking about Azure and what you can do with Azure. There is a lot, so I have a lot more reading to figure out how to use Azure and the services that will be useful to use.

Next up, From ASP.NET Site to Mobile App in About an Hour with Jordan Matthiesen. This was one of those great sessions that talked about how to integrate already working HTML/CSS/JS code and use Apache Cordova to migrate it to an app using full screen Webview. The app detects when the user is offline and then decides how this should be handled. There are different options like having a note appear that says, "Sorry you are offline. Try again later", using App Cache, IndexedDB, or WebSQL. Not all options work with all the different platforms (and I am sure I missed some of the options Jordan mentioned). What it comes down to is selecting the correct service that works for the platforms you need.

I then headed to Defensive Coding Techniques in C# with Deborah Kurata. This was a great session!
What is defensive coding? Exception Handling, what not to do, well defined interfaces, expected behaviors, clear intent, best practices, and I am sure the list could go on and on. Deborah mentioned quality, comprehension, and predictability. The short version (I took the most notes at this session):

  • Clean code is easy to read, clear intent, simple, minimal, and thoughtful. 
    • Clear purpose
    • Good Name - Reflects purpose
    • Focused code
    • Short length (only as long as it needs to be)
    • New features in C# 6 help make code clean (or does it?)
  • Automated testing, well...this makes sense. Testing your code is good, and if you can automate it, all the better! Methods need to return something so they can be tested
The last session I went to was Reusing Logic Across Platforms with Kevin Ford. This is the one that I feel was the most difficult for me to understand. I don't understand patterns as well as I should have to attend this session. It is good to have a reference to the patterns so I know what is available and maybe I will have a light bulb come on when I understand this. Kevin was good and discussed cross platform depends on what the user expectations are. He talked about using Zamarin and that we need to look at when it makes sense to share code and went into some patterns to help share code and where they are all different. I will be revisiting the notes to this session soon (I hope).

That was the day! I ended it by eating at CowFish (a sushi burger fusion thing)

Monday, November 16, 2015

Visual Studio Live! Day One

Wow! This is my first conference post college. The conference I am attending is Visual Studio Live! It is exciting to be hear so I can learn about Visual Studio and more! Not only that, this is my first coding conference and so short after starting to actually code. This event is a Live! 360 event and contains information and sessions around SharePoint, SQL Server, Modern Apps, as well as Visual Studio. Most of the sessions I signed up for are Visual Studio related, but I can go to non-VS events and there is so much to learn. Any session will be very beneficial to me.

Today was a workshop day. The session went from 8am-5pm. Seems like a long time but the time flew by and didn't seem long enough! I went to session Triple D: Design, Development, and DevOps presented by Billy Hollis and Brian Randell. Both seemed to be very knowledgeable to talk about the topics.

Brian started by asking what we thought of DevOps and what that meant to us. This was great timing as we have talked about DevOps at work and how we can move towards better and more DevOps along with continuous deployment. To fully achieve DevOps we need to change our vocabulary and make sure our processes fit with the way we deploy. A few things that were mentioned is automating infrastructure, share a vision with ops, and one step building and deployment.

So, how do we achieve that? Brian said, "You do not buy DevOps" and that you have to implement it from the top down. I believe that 100%. Those working in the DevOps must have the correct mindset and willing to work towards the deployment. We are lucky! We already have some testers and developers that know the importance of getting DevOps correct and what it will take to deploy in the end. One top of that, our managers know we need to move towards better DevOps and are willing to take what is needed. Engineering owns features from end to end (although the development team does not own the deployment in most circumstances, but it still stays in Engineering).

I am excited to continue improving DevOps at work and hope we can fully implement the continuous deployment.

Next Billy talked about UX and design! A few posts ago I actually talked a little about design, looks like I think about the correct things sometimes. Billy focused a lot on UX and how the correct amount of time in designing the UX will increase flow and productivity. Not only do we need a good UX we also need to get feedback and data about how the UX is actually being utilized.

"When you start UX design, you'll suck at it." - Billy Hollis. There is a lot that goes into design and UX and every company needs it to keep customers happy with the products that are delivered. Billy discussed some of the theory behind the best designs and I am sure he could teach an entire course on the best and worst designs. We can't just make it pretty by adding makeup. It doesn't matter how much makeup you add a bad design will still have the ugly elements.

There is so much! We then discussed the new builds on TSF. There is a lot to learn on what can be down and how to utilize the new build server.

The key note speaker was Mary Jo Foley. She gave a very candid view of Microsoft and the direction we might see them take. We got a little history, a little speculation, and a lot from a reporters point of view.

It was a great first day. Tomorrow we start the sessions and I say, bring it on!

Thursday, November 12, 2015

Uh...wish me luck?

So, the last game I created wasn't too difficult. Especially since all the code needed was given to me in the chapter. Now I am on a section they are calling a lab. It is a lab of the prior four chapters. I am being told that I should know everything I need to so I can code this "lab."

I am just diving into the coding and there are a few new items, but I don't think I will need any new code. This will challenge my knowledge and make me really think about what the code I am using is actually doing. Hopefully I can code this correct without the hand holding (or answers directly in front of me) of the book.

Let's get to pushing my knowledge and hope this is a good learning experience and I hope to have "A Day at the Races" coded soon and posted on the blog...

Thursday, November 5, 2015

An addendum to My First "Game"

I received a comment on my last post from Edhika stating that there was no way to restart the game. What kind of game makes you close and reopen in order to restart and go back to the beginning? Not a very user friendly game. Now, I could have said, that is what the instructions told me to do.

I decided to take the challenge and try to make it so the game "reset" after the game was over. Actually, I took it a step further and made it so you can restart the game at any time. I am not sure why you would want to start over in the middle, maybe it is getting to fast, or you didn't like how you were doing on that "level." At any rate, you can now start over at any point in the game.

It wasn't as difficult as I thought it was going to be. I ended up adding a message box to give you some stats and how to restart the game. I added an if statement that checks if the key pressed is Enter. Once that key is pressed I put a new function called startOver in my Stats class. The function resets the data, difficulty, and restarts the timer at 0.

Pretty simple, right? It didn't take me very long to figure out what I needed to do, but it got me thinking about another aspect of coding which I have not been involved in much. That is the design sessions to determine what needs to go into a program.

The book gave you directions on how to get a very simple game. I can understand that adding the function to restart the game would have been a couple more pages of code and writing and maybe it didn't fit in at this point in the book. At the same time, I didn't do anything new in order to reset the game. Everything I used and put in addition had been written about in the prior changes. The book really likes to use message boxes so creating one is ingrained in my head.

If this were a software company designing the typing game it never would have been shipped. There would have been meetings with all the smart people that are involved in the creation of the end product. Maybe one person didn't think about adding a "reset button" but another would have thought about it.

I have only been involved in one design meeting at work. I have said that I fix bugs at work, which I do the most of, but this was one of my first new features I added. It was a fun meeting and we came out with a great new feature, a button that reruns SSIS jobs. Well, my enhancement lasted about four weeks before another and more experienced coder ripped out the rerun guts and made it better. I know there was another design discussion because the changes were very significant.

Short story, a nice comment on my last post made me realize how important design discussions are and how they are needed. I know my "game" still isn't perfect, but that is why all software has new versions come out. Here is version 2 of the typing game. There are still the same limitations that I shared in the last post.

I also made the game too easy if K.C. can get 100% on 80 keystrokes! Maybe the next version will be more challenging for you.

Tuesday, November 3, 2015

My First "Game"

Well, my C# book tells me I have learned enough for them to guide me through making my first game. I have done it, and it appears to be working! It is a typing game that progressively gets harder as you type the correct letters that appear on your screen. It is a really simple game, and uses some of the knowledge I learned in the first 4 chapters of the Headfirst C# book.

All of the steps are provided to you, so all you have to really do is follow directions. It took me about an hour to create the simple game, but I like to think about each step to help me remember what I did and why I did it. I will be honest, the game did not work flawlessly once I first debugged the game.

Perfect! I was given all the directions and the game doesn't work! After six correct key strokes I would get an out of range error. Either I missed a step or the book gave me incorrect directions (I would hope editors would find this before printing). Turns out I missed a step. Well, it wasn't a step, but a side window with a note telling me to set the difficultyProgressBar maximum to 701 while the default was only 100. I have a method in the game that after each key stroke would increase the difficulty. Well, after so many key strokes it tried to increase the difficulty above 100 and *bam* the game explodes on you.

Luckily, I was able to track down the error and fix the game relatively quick. After I fixed my error I went back to make sure the book told me to take this step. Right there on page 162 at the bottom right corner was the little box stating to remember to do this maximum update along with two other steps. I did the two other steps so I am not sure how I missed the maximum update.

I am glad I missed the update. It helped reinforce some practices that we do at work. That is, we should be testing our own code before shipping or checking in. Sure, the game worked but only for a few key strokes. It built just fine and I would have been able to ship the product. However, it would have come back and blown up in my face. "Look, Robert can code a game, but he doesn't know how to debug and fix errors before shipping."

Other pieces I noticed in the game:

  • The letters shown are all capital letters, but if you type a capital letter back it counts it as and error. I did not debug or fix this one. Maybe I will try that tomorrow morning.
  • I have linked to a zip file that has setup.exe included. Anyone can run the game and see what an awesome job of following directions I did. This will install into your computer and the program can be removed by uninstalling TypeGameChapter4


Next up in the book is a "lab" which gives me a goal, but does not give directions like the previous game. Let's see how it goes!

Get zip file for typing game here!

Thursday, October 22, 2015

Where does the time go?!?

Wow! A week sure comes...and goes. I missed my deadline a couple of times. Now, why did I miss the deadlines? I have a few thoughts on that.

First, I am taking time on my own to read and learn about C#. There are so many different ways to approach C# that I am finding it hard to really focus on one aspect of programming and C#. That is something I need to work on.

Second, I am not making progress as fast as I would expect myself to be making at this point. I am reading a book called "Head First C#" by Jennifer Greene and Andrew Stellman and it is helping, but I don't feel I am setting enough time aside to make a real dent in the book. I am barely getting to the end of the fourth part where I am finally making my first program. I started the book two months ago (that is a guesstimate).

Third, I have a list of topics to write here, but I don't feel like an expert, yet. I am one of those people that takes time to analyze and only speaks up when I know for certain I have the correct answer. That isn't always the best place to be in. Maybe I should write about those subjects, be wrong and then have someone leave me a note setting me straight. I would learn to fail and fail fast.

At any rate, is writing a blog about programming the right thing for me at this time in my life? 

Tuesday, September 29, 2015

I'm not as smart as I used to think I was

College is great. It gives those an opportunity that may not have otherwise been able to succeed in the world. I thought my opportunity to make money would be by getting a degree in finance. After all, I though the world revolved around money and the way to make money was in the financial world.

I was pretty good at finance. It came pretty easily to me and, if I am completely honest, I did not have to work very hard to get A's in my classes. Naturally, I found a job working for a large financial firm in the operations department. It was a good job right out of college and used the skills and knowledge I had acquired over the last four years (okay, let's be honest, I took five years).

Again, the work came easy to me. It never really challenged me at a level I would have liked from work. So, I made my own challenge. I was doing the same processes over and over every day and felt there had to be a better way to accomplish the same work without the manual processes done multiple times. I had always been a fan of Excel and started looking for a solution to my problems.

I found Visual Basic for Applications (VBA). It worked perfectly. It also added a challenge to my work, finding a way to automate the mundane work I was doing. This expanded to helping other teams do the same. I wrote many new applications to help in others daily work and learned a little about coding along the way.

Well, I got bored and wanted a bigger challenge. I left the financial world to take a shot at using SQL. Lucky for me (although I didn't think that at the time) the first job I got after leaving finance was at a terrible company. Management was bad the position I was in was not defined well and was not a position that seemed important from others around. I left after a short time to use more SQL at another financial firm.

My college years made me think I could do anything and all the roles I had been employed in did not challenge me to a point where I felt I couldn't do something. Well, after I got experience in SQL I wanted a larger challenge and got a job using C#.

Earth shattered! Well, not really, but I discovered that I wasn't as smart as I thought. I actually had to work at something and it doesn't come easily for me. Object oriented programming was a much harder challenge than even all my classes put together in school. Google has become my best friend. I spend a lot of time searching for my answers. I am no longer the top performer (I had reviews almost every year that showed my peers rated me this way at my first job).

A lot of learning to go.

Monday, September 21, 2015

Programmer Blog

Well, if you have ever read my blog before you know that for all of my prior posts, except one, I told you about my life or thoughts of the day. For a while I was using the blog as therapy after my head injury. Looking back at those posts I realize how much therapy I really needed back then (and maybe still today). The one blog that I used to show my programming prowess (or lack thereof) was to give the world an Excel time tracker I created. Okay, saying it is for the world is over stating those that actually read my blog at the time. Of all my posts, the Excel post was the most viewed post.

I am not saying that a spreadsheet was more important than the brain injury I sustained in Mexico and the work it took in order to get back to my normal self. Perhaps it shows that I got better at writing the content in my blog. It could also mean that I used words that were a better hit in Google and the blog was higher in the hit list for readers. Or, really it was that I figured out how to show the post on the fun social site Facebook.

At any rate, I discovered that a blog can be a good medium for getting information across, be it information about me or the coding adventure I was trying with VBA. I have done a number more coding projects since the Excel time sheet. In fact, I created the time sheet while working at a financial firm. My position had nothing related to programming. I just took it upon myself to teach myself VBA. Maybe I was lazy and was tired of doing the same processes over and over or maybe I had the mindset of creating more effective work flows. Either way, I started to learn coding.

Now I am in a position where I code part time. No longer do I use VBA to code. I spend a large amount using C# and any other language my work uses. This is very difficult, I don't have a programming background. The fact is that Google and I have become best friends.

In my searches in Google, I found a blog site that I found interesting. The blog is called Simple Programmer and  provided some great ideas about programming. The blogs don't necessarily tell one how to program but practices that could apply across any job (just change the idea a little bit). One of the blog posts is entitles "How NOT to Email Famous People." I don't even know how one finds famous peoples email addresses. I guess perhaps you just try every combination of their name and add @gmail.com. I am pretty sure everyone has a gmail address, unless of course you are stuck using your AOL email address from the early 90's.

John Sonmez (the blog author) provides a blogging course that will help you advance your career. That is why I am re-purposing my blog. I am not writing as much as perhaps I should, but I wanted to help solidify my learning of C# and the frameworks we use at work. I may not post anything earth shattering, but I hope that I am able to help someone that reads my posts and learn something myself. I am going to put my schedule out there...once a week. Now hold me to it. We will see