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 Gentry, Reinventing 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!