Thursday, October 27, 2016

DevIntersection - Day 4

It was another day filled with learning and sessions. We started the day talking about a topic that everyone needs to pay attention to, Security. Cyber security needs to be our number own priority and it can no longer be a perimeter security, we need to take security to the identity level. Almost all security breaches have come from credential leaks. There are so many tools that Microsoft, Google, and Facebook have created to help in the area of security. We should try to take advantage of what they have already built to help with our own security. We need to build security that both satisfies our IT departments, but also the customers/users. This may be hard at times, but is usually do-able. Microsoft has taken some great steps and is able to determine if you are able to paste from word into outlook based off the word document and the email address you will be sending from in outlook. If it is a work document in word, you will not be able to paste to a non-work email sending address. pretty neat stuff.

The next session I went to was called Application Debugging with IntelliTrace with John Guadagno. I will be honest, there weren't many notes that I took during this session. He did mention that his slides should be posted and that his speaker notes would be really helpful. Here are some notes that i did take. A few quick notes on IntelliTrace:

  • Allows you to record events and method calls for your application. The black box for your application. See Key events and see what it is doing throughout the lifecycle. Will also keep values of variable and objects.
  • Allows you to examine its state at different points in the execution.
  • You don't have to have Visual Studio installed and can just have a collector on the machine to see what is going on

IntelliTrace can collect many different events. You can configure what to collect and save the environment to be used later or with certain projects. It can collect:

  • Debugger Events - Value in local window, auto window, and data tips
  • Exception - handled and unhandled
  • .NET framework events
  • Function name
  • Values of primitive data types passed as parameters as function entry points and returned at function exit points
  • Values of automatic properties when they are read or changed
  • Pointers to first-level child objects, but not their values other than if they were null or not

The tool seemed to be really helpful if you don't have Visual Studio on a machine, but you need to see the steps that were taken to get a certain error. I could see this being useful when we have bugs on client computers but cannot reproduce the bug locally. Install the client and see the variables and steps that were taken on the clients computer. Now we just need the clients to allow us to install on their servers...

The next session I went to was Enabling DevOps in the Cloud with Steve Lange. It was great to see that most of what Steve talked about we already do at work. He mostly talked aboutt he tools that help get to DevOps, which were Microsoft tools as he works for Microsoft. He discussed using VSTS and all the tools available through VSTS. All of which we already use. I did learn about extension called the Test and Feedback extension that allows you to record the steps you take through a browser and enter a bug directly into VSTS. Pretty nice tool.

Steve also talked about Azure App Insights (can be used by non-Azure apps to get data and do analytics on the apps.

I then jumped around from The Intro to Xamarin and ASP.NET MVC - Development to Deployment. Neither one of these sessions provided any real new information. The Xamarin session was talking about how to load Xamarin onto the your computer, but wasn't about creating any apps.

I then went to ethe ASP .NET MVC class. This was maybe a mistake. I walked in and was a little lost on what her was talking about. there were pieces that I did know form working on our applications at work, but it seems I should have been in the session the entire time.

We finished the day with a key note on Angular 2. It was called Angular 2: Released, Greased, and Increased. This was a repeat of what I was told on Monday and Tuesday in the workshops. Really, the only new information was how come Google took the direction they did on Angular 2 and the performance benchmarks they used to increase the speed of Angular 2 (which is much faster then Angular 1)

Tomorrow is the last day. I hope the sessions are great and we get to end strong.

Wednesday, October 26, 2016

DevIntersection - Day 3

Today was the first day of the sessions at DevIntersection. It started with a keynote session by Scott Guthrie of Microsoft. The title of the talk was "Movile-first, Cloud-first Development." It was a good speech by Scott. I always feel the keynotes are more about a quick glance of what the speakers can do without much team to show you what was done. I guess it leaves questions and will have you go experiment more on your own. Microsoft is coming out with some great products and I will definitely look at more information on the Microsoft products.

Then the sessions began. The first session I attended was Understanding the Windows Desktop App Development Landscape by Brian Noyes. The first topic, the mortality of the different UI frameworks. The question when looking at the frameworks that we need to ask is, what do we consider dead vs. matured. The different frameworks may be at different stages in their lives. The frameworks we currently have:

  • Windows Forms - Many will think that windows forms are dead. There are many projects that are built on Windows Forms and should not just be dropped due to thinking Windows Forms are dead, just mature. Forms are just mature. However, Brian would not start a new project using Windows Forms.
  • Silverlight - This also not dead...yet. The browsers are the ones that are killing Silverlight. It is not yet yet, but it is in the trauma unit on life support. Definitely do not start a new project using Silverlight.
  • Windows Phone - Bloodied on the battlefield. Survival: questionable. Only time will tell.
  • WPF, UWP, Xamarin, Single Page apps are all alive and well.
WPF is mature, it has been around for almost a decade. In computer time this should be gone. However, it still lives on and probably will for a long time to come. There are many features WPF that are great. Some of them:
  • Data binding validation
  • Implicit Data Templates
  • Dynamic Resources
  • Custom MarkupExtensions 
  • Multi-Bindings
  • and more!
UWP allows you to develop for many different platforms, like the desktop, mobile, and XBox. Great for touch, pen, or keyboard/mouse. UWP provides a better app security and provides isolation from other apps on a computer. You are able to sell these apps in the Windows Store. Great features available such as:
  • Cortana integration
  • Low power consumption
  • Ability to move apps into UWP using wrappers
Xamarin is a great crossplatform tool using C#. You can write an app and share it across platforms including iOS and Android. The logic code can be reused across platforms and only UI will have to be written for each platform you would like to include for your app. Finally! Windows can develop for iOS (although to develop for iOS you still are required to have an Apple computer).

Single Page apps are cross platform are well. All they require is a browser. This can be written in HTML, CSS, or Javascript (hey! My workshops were about typescript and Angular 2 which compile into JavaScript!). The single page apps can use the same architectural patterns as a well designed XAML desktop app, just using different syntax. With a responsive design you can create an app that will work on desktop and on mobile web browsers beautifully, or at least sufficiently.

The next session I attended was How to Be a Good Community Member by Contributing to OSS with Brian Clark. Apparently, I like the sessions by the Brians. Throughout college I was involved in the community and did many hours of community service. Open source allows companies to use their products/frameworks for free. Why would anyone want to do this? They probably build something they needed to solve a problem and sent it out into the world for consumption. Should companies pay to use open source? Maybe the payment should come in the form of allowing employees to contribute on work time (my own thought, not own that Brian brought up).

Well there wasn't much I didn't already know or think in this session. It actually was a shorter session and we got out a little early. I think the main take-away from this session was the resources for doing your first contribution to Open Source. Below are some resources shared:


  • github.com/code52 - starts a one week project that is easy to jump into at any point
  • upforgrabs.net -
  • firsttimersonly.com - aggregate certain projects
  • yourfirstpr.github.io
  • issuehub.io - allows you to focus on the language you are looking for
  • github.com/mungell/awesome-for-beginners

Things to think about before starting on an Open Source project: the process for the project, the rules, what are the guidelines of the project, is there a code of conduce, can you run the project locally, is it in a language you are familiar (maybe you don't want to stretch on your first pull request), and more.

Really, think about the project and find one that fits for you to contribute. Communicate with the team and make sure they know who you are and what you are doing. And, start simple to get your name out there to allow people to see you can be trusted and you do work well with others.

My third session was Create an Angular 2 app from Scratch with Dan Wahlin and John Papa. I probably should have skipped this session. It was much like the workshop I did on Tuesday. I hoped that they would start from a blank sheet and add everything we needed. Well, they started with a project that already had the needed files for an Angular 2 app to start working. In fact, they already had a page, Hello World that would pull up. I stayed to see if any new information would be given. There was no new information and I was disappointed. Still Dan and John did a good job.

The final session I went to was Automatic UI generation in .NET by Mark Miller. Mark is a great presenter and had a lot of, shall we say, love for UI. There was a lot of code that Mark had done before the session. He then went through what the code he put in before did, and showed the code a little bit. The dynamic response of the UI is pretty cool and what showed was dependent on what you clicked and the properties on the UI. It was nice to see, I just wish he would have gone more into the code of how to build the responsive UI. 

Onto the sessions for tomorrow. I hope I pick a good set of sessions.

Tuesday, October 25, 2016

DevIntersection in Las Vegas - TypeScipt, ES6, and Angular 2

Last year I started my Twitter account while I was at Visual Studio Live! in Orlando. I blogged at the end of each day. I meant to do that this year while I have been at DevIntersection in Las Vegas this year. We got to Vegas yesterday for the pre-session workshops and will be here until Friday. There is a little different feel in the Las Vegas vs Orlando environment, but I am not here for the city, I am here for the conference.

Day 1:

Yesterday I went to a session called Making the Jump to ES6 and TypeScript with Dan Wahlin and John Papa. I thought this was an ambitious decision as everything I have done has been done in C#. I was afraid that I would not be able to keep up or understand what was being said. I was in for a pleasant surprise! I was very surprised at how close ES2015 and TypeScript have many features that are very similar to C#.

First, John and Dan talked about the tsconfig.json file and how you can set sourceMap to true in order to enable debugging in TypeScript. How do you get TypeScript to work? You transpile TypeScript to JavaScript or ES. You want to use ES2015? Transpile your TypeScript to ES2015 and you have ES2015 version of your code. I guess the good news is, that if TypeScript is ever not supported, you just transpile it to ES2015, or ES5, or even ES3 if you wanted.

We then started talking about ES 2015 and some of the features now available. These are not all the functions available but the main ones that were covered. I understood most of these. Maps/Sets are like dictionary pairs you can use so that you no longer have to use arrays and splice and slice the arrays. Maps store a collection of key/value pairs with unique keys. Sets can store a collection of items where the items must be unique.

What about those classes? HEY! I use those all the time in C#. There are some that probably don't like this, but it sure helps me understand what is going on in TypeScript. And those Arrow Functions look real familiar! A few weeks ago (maybe two months, who knows) I learned about LINQ  statements and Lambda funcitons. The Arrow functions look close to the same as LINQ statements

Other features we talked about template strings (embed a variable in a string literal), destructuring (create multiple variables, along with their values, in one line of code), default parameters, and rest parameters. All look close to stuff I have done in C#.

We then went to a TypeScript playground at http://www.typescriptlang.org/play/index.html which allows you to type TypeScript and immediately get the JavaScript equivalent back. We then went into types in TypeScript. For example, you can now go:

var age: number = 5;

This will set a new variable age of type number with a default value of 5. Very similar to how variables can be set in C#.You can also used inferred types, where the variable will either be a type any or the actual type if TypeScript is able to infer what the type should be. You can do Enums, again similar to C#.

The next piece I liked talking about where the classes. They  classes look just as they do in C#. Helpful for me!

One piece I really liked in the auto generated properties. These are a little different then auto properties in C#. For TypeScript you create the auto generated property in the constructor. An example:

class CoolCode {

  constructor(public greeting: string)
   {
      this.greeting = greeting;
   }
}

This creates the property greeting in the class CoolCode and also has the value of a string in the constructor called greeting. You can also create gets and sets on properties. This is almost the same as  and auto property in C#. Here is an example in TypeScript:

class Address {
  _houseNumber: string = 0;

  get houseNumber() {
     return this._houseNumber
  }

  set houseNumber(houseNumber: number) {
    this._houseNumber = houseNumber;
  }
}

You can now do class inheritance and interfaces just as you can with C#. In order to use inheritance you need to use the keyword extends. For interfaces you have to have a class with the key word interface and then your class that is implementing the interface will do something like:

interface KillerGame() {}

class AwesomeGame implements KillerGame{}

Other things that are similar to C#:

  • Generics are now available
  • You can know use namespaces - if you use modules do you still need namespaces?

Day 2:


Today I went to Building Single Page Applications with Angular 2, again by Dan Wahlin and John Papa. The discussion started with the differences between Angular 1 and Angular 2. Since I have never used Angular 1 I did not have any reference. They then touched on what we had gone over the first day in the TypeScript and ES6 workshop.

There was not much more added from what we learned in day 1. We used a tool called Plunker (in order to avoid having to get the correct setup on all the machines in the room) to enter TypeScript and use Angular 2. What was added to our knowledge for Angular 2:

  • How to build components - importing and exporting
  • Creating and using templates
  • Angular Modules
  • Binding and Directives
  • Services and Dependency Injection
  • HTTP and ReactJS
  • Routing
Ok, I type it out and it is a little more then I thought. This post is getting really long already, maybe I will have to write another post after I have been able to research them a little more. The workshop today was nice, but they moved so quick that I would like to understand them a little better.


We went through many examples using TypeScript from the day before to create/change single page websites. Of course, we started with Hello World and went from there. I learned today that Dan and John went pretty fast while editing the code and a few times I fell behind getting to a state where my pages weren't working. Luckily, they would save their Plunker and I was able to get to a good state before we moved on too much.

In addition to examples from examples using TypeScript from the day before, I got to learn a little HTML. I did HTML years ago in a college course but nothing big. It was nice for a little refresher.

We were pointed to a tutorial on angular.io that will help getting more familiar with Angular 2.

Thursday, September 22, 2016

The progress I make...and forget to blog about

My great friend and co-worker posted a comment tonight asking when I would finish The Quest and post it for all to see. Well, I have been sitting on it for a while. There are some bugs and I moved on in the book thinking I would go back and fix the bugs. Overall, the game works. Some places it is easier for the player and other parts are harder for the player.

I believe I can find out why I have bugs and how to fix them, it is just about finding and taking the time to debug and fix it. Lately, I have been taking on bugs at work and debugging which has given me great experience on what debugging looks like. While fixing the bugs I have learned pieces of C# and .Net that the book hasn't talked about yet.

One example is that while testing and fixing bugs in our API I have learned how to use LINQ statements. In the book this aren't mentioned until chapter 15. By the way, I am now in chapter 10 which is further then I got before in the book. It is amazing how much LINQ statements help. I understand at the surface, but will save trying to describe them until chapter 15.

Chapter 9 talks a lot about streams and how to interact with files within a program. When you are using streams make sure to close the stream or you may lock the file. That can cause problems. Hey! There is a great way around having to remember closing the stream. You can wrap your stream in a using statement. (These are different from the using directives at the top of your files).

You have a lot of If/Else statements? There is an easier way to do this! Use a switch statement. Switch statements provide a mechanism for writing the variable to check once and then say what to do with each different possible output of that variable. Switch simple example:
switch(variabe)
{
case enum.value:
// code to happen
break;
case enum.value2:
// code to happen
break;
default;
// code to happen. Case statements can have the default case which will apply if none of the other cases apply.
break;

}

I also learned about serializing and deserializing your files. Serializing is like flattening your output so it can be desearialized (reanimated) later. Opening a serialized file and trying to read it is...well...impossible for me. It writes it in Binary. Actually, just write a stream reader that deserializes the file and there you go!

I ran into a collision of work and my book while reading chapter 9. At work last week, I was debugging an issue and my team lead asked if I knew what an attribute was. Deer in the headlights. Okay, not really, I did fess up and said I wasn't sure what those were. So, Ben described them to me and walked through the example in the code that we were seeing the issue. A few days later that exact topic came up! Dear Headfirst C#, I actually already knew this before reading! I felt knowledgeable! I may feel that way when I get to chapter 15 too!

Chapter 10, exceptions. I have only read the first couple pages, so not much to report here.

Brett, here is the buggy game The Quest. The github repo is located on my general github.

Hey if you need an excuse manager for work on why you can't come in, chapter 9 has you create an excuse manager so you can remember what worked with your boss and when you last used it. Get your very own excuse manager here!

Sorry for the long read. No excuses, they never go well with the readers...

It is better to offer no excuse than a bad one. - George Washington

Wednesday, August 31, 2016

Second Time through the Quest

I just wanted to put an update out there. It has been a while since I posted, I procrastinate and if you have read any of my prior blogs you already know that.. I keep telling myself not to do this, but old habits are hard to break. Plus, I listened to a podcast today that mentioned procrastination can be good in some circumstances....posting a blog? Maybe not, but hey, let's go with it.

Anyway, the update. I am almost done with the Head First C# second lab called the Quest. If you will recall, I got frustrated last time and moved on. This time, I am getting closer. I am almost to the point where I could run the program and test what is happening in it. Maybe by the end of the week I will have a version of the game that I could post...I'm trying! (Okay, maybe not the end of the week, the first football game of the season is tomorrow so I am missing one night)


Wednesday, August 10, 2016

The joy of a pull request

Well, I have finally stopped doing most of my work for the old Sustaining team. I am now doing most all of my work for the Core Services team. That means I am writing code and tests. This week I have been working on writing acceptance tests that will test our implementation of a rest API.

A few things. I have been doing some Pluralsight videos to try and understand what it was we were actually implementing. I think I have a better understanding of what and API is and how we are actually going to use it (although there is always more learning I can do on this topic).

Next, acceptance tests.I have never written acceptance tests and needed to understand what acceptance tests were and what they test. Happy Path. You know, make sure the code is doing what we expect without the weird scenarios (other sets of tests should make sure that these scenarios are caught).

On to the writing of tests! Well, it was more pairing with one of the developers on the team for the first few tests (get, post, and patch) to make sure I understood the framework and what I was doing. After working with Jason on the tests, I took what we wrote and changed them a little, added a few scenarios, and added the delete tests without help.

All the tests were working! It was a total of seven tests, so not many, but the most code I had ever written and it felt good. The green check when running the tests makes you feel great! The code you wrote is actually testing functionality of your code and will add to the program by ensuring it doesn't get broken. What's next? Send in a pull request (I hope I have all my terminology correct, but a code review for Git). That is when it happens.

This is my first code review for anything greater than one line of code. Once Ben was done with the pull request he turned to me and said, "Sorry I was brutal." Really? I think Ben was just prepping me for all the comments he was giving me.

The pull request was great. I don't think it was brutal, but it was a learning experience for me. Should I have known and coded some of the suggestions before I sent the pull request? Maybe. Okay, the answer is yes. One of the comments was to move some code to a shared base class with the tests I wrote and the tests another tester/engineer wrote. I should have read their pull request the week before and known that there was code in both of our classes. Remember to read others pull requests or ask more questions in our daily standups to make sure I am not duplicating code. Something for me to work on, make sure I am more aware of what everyone on the team is doing.

The moral of this story is that Ben thought he was being brutal. I think he was being very helpful. I am still refactoring the tests to implement all of his comments (I already have a few of the tests working again using the new initialization from the base class). Everyone needs to be continuously learning. That is what helped get me from finance to the software industry (although I still feel I am lucky and maybe don't belong in a coding role). The pull request is a learning tool. As I continue to grow the comments will come back and be different then the "brutal" comments I got from Ben. I hope they are all brutal and continue to help me improve my coding ability.

I saw a great quote today on Twitter. It said, "It takes time to get good at coding." And it does. I will get there, eventually, and the pull requests that are rejected help me see how I can improve and help me get there quicker.

P.S. My wife goes back to work on Friday. No more morning C# on the treadmill at work! I hope to still wake up early enough to get some learning in before I take my daughter to day care.


Tuesday, July 12, 2016

Starting from scratch...

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).


“It's never too late to start over!” 
― Lynne GentryReinventing Leona

Thursday, June 9, 2016

Today I decided to exercise...

Well, hello there. I decided that I would exercise today and run a few miles. I like to run, okay, maybe I only like to run because it is a form of exercise that feel works me and I have semi-motivation to do. It has been a while since I have run and boy can I tell! It is amazing how quickly you get out of shape but how long it takes to get back in the shape you were once in. I can see the translation to your coding skills.

It obviously has been a while since I wrote a blog. That most likely (and does) mean that I haven't been able to code much. My wife is now on summer break (yeah!) and I don't need to take our daughter to day care in the mornings. This means that I am able to come in to work earlier and get some stuff done before anyone else gets there (except Levi, I can't seem to get in the office before him).

I have made good use of the time in the mornings. For Monday - Wednesday I did a course on Pluralsight called C# From Scratch by Jesse Liberty. I know, I know, I am not starting from scratch, but I wanted a refresher course. It was good to jump back in the code and feel like I might be able to make some progress.

Today I started with a Code Kata from codewars.com. Let's be honest, even the basic ones take me a while to complete. This one, even though I couldn't get exactly what the kata was looking for, took me about an hour. I think the kata was looking for me to implement something that didn't use the built in Math functions. Well, I took the kata and decided to make a console application that will help you determine if a number is a square root and if it is a square root, find the next square root number. Simple app, I know. And, have I ever heard of a calculator? Or course I have, but who wouldn't want to use a console application to find if a number is a square root.

I ran into some issues while creating this app. I tried to use too few methods and one time got stuck in an infinite loop. I was trying to determine what key was pressed to see if you wanted to try another number. Well, it turns out it was true every time, no matter what you pushed. I decided to try breaking out my the piece that determines what key was pressed into a new method called start(). Hey! No longer an infinite loop!

        public bool start()
        {
            Console.WriteLine("Press 'n' to start again");
            var restart = string.Empty;
            restart = Console.ReadLine();
            if (restart == "n")
            {
                return true;
            }
            else
            {
                return false;
            }
        }

I know my if statement isn't the most efficient code, eight lines of code (inlcuding the bracket lines). I did a little research (okay, Visual Studio told me) that I could do a switch statement and take out a few lines. I could have also written:

            return restart == "n";

Much better! One line! I like it.

Well, I hope this summer I can spent a lot more time on learning C#. Not only can I go in early and use  the start of my day to learn, but I also will be moving to a team that I will be working with our code base a lot more.

Program:
Download the Zip
GitHub Repository:
https://github.com/robertjorg/SquareRootsConsole/tree/master/SquareRoots

Happy reading, don't be a square!

Wednesday, May 4, 2016

Vivaldi...no longer just a composer

Oops, I was drafting this and must have hit publish. Ten people saw my not even half written blog. I need to get better at this whole process. Sorry to those ten readers that probably won't reread this post.

About a week ago I read an article about internet browsers. There aren't many new entrants into this realm and the players seem to be pretty stable. I moved from Internet Explorer to Firefox to Chrome way back in the day. I apparently don't have a good track record with my browsers. Give me one the has better functionality and I will at least look at it. I don't feel there have been many other options come into the market since the release of Chrome in 2008 (granted I am most likely wrong). Well, in comes Vivaldi (don't worry it doesn't play classical music the entire time it is open). Vivaldi was created by the same people that brought us Opera (see a theme here?). I never used Opera, I know that I wasn't as into tech when it came out, 21 years ago! I thought I would give Vivaldi a try, the slogan is "A browser for our friends"

A little on the build of Vivaldi. It is built off Chromium, an open source project, along with other open source software. Given that, it looks a lot like Chrome, but with a few extra options and customizations to help you get the browser you really want. You are able to use all the plugins that you love so much in Chrome I believe that since it is built on Chromium.



I am writing this in the Vivaldi browser now. I really like all the options that Vivaldi offers. The first is the grouping of tabs. Tabs are great, but don't you ever get so many tabs that you have no idea what each tab is and you have to go through each one in order to find what you are really looking for? Well, you can now group them together (I think Opera allowed this as well, but never used it). The attached image shows the two grouped sites I have, blogger and gmail.


Once you have your tabs grouped you can then tile each tab into the same window. It is helpful if you don't want to have two windows open with the different pages open. Okay, not that big of a deal, but who really wants to have two windows open?


You will notice I have a dark theme for the browser, just one of the many options. There are also great options if you don't like using a mouse. You can set a keyboard shortcut for almost anything! In order to best utilize real estate on my screen I have two shortcuts, Alt + t and Alt + a to remove the tabs (at the bottom of my screen and not the top) and the address bar. There are so many other options for key board shortcuts.

There are also mouse movements that will do actions as well. The one I like the most would be the "Rocker" movements. You quickly press the right mouse button and then the left in order to move back to the previous page. Or, do left then right to move forward in the pages. Pretty nice that the browser is build to accommodate those that like to only use the keyboard and those that like to use the mouse as often as possible.

So many other options that can be done. Like how pressing Ctrl + Tab works. You can have it rotate through the order that the windows were last glanced out or go straight down the line. But not everything is good about the browser.

Really the most glaring downfall is that the browser doesn't appear to be as quick as Chrome. Pages load quicker in Chrome, but not too noticeable. You may lose a few seconds of productivity, but nothing that will keep me from using the browser.

I will continue using Vivaldi.Maybe I will find out more that I like about it. The slogan says "A browser for our friends." I have read they mean this to be a browser for those that were power users and wanted something beyond Chrome. I would venture to say that it is a browser for everyone. Even if you aren't a power user, there is something here for you.

"If you don't like this, I'll stop writing music." - Vivaldi (or maybe I'll stop writing blogs)

Saturday, April 23, 2016

Topics...who needs them? (I do)

So, I pretend I know about technology. I actually only know a little about a lot. I need to tell the truth to all my readers. I have been very fortunate, and very lucky, to get my job with my current company. I have been writing about my experiences learning code but lately I have been going to work with challenging days and not enough time to do learning at work. Once I get home I have been wanting a little time with my wife and daughter and then taking down time. 

The reason for such the difficult times at work is that both of implementation specialists (my old role) are moving to new teams. I am moving to another engineering team and the the other specialist is moving to the client operations side of the business. Technically he isn't moving until June 1 and up to that date he should be working 50% as an implementation specialist and 50% in his new role. It has turned out that he is spending a lot more time with his new role and less time with the implementation role.

The time spent is in no way Tim's fault. This is a new role for him on a different team, and we all know that once you are leaving a department/job that you are done and ready to move on. Since I am staying in the same department it is much easier for me to keep doing the work and help to keep the team floating. It is wearing on me. I have been doing a bigger work load and just surviving. I should have brought this up to managers sooner, but I didn't and thought I could handle the load.

Taking time out of my nights to learn, when I just needed to unwind wasn't going to happen. I know there are ways to learn, outside or reading my C# book, but I don't know of these places as readily as pulling out a book. Similar to my previous blog about the communities we all belong to, there are places we can learn that will provide quick learning environments, like Code Wars or reading a blog on technology. Anyone know some good technology blogs or coding blogs that would be good for a newbie coder? I know at this point I shouldn't be as newbie, but I haven't been able to spend as much time as I would like to further my knowledge of coding and C#, life gets in the way.

I hope that once my replacement is hired (he starts on May 10th) and trained that I can get the rest of the sustaining team to help pick up the slack until we are able to get another implementation specialist hired for Tim's position and that I will be able to start working on the new team, which will be more coding and using different technologies. Until then, I need to find a list of topics that I can write about for the weeks where I haven't been able to do much learning or even looking at my C# book. So, what are the topics that a newbie programmer should be talking about?

P.S. thanks to Brett for starting to write a blog again, I am hoping it will help keep me motivated to write mine even after I don't sit next to him anymore. You can catch his blog at: http://technophiletester.hintonweb.com/

Saturday, April 2, 2016

Time sure goes by quick...

I recently made a decision. I decided to put the lab on hold because I was running into roadblocks and have been stuck for a while (it appears three weeks have passed since I last wrote!). So, I am moving on in the book and will come back to the lab to complete after I have been working on something different. When I was working on the lab, I would write code and it would do nothing like I would expect and so I would search, change the code, and find it also did not work. Frustration was growing until I finally said I need to take a break and learn something new. So, chapter nine hear I come. I think this will be an interesting chapter, it is teaching me how to read and write to objects, like a file or database. This is nice, we write to databases at work and I think it will be nice to understand how we are doing it.

This has brought me to think about coding in general. How do you know when you need to reach out to someone for additional help? Yes, I can continue working on the lab (and I will return to it) to finish and ask others around me for help on what needs to be done. I have done some bug fixes and small feature work for my job. I have received help all along the way while doing these. Usually, I would search on Stack Overflow or other forums reading to see if I could find the solutions I need. Then I would try some of the code and if it didn't work after a few times I will reach out to someone. The person I reach out to can usually answer my question and show me what to do in a short 15 - 20 minutes. I have just spent a couple hours working on it myself without getting somewhere.

OK, sometimes I do find the answer and I think I am better for it. I will probably remember the answers I took a few hours to find than those that are shown to me by someone at work. There has to be a balance, but what is the right balance? I find that sometimes I find the answer after just asking someone for help and talking through my issue. It makes me think about what I am trying to do and say what the code is doing out loud to someone else.

Sorry for the disappointment on the many weeks between blogs and not having the lab done. Maybe I didn't disappoint you, but I am bummed.

On a side note, I got a new job at work. I have been an Implementation Specialist. I would mostly work with clients to install our product and trouble shoot tier 2 issues. Well, they asked me to move to be a Software Engineer in Test. A lateral move, but I will be testing our product and possibly even coding more. I am excited for the change. I have been doing the implementations for almost two years and it has been great. I like working with the customers and really digging into our product. I will be moving teams and focusing on one specific function of our products so I will be deep diving into the code and how that portion works. I know I will start by writing tests and looking for bugs. Eventually, I will be coding, probably a lot more than when I was doing implementations because I won't have the tier two support to also work on. Exciting times!

Friday, March 11, 2016

Ghosts, Bats, and Ghouls...Oh my!

My work recently did a day called Open Space (I believe the thought was that it would replace what we previously did called Hack-a-thons). I had no idea what to think going to Open Space and it turns out to be a great idea. Whatever happens was meant to happen. Anyway, if you haven't done an Open Space, it is a cool idea and worth doing. What happened at our first Open Space is that I decided to host a session about learning C#. Turns out it was a popular session, I think we had 15 people in the session. I better know my stuff! 

At the session I talked about what I was doing with the C# book, Code Newbies, Code Wars, and just trying to pick up stories at work. We walked through an example of the last program I wrote and everyone was interested in my blog. Well, it has been a couple weeks since I wrote a post on my coding. I have been working on the latest and greatest game, The Quest. I have been slow going and spending time when I can find it to work on this project. This is a lab though and there is no help. I have been making sure I understand what I am doing with the code and it is taking a while. So far, I believe I have most of it written, I need to write what each of the available weapons do and then wire up the Windows Form to start working. I neglected to write more about the process while I was doing and it turns out that people are actually reading my blog. I was asked today if I was going to blog about the time I was spending on this project. Short story, people read my blog and about the adventures I have embarked on.

Now, onto The Quest.
The picture is the base for the form, it contains all the pictures that will be needed for each level. The form will control when the weapons are picked up and which enemies are present for the level. Well, I get to use inheritance quiet often in this project. I have a Mover class, and abstract Enemy class (which inherits from Mover), three different types of Enemy (inherits from Enemy class), a Player class (inherits from Mover), and the weapon classes (also inherits from the Mover class). My move class controls a large number of what the game does.

To make sure I have good encapsulation, I have the form that will only call the Game class and the Game class will call the correct methods from each of their respective classes. Now, I am having a problem, I am having a hard time deciding which class that methods best fit and if I need to have a private object or public objects. 

I talked to my team lead about the problems I was having with this. I just needed a gentle reminder, Private objects will only be used in their class. Objects should only be public when they will be called by another class. To better encapsulate our objects we call the public object, but the private is the only one that can change our public object.

As I have been writing the code and following the "hints" I am given from the book, I have gotten a few errors, like I created a method using public abstract string Name. I had the lovely red squiggly lines in VS. Hey, you can't have an abstract method when the class isn't abstract! The error was pretty helpful, it still took me a few minutes to realize what the error was telling me. I got it. Another error I got while working on the Weapon class. Below is the picture:

 The NearBy class only has two arguments. I remembered this one pretty quick, I need to overload this method and have it use have one method with two arguments and the overloaded method taking three arguments. 

I am also overriding a method called Move for each of my enemy types. Honestly, this confuse me for a minute on what I needed to call. I had the example the book gave me for the Mover class with the Move method. The enemies need to find out where the player is to determine which direction to move. I forgot that I had method in the Game class that determines where the player is at and the enemy class instantiates a game class. 

 
Things are starting to come together and, after I think about what needs to be done for a while, I have started realizing what needs to be done. It is slow going, but I hope I become better and more efficient with the coding and realizing what needs to be done. Maybe I can give you The Quest in the next week.

Thanks for reading, I'm off to read The Marian.

Thursday, February 25, 2016

Anyone hungry?

So, I was almost done with chapter 8. It was just a few more collections that act similar to lists. They are queues and stacks. The book used language I was used to hearing in my prior job, LIFO and FIFO (last in first out and first in first out). LIFO refers to stacks and FIFO refers to queues. I thought about those and how I choose how to treat my lots when buying stocks, do I want to pay taxes on those I first bought when I sell or those that were the most recent purchase. Okay, an easier way to think about it queues: treated like a line, the people who get in line first are the first to get their food or be seated. Stacks are take the top, like Pringles. You have to take the top Pringle in the can to get to the ones at the bottom.

Alright, seems simple. Let's take a look.To create a queue you add some code like:

Queue myQueue = new Queue();

Then to add to the queue:

myQueue.Enqueue("Piece of data");

Or remove:

myQueue.Dequeue;

Remember FIFO. That "Piece of data" we put in will be the first out. And now to show stacks:

Stack myStack = new Stack();

A little different to put in a stack, we push the piece of data in:

myStack.Push("Stack data goes here");

Then to remove data from the stack we pop it out:

myStack.Pop;

Both stack and queue inherit from IEnumerable and, pretty easily, we can move our data from a queue to a stack to a list and back (probably any combination you can think of) by overloading the constructor. Example:

Queue myQueue = new Queue();
*enter data into the myQueue*
Stack myStack = new Stack(myQueue);
List myList = new List(myStack);

At the end of a chapter we created a flap jack tracker to see and feed lumberjacks (does anyone like soggy flapjacks?). A lot of concepts are starting to come together.



Next up is another lab. No help on this one, wish me luck!

Wednesday, February 24, 2016

cSharpDictionary.ContainsKey("GoFish") - Another section of chapter 8

I still am not done reading Chapter 8. Although I have been reading and coding most nights (except the nights my wife and daughter were both sick or doing my taxes which are always phone *please insert sarcasm*) it takes me a while to get through the material. 

Well, since my last post a week and a half ago, I have mostly been working on a project in chapter 8. I tried really hard not to use the help for this project and perhaps I have learned something during the week. I just finished the Go Fish project in chapter eight and I did use the code that is provided in the book. I was stuck, what was I to do? Sometimes I ask myself, is object oriented programming for me? I felt when doing VBA that I got a relatively good grasp on what I was doing and didn't have to refer to the web much after doing it for a while. Perhaps I will start feeling that way with C#. I will say there are pieces that I look at what needs to be done and a light bulb goes on. Those are the days that help me continue spending any small amount of free time I have trying to become a coder. Just code more each day I guess (I try to do CodeWars but feel sometimes they are above what I know, maybe those are the good ones to actually test my skills) and have joined some communities like codenewbie.org (full of people wanting to learn to code from all backgrounds). What helped you learn to code?

One great thing about this chapter is that it made me really look at overloaded objects. As usual, We have talked about overloading before at work and I have never really grasped what that meant. This chapter was discussing overloaded methods and I probably missed it early on in the book, but I was really feeling lost. I spent some time investigating to find out that I really didn't know much about overloaded objects. Come to find out, they can probably come in handy. I like the definition from MSDN:

Members can have the same name as long as their parameter lists differ. When two or more members in a type are the same kind of member (method, property, constructor, and so on) and have the same name and different parameter lists, the member is said to be overloaded.



Just pass the correct parameters and the code will use the correct overloaded object. The Go Fish project actually uses one so you can find what card the computer will choose and then call the method that the human player uses. pretty nifty.

Hey, you can also create a dictionary to store definitions of keys. Just do:
Dictionary kv = new Dictionary ;

You set your TValue object type and key (keys must be unique just like the dictionary you use!) and enter data. You can then count the data, see if objects are in the dictionary, remove items you don't like, and add items you do like. There seems to be a lot more you can do with dictionaries. 

GoFish! Game - I still have not won the computer, I can only tie the computer. AI must cheat.

Until next time.

"I like to fish. Fishing is always a way of relaxing." Tom Felton

Sunday, February 14, 2016

enum Ch8FirstHalf { Collections, Enums, Icomparable, IComparer }

First, let me start by staying that I may have finally figured GitHub out. I haven't deleted any projects for a while (yeah!) and I actually started using it on two computers. It was helpful this weekend as the computer I have been using my work computer to do all the coding. Well, just the other day I installed VS 2015 Community on my home computer, just in case, with GitHub. As I was coding tonight, I couldn't find my charger for my work computer so it came in handy that I had everything installed so I just cloned my chapter 8 repository and I was back in business. Worked like a charm!

Now, chapter 8, well at least the first part of it. Collections - pretty nice, they allow you to store, sort, and manage all the data that your programs need. I bet these will come in real handy when coding. Let's check them out.

First up was Enummerate Values, a.k.a. Emum. These are a data type that only allows certain values for a piece of data. I have seen those before! Actually, only a few times at work, but I have seen them and now I understand what they are used for and why. We have talked about enums in our stand-ups or in water cooler conversations and now I can actually add to the conversations! "Hey, just take that enum and assign a number value to it and BAM!"

Example to restrict the suits a card can have:
    public enum Suit
    {
        Heart,
        Spade,
        Diamond,
        Clubs,
    }

Sweet! I can make sure the correct values are the only ones used. But! Enums have their limitations. What if I have an unknown amount of items to put in, or you have objects you need to put in a list instead of just a type? *Hint* Use a list

Lists take objects and you can assign anything to it as long as it is polymorphic. That leaves it wide open. So you have your enum that tells you what suits you can use and say that you have one that tells you the values that can be used for your cards. Now you can create a list that contains a card with both a suit and a value (you need a Card class as well):

            List cards = new List();

            for (int i = 0; i <= 4; i++)
            {
                cards.Add(new Card((Suit)random.Next(4), (Value)random.Next(1, 14)));
                Console.WriteLine(cards[i].Name);
            }

Your lists will automatically resize itself when objects are added or removed. Arrays (talked about in another blog) can't do that so you will need to know how many objects to include in an array or leave the correct number blank spots to add to the array. (I understand .Net has a bunch of collections to solve these issues, but I don't know about them yet and I am told List is the most common type).

You also have IComparable and IComparer to help sort your lists. Takes a little bit of coding, but essentially you create an integer output and tell it if it should be higher or lower by returning a -1, 1, or 0 (the same value). Create a method called Compare in IComparer and give it two object parameters then do like below:

    class CardComparer_byValue : IComparer
    {
        public int Compare(Card x, Card y)
        {
            if (x.Value > y.Value) return 1;
            else if (x.Value < y.Value) return -1;
            else
            {
                if (x.Suit > y.Suit) return 1;
                else if (x.Suit < y.Suit) return -1;
                else return 0;
            }

        }

(I know that isn't as efficient as it could be, but I didn't use the books help on this activity AT. ALL!)
Also, remember that if you are comparing Enums it will use the index number assigned. The enum above for the suit would sort by Heart, Spade, Diamond, and then Clubs.

As mentioned above, I haven't used the help yet. I have used my prior projects to check my code or find an example to modify for my new project use. I am feeling pretty good.

https://github.com/robertjorg/Ch8/tree/master/FiveRandomCards
https://github.com/robertjorg/Ch8/tree/master/ListOfDucks/ListOfDucks - I think we will be using this one later as the book had me add some methods that we haven't used yet.



Sunday, February 7, 2016

if (catchyTitle.Text == "Interface Inheritance" ) { MessageBox.Show("Chapter 7 is done!") }

This chapter took a little longer than prior chapters. Maybe it is because there is more material and the coding projects try to use the majority of code I have learned in the prior chapters. So, since a few blogs ago I decided that I wasn't going to use the "help" as much as I had been prior. I would say I succeeded pretty well in this chapter. Building a house with places to hide I did go to solution after I got stuck and was unable to make progress. I hope it helped me learn what I was actually using better. I think it also helped that I didn't have many days between actually looking at code I started and code I was finishing. Instead of having to remind myself of what I did before, I was able to remember it pretty well.

While my code doesn't look the same as the solution, and probably has more lines then what is needed, I ended up having an issue where my form wasn't updating correctly. The issue showed itself after I implemented the interface for a hiding place. I forgot to call a method when moving from one room to another called ReDreawForm(). Hence, the form was not redrawing and giving incorrect information about where the hiding place was in the different rooms.

Well, the hide and seek project (I called it long project because when I started it the book said it was going to be a long one) contains both outside rooms and inside rooms. Both inherit from the Room class. Then there are two interfaces for rooms that have exterior doors and rooms with hiding places. I had to do some searching on what to display depending on the room type (IHasExteriorDoor or IHidingPlace). In comes upcasting and downcasting (aka Polymorphism). Example of finding a class that inherits from an interface:

if (currentLocation is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }

That brings me to another point, Object Oriented Programming has four principles (why the book waited to chapter 7 is a good question):
  • Inheritance - one class or interface inherits from another
  • Encapsulation - creating an object that keeps track of its state internally using private fields, and uses public properties and methods to let other classes work with only the part of the internal data that they need to see
  • Abstraction - When you create a class model that starts with more general - or abstract - classes and then has more specific classes that inherit from it. Cannot instantiate these
  • Polymorphism - "Many forms" Take an instance of one class and use it in a statement or method that expects a different type, like a parent class or an interface that the class implements. Upcasting or downcasting allows us to get polymorthism.

We have used all of the principles so far, it now is a matter of being able to remember each principle and how each is used (so much to remember, but I think coding more often will help that). 

This chapter also talked about access modifiers. You know, like public or private but with a few more. 
  • Public - anything can access this (as long as access to the declaring class.) Least restrictive. Only use if you have a reason to make it public.
  • Private - only other members in the class can access it (other instances of the class can use these as well). You can only mare a class private if it is encased in another class.
  • Protected - public to subclasses, private to all else.
  • Internal - public only to other classes in the assembly. Protected Internal can only be accessed from within the assembly OR from a subclass.
  • Sealed - class which cannot be subclassed. Not an actual access modified, it only affects inheritance.

I think something to help remember the implementations, inheritance from a class allows you to modify the methods or use the methods how they are written in the base class. Interfaces have abstract methods and cannot be instantiated. The methods in the interface do not have any code in the contained methods, it only tells a class that inherited from the interface that all the methods MUST be used. The class can then implement any type of code needed for the given method, but it has a framework of what needs to be implemented from the interfaces.

I am only touching the surface I know. So much to learn!

Thursday, February 4, 2016

The Communities we belong to...

We are given time to innovate each week and sometimes I do it and sometimes I don't. I really need to get better at not only spending innovation time innovating, but also what I am innovating on. Well, we had a really interesting and fun experience at work yesterday. We were able to participate in Open Space (more information at http://openspaceworld.org/). We weren't given much information as to what the day would entail or what would be expected of us. At the beginning we discussed passion and that maybe Open Space would help Innovation Time to get some real quantifiable results (sometimes the innovation projects got lost and nothing comes of them). We were given 45 minutes blocks to bring up topics we felt passionate about. I brought up C# learning. I didn't expect many people to come to this session.

When the session started in the afternoon, I was surprised at how many people came to talk about C# learning. It makes sense, another team is going to start using C# more and wanted to see what I, a person on engineering using C# everyday, was doing to help in my learning. Our discussion led us to what I was using and how we could all learn what resources and communities others were using in order to stay on top of their coding.

I thought that I had a limited number of resources I used...but then I really looked at the sources I am using. Between blogs, people I follow on Twitter, and my network at work I actually do have quite a few resources. Of course there is the obvious one, I use the book resource that leads to most of my blogs. I feel it is a great resource, I get in-depth training on the basics of C# and I (hopefully) provide what I learn in a blog. 

At work I obviously have my co-workers that I can work with and ask questions of. One, K.C., appeared to take particular interest in me and I ask many questions of him. You could say he is acting as a mentor to me. Strange thing, I have never asked someone to mentor me that is younger than me. I am getting old, but then I guess that happens when you switch careers.

Then I follow other coders on Twitter and try to read their blogs (at least when I don't think that the subject will be a mile over my head). I like getting their perspectives and I hope that the bits of information I get from reading their blogs and posts will help in my learning. I follow (to name a few) Scott Hanselman, Troy Hunt, Jeff Atwood, John Papa, Visual Studio and those are just a few of those I feel can add to my learnings. Hey, maybe one day I will post a question in Twitter and receive a response from those I follow or that follow me.

I was lucky one day and found a retweet from one of those I follow about CodeNewbie (funny that I picked Newbie Programmer). CodeNewbie is a set of blogs, podcasts, Twitter discussions, and probably more that I haven't found out about yet. From listening to the podcast I have already found a couple great communities to use in my code adventure. Some of the stories are similar to mine, 30 somethings that switch careers and trying to learn to code. I hope to take part in the weekly discussions that are held on Wednesday nights and that I will be able to contribute my knowledge gained.

There are more like Free Code Camp (I just started following them and need to check it out more), Evasium Programmers (need to look more into this one too) and the usual Microsoft accounts to help in all things Microsoft. I know my world will keep expanding too.

So, I have a few communities I use to learn, and it continues to grow as I dive deeper into coding. In the Open Space meeting where we talked about what everyone uses, I am not aware of anything used at work for one person to pass along the resource and communities one person belongs to those that are trying to learn C#. Maybe I should start a Slack channel at work, or is there a better way to pass this knowledge on? I need to let others know what I am reading and who I am following. They may prove useful to someone else just starting to learn to code.

What communities have you found to belong to?

Thursday, January 28, 2016

Uh-oh 14 days, some of chapter 7

I broke my own deal. I was doing relatively well and was writing blogs on a close to weekly basis. Then I decided to go slower on each of the chapters. This means that if I am going to write every week I may or may not have a full chapter done. The past two weeks have been, interesting. I haven't been able to find much time while at home to go through the C# book (either that or after Nora goes to bed I haven't wanted to take the time to read. Bad I know. I need to spend more time on the book if I am really to become a full developer. I will be honest (don't worry my boss knows this), I do not want to be installing our product at client sites forever. In order to stop doing that I need to spend more time learning to code.

Anyway, I have said that before and I guess writing it down (again) reminds me (again) that I need to just do it more. That may mean late nights or staying late at work (staying late is hard because when I stay too late I don't get to see my daughter). I know I disappoint the 20 readers when I don't post something. I need to make a list of subjects that are separate from the book to have a continuous flow of subjects.

Onto the meat of the blog, I have started chapter 7 in the book. I have seen at work we will have a class that says ThisClass : IInterface. I had no idea what the ": IInterface" was doing and had heard some people talking about interfaces. Up until now I had no idea what they were talking about (shame on me for not asking more questions when I saw them in the code). An interface tells a class that it must implement certain methods and properties. The interface does not tell the class how to implement these methods and properties, just that it has contain these in some form. Okay, not in some form, the methods and properties in the interface must be implemented with the same names and return types.

I learned a little about downcasting and upcasting to make it so you can have an array of objects that aren't 100% the same, but implement the same interface. Seems like that can be really useful and I am sure the exercise for the chapter will let me get a try at this.

More on Chapter 7 on a later blog.

On a side note, we are starting to use Microsoft Azure at work. So far it seems like it will be a powerful tool. Our team has created templates and we are finding out how powerful Azure actually is. When I say our team, I mean a few of the guys are doing that and I am getting more an more behind. They have posted some articles on Azure on our internal site, I need to get reading those.

Chapter 7, here I come!


Thursday, January 14, 2016

Bee Management

Well, it is another week and I find myself saying, "I am not moving as fast as I would like." There is always more learning to be done. The amount of learning for me to feel comfortable telling people I am a developer is a large amount! Luckily, my job title is only doing part time coding, but that doesn't mean I should go slow on my learning.

This chapter took me longer than I had hoped. Not only did it take a long time, I also feel I did myself a small disservice in this chapter. The book provides the code that they want you to write. That is great when you are stuck, but I feel I was using the "help" too much. I created a Bee Management system in two parts. The first part used code that I should already know, I do. The problem, I should have taken the opportunity to learn it better. I felt I didn't have enough time to do this though and looked at the "help" more than I ought to have. I need to slow down and spend more time doing the code myself. That is a New Years resolution 14 days late.

Now, house cleaning out of the was and the confession of my sins is done. I already blogged about the inheritance in chapter 6 and, as I thought, I redid the party planner and used inheritance instead of writing extra code. Before doing that I learned a little about the hierarchy used in the code. If you don't override you can run into some issues with code not doing what you want when using inheritance.


The bee management program was done in two steps. First just writing the program that assigns the jobs to the bees, no inheritance used. The next piece was to use inheritance by adding a class that all bees used for honey consumption. Hey! I got to override the honey consumption for the queen, she apparently is real hungry when the bees work.

Not only did I override a method, I also added parameters to a subclass. This requires a little different syntax then the virtual/override. The bee class (base class) has a weight parameter and the worker bee (subclass) also tells you what jobs they can do. Do something like:

public Worker(string[] jobsICanDo, int weight) : base(weight)
(the string is an array and I hard coded the jobs a bee can do in the Form1.cs file.)

The Bee class has the weight parameter and the worker class added the jobs parameter.

So much you can do with code!

Here is the bee management program. Happy bee management!

Now that 15 days of the year have gone, I hope you are still doing your resolutions. If not, I hope you have a great new start with your old habits!

Wednesday, January 6, 2016

Inheritance

First, I did take some time off of EVERYTHING (except being a dad and husband and all the stuff I normally do at home). Okay, let me rephrase that, I took some time off work and coding. I should have spent at least some of my time of during December to learning me some code but, alas, I did not. No going back now, so now I have two weeks of family time only, which is good! Next, I just started reading the next chapter on inheritance yesterday and am not finished, but I feel I need to provide an update.

Ah, inheritance. Sometimes you inherit really great things, like the genius gene or money, and sometimes not so great things, some sort of really bad gene. Coding, you can luckily change what gets inherited, kind of. More on this later.

Coding, a subclass inherits everything from the base class (return type, fields, parameters, everything). Do something like:

Class A {
public int field1;
}

Class B ; A {
public int field2;
}

That allows the coder to do a lot less code duplication. The code above, class A has one field called field1 and class B has two fields, one called field2 and one it inherited from class A called field1. One less line of code to write, yeah!

 I started out with an exercise from the book, I took the Party Planner tool from the last chapter and added the ability to cost out birthday parties.

The two cost structures were almost identical with a few minor differences. At work I had seen, and actually used, inheritance before. I knew that it was possible, although when I used it I was more copying what I learned from Google and didn't understand what I was doing. So, when the book had me typing everything out for my new class that was pretty much the same code as another class that already existed I thought, "Man, this seems like a lot." And it was. Too much.

The book must have the readers go through that to see if we will stop and think that there has to be a more simple way (the reader should know that there is because it alludes to this fact at the beginning of the chapter). I am just past this point in the book and I think in the next few pages it will have me create another project, probably just like the party planner before, but this time use a base class for my overall Party and have sub-classes: one for dinner parties and one for birthday parties (just my guess but knowing the structure of the book, it is probably a pretty good guess, we will see on the next post...ooh, I cliff hanger).


WAIT! What about my kind of statement above? I did get a little further after re-writing all my party code. I read that you can change something that gets inherited from the base class. You just need to make sure your method is marked with "virtual" like below:

In Class A:

public virtual void CoolMethod () {
   //do some CoolMethod here
}

This needs to be followed by an override in the subclass like, say class B that inherited from A:

public override void CoolMethod() {
  //do an even more CoolMethod here
}

No you inherited everything else that is in class A, such as field1, but the CoolMethod does some other awesome stuff that A doesn't do, and also has field2 (see above).

More to come on inheritance.

A few definitions:
Subclass: A class that inherits fields and methods from a base class

Override the method: A subclass changes the behavior of an inherited class

Class Hierarchy: Classes at the top are base classes with subclasses below it. Those subclasses can have their own subclasses that inherit from them

P.S. Maybe I should spend more time this week learning GitHub...I deleted the Chapter 6 code...again! Anyway, I took a shortcut on recreating the code..You can get the program here.

https://github.com/robertjorg/Ch6