Software Development: Writing Better Code Through Code Reviews

One of my favourite parts about being a software engineer is reviewing code. You get to learn alot about an individual from the code that they write and also learn how to potentially do something more efficient or understand a component of the application you had little exposure to before. If I look at a merge request, within the first few lines of code that is submitted I can get a good sense of how many years they have been programming and if they know what they are doing or if they just copied and pasted something from StackOverflow.

Graduate software engineers, entry level software engineers, or individuals who have just started programming, will often leave out some crucial elements such as appropriate null checks, logging, comments or appropriately named classes, methods and variables. There is nothing worse IMO then looking at some code and seeing a variable named “numbers”. It is most likely some collection object like a List and contains numerical values but offers little context in respect of the application it is used in. It may make sense to the person who wrote it but it probably won’t to others and you will most likely forget its context several months down the line. Red flags are very easy to spot here.

The more experience you get, the quality of the code that is submitted is generally far easier to read, is structured and broken down logically, has been optimised, there are the appropriate exceptions and null checks in place and the classes, methods and variables are named appropriately. But to get to this level you not only need to write a good amount of code but also look over and see how others are structuring and writing their code and do reading/research in your own time.

At work when I get a request to do a code review there are a number of elements I look at. Some of which include:

  1. Appropriate and meaningful class, method, and variable names.
  2. Small, compact and single purpose methods.
  3. Appropriate null and boundary conditional checks.
  4. Some level of optimisation on the operations performed.
  5. Meaningful unit and/or integration tests have been implemented.

At times I think that I am fairly harsh on the individual who submitted the code to be reviewed but then I think to myself that the better the code repository is in, the easier it will be to maintain and if good code practices are enforced then it will make everyone a better programmer. If I didn’t start being critical of my code and trying to better myself then when I do the code reviews I probably wouldn’t be as critical of theirs. Setting a high standard will only make the lives of software engineers working on the project much easier in the long run even if there is short term pain.

Git. Command Line or Graphical User Interface?

I was doing some reading today about Git and whether software engineers (or anyone else for that matter) should learn to do all their changes, etc for Git using command line or a graphical user interface. It was an interesting piece and some valid points were made for both using a command line and/or a graphical user interface. Me personally, I use a graphical user interface because it is extremely easy, hooks directly to the Git commands (under the hood) and can give you a nice visual tree of what the repository looks like. For your information Sourcetree is the client I use. However the more programming and development I do, the more I appreciate and want to learn what, how and why.

Some of the reasons why using the command line approach is valid and well worth it include but not limited to:

  1. Platform Independence:
    • No matter what operating system you are on, the commands are universal. So if you can use the Git commands in a Linux environment, then you will have absolutely no problem whatsoever doing it on a Windows or MacOS machine.
    • Git clients like Sourcetree for example are not available on every platform, and I imagine the other Git clients are also not available on every platform.
  2. Understanding:
    • This fundamentally for me is important and I think should be high on everybody’s list when using something.
    • By using the command line you get a level of understanding of what exactly you are doing, whereas using a graphical user interface this level of understanding (well to me) is abstracted and partially lost.
    • It also comes back down to point 1. If you understand what you are doing then you can take it to any platform.

Now using a graphical user interface is not the end of the world. Sometimes you just want to get something done and using a terminal if you are not comfortable with it can be extremely daunting. I personally would never be caught dead (well right now anyway) resolving merge conflicts and looking at diffs using a command line, and rebasing using a graphical user interface is so much easier.

I did some quick Googling and found what I feel are two really good resources that help and ease you into using the command line for Git. There is Try Git and Learn Git Branching. There are probably more out there but those are the two that I felt provide a good starting point. If there are others out there that you use or feel that there is a resource that is definitely worth reading then please add a comment below (sharing is caring) 🙂

Kaspersky Anti-Virus + Microsoft Windows 10 + Microsoft Office 365 Issue

Recently I had updated three of my household’s Windows 10 machines (one Surface Book 2, one custom built gaming PC, and one ASUS laptop) to the latest stable/release version of Windows (Microsoft Windows April 2018 Update). Each of machines also have a copy of Microsoft Office 365 installed, along with the latest version of Kaspersky Anti-Virus.

What I have found after the Windows 10 April 2018 Update installation; Microsoft Office 365 fails to properly recognise that I have a registered version. I can still use the products in the suite such as Word, Excel and Outlook, but am given 3 days to rectify the problem before the product runs in a limited capacity. I have the correct account logged in, the credentials are correct, and if I try to register and authenticate via the Internet option (phone option is not available) it completely fails. Googling or Binging the error code that is produced does not show any resolution or worthwhile results.

Restarting the machine, restarting any of the Microsoft Office 365 products also does not seem to resolve the problem. Initially I thought that communication to the Microsoft servers was unavailable (sometimes servers go down), but trying to use the product at any time resulted in the register/authenticate prompt to appear on all the machines. So out of sheer desperation and curiosity I thought perhaps I should disable my anti-virus because sometimes they can cause problems with certain applications. Low and behold when I booted up any of the Microsoft Office 365 products the registration/authentication prompt no longer appeared. It appeared that Kaspersky Anti-Virus was blocking or limiting my ability to properly communicate with the Microsoft servers.

Now that Microsoft Office 365 could be restarted without the register/authenticate prompt appearing I decided to re-enable my Kaspersky Anti-Virus, restart my machine and launch the Microsoft Office 365 products. Still no more register/authenticate prompts; great news. Whatever happened between the Windows 10 April 2018 Update, Kaspersky Anti-Virus and Microsoft Office 365; it seemed like it invalidated my copy of Microsoft Office 365. If you encounter the same problem after updating your Windows 10 machine then try the following steps because they worked for me:

  1. Close any open Microsoft Office 365 product you have open.
  2. Disable any anti-virus that you have running (if possible).
  3. Open a Microsoft Office 365 product.
  4. Close the Microsoft Office 365 product.
  5. Turn on your anti-virus.
  6. Restart your Windows 10 machine (this is optional).
  7. Open a Microsoft Office 365 product (the register/authenticate pop up should no longer appear).

Hopefully the above steps helps to resolve your problem.

My Artificial Neural Network Application & Podcast

The last month my blog has been fairly quiet.

I have been a little busy working on my artificial neural network, practising BJJ and playing some video games; plus I was sick for a couple of days. Initially my plan (which I stuck to for an extended period) was to put out a blog post every one to two weeks. However coming up with meaningful content that often can be fairly difficult.

This month I plan on writing about my artificial neural network with some emphasis on how a multi-layer perceptron works and how my application works/be used. It can be viewed on my GitHub page.

The current state of my artificial neural network on GitHub is just the skeleton with the majority of the code still not pushed to the repository. As I start to push the meat of the artificial neural network components such as the feed-forward, backward propagation, etc I will be creating specific blog posts.

The podcast that I was working on has not turned out as expected so I am in the process of re-evaluating the tools and topics that I will cover. I still plan on creating a podcast and with the new Content Creator version of Skype it should make the process  much simpler.

Being an Xbox and Windows Insider

After installing a new Xbox OS update on my Xbox One X console, I launched the Xbox Insider application to see what the changes were and if there was any new Quests, Polls, Survey, etc. I noticed that I had been an Xbox Insider for 3 years and 11 months, essentially as soon as there was an option to try the latest features and opt in to new functionality I jumped on it. Along with being an Xbox Insider, I am also a Windows Insider; but I have not been as active in that program in recent months. Checking out the new features and functionality that the teams over at Redmond and around the world working at Microsoft are developing is something that really excites me. I love trying out new gadgets, devices, software, etc. What Microsoft is doing with both their Windows and Xbox platforms, allowing individuals to try new features and provide constructive criticism and feedback is extremely positive and very pro-consumer. It helps ensure that the best product is produced.

However by trying out early builds on either platform is not always fine and dandy. There have been a number of times when simple and basic functionality such as Xbox Live Party Chat did not work at all or installing and/or updating applications completely failed. Luckily to combat this, Microsoft has separated the Insider builds into “Rings” which determine the stability of each build and how new the features you will be getting are. If you are in the Alpha Ring (like I am) then you will get the latest and potentially breaking builds or you could be in the Delta Ring and get a significantly more stable build but not have the newest features. This creates choice for the individual while still allowing them to contribute to the evolution of the platform and assist in bug reporting (something as a software engineer is extremely helpful, the more testers the better). More software companies really need to start providing this feedback process as software is becoming ever increasingly more complex.

Many people will most likely not want to be involved in trying unstable or incomplete builds/features for various reasons. To me though, providing feedback and helping the features become less buggy and complete ready for the masses is rewarding (even though I do not write a single piece of code). To make trying out the new features more enticing and understandable, Microsoft has created Quests and Surveys. Generally if there is new functionality added after an update a new Quest will appear which shows you how to activate and or try it out. It is a very handy way to get your device configured with the new features. The Surveys provide an easy way to communicate how you find the new features (if they even do work as intended) and if there are any issues that you encountered. Reporting bugs and issues is also extremely easy. Each platform as their own Hub that allows you to provide as much detail as possible to help Microsoft resolve your problem, and if others have the same issue then they can piggy back off yours and add further information and diagnostic data.

Overall the entire Insider experience on both platforms has been fun and for someone who is looking to try new features before others, or just wants to help Microsoft out in providing the best possible experience for everyone then the Insider programs are a must. For more information about the Xbox Insiders Program check out the following link. For more information about the Windows Insiders Program check out the following link.