September 7

Does Your Manager Come With a README?

Do you know what a README is?

You can add a README file to your repository to tell other people why your project is useful, what they can do with your project, and how they can use it.

GitHub's About READMEs

Pretty good idea isn't it? Why should we stop there?

When you are looking for a job, you give the potential employer a lot of information about who you are (SSN, education, marital status, background check, credit check, and any information they can glean from the interviews). There is a smaller amount of information coming back the other way, specifically about who your manager is. Normally, you hit the high points in the interview and then "stumble" over their intricacies while on the job. Do you ever wish your manager came with a README?

Now they can! Enter https://managerreadme.com/. I had a manager who included a link to his README in a batch of onboarding documentation. He covered several topics:

  • About Me
  • Team/Culture
  • Time Management
  • Communication
  • 1:1s
  • My Commitments to You
  • My Expectations of You

Did it tell me everything I need to know to work with this person? No, but what a great way to help set expectations for new people on a software development team.

If you think this is a good idea, send your boss a link to https://managerreadme.com/ and tell them create a README to help your future teammates with their on-boarding.

Do you have a README? Share it in the comments.

Category: Uncategorized | Comments Off on Does Your Manager Come With a README?
August 27

New High Score (update)!

My post from yesterday talked about the biggest class I have come across in my lifetime. Turns out, thanks to C#'s partial keyword, the class is even bigger. I have some code metrics from Visual Studio to share. Here they are:

Maintainability IndexCyclomatic ComplexityDepth of InheritanceClass CouplingLines of Source code
4995292361761900
Code metrics covering the class in aggregate.

Here are the metrics for the 3 longest methods in the class:

Maintainability IndexCyclomatic ComplexityDepth of InheritanceClass CouplingLines of Source code
015277786
0215621181
0284271238
Code metrics covering the 3 longest methods in the class.

The class itself has 1,314 methods! That is insane!

Yep, I think you are gonna have a hard time unit testing this monster.

Have you come across a bigger monstrosity? If so, leave a comment!

August 26

New High Score!

I was working with a new codebase today and I was working on wrapping some unit tests around a section of code in a class. While working, I realized I had come across the BIGGEST class I have ever seen in my life. So big in fact that Visual Studio's IntelliSense was lagging.

For the record, I did not write this code. Unlike some developers, I know what the Single Responsibility Principle is...and I use it! #solid #softwaredevelopment #youaredoingitwrong

Without any further ado, here is a picture of the new high score!

Have you worked on a codebase that has a class bigger than 40,675 lines? If so, post a comment.

Category: Uncategorized | Comments Off on New High Score!
August 13

What Is Your Philosophy on Unit Testing?

The purpose behind unit testing is to help ensure the code you have written performs as expected. The running of unit tests can be more effective when it is automated on a developers machine and as part of your CI/CD pipeline. Automated unit tests can also take the load off of limited QA resources by letting them focus on higher level testing (i.e. integration testing, regression testing, and acceptance testing).

Nowadays, when I'm handed a new code base to work on, I treat it as suspect. I have no idea if the code base will even run. If it does run, how do I know that it runs correctly? Unit tests will help me determine what shape the code base is in.

In general, I follow the red-green-refactor approach when writing unit tests. I write my tests in this order typically:

  1. Cover the happy paths through the code you are testing.
  2. Cover the upper and lower ends of inputs to your code.
  3. Cover any know edge cases known at the time.
  4. As a follow on to this process, if and when bugs are reported against code that I'm maintaining, I can then write a unit test to reproduce the bug and it will also tell me when it is fixed satisfactorily.

What unit testing framework do you like the best and why?


xUnit.net hands down. xUnit.net requires fewer attributes to set your tests up (i.e. Fact and Theory). Another feature I think is neat is using a class's constructor (w/o any attributes) as a setup method for your unit tests. This is great because it follows the way classes work naturally.

What other unit testing frameworks have you used?


I have used NUnit and Visual Studio Unit Testing Framework (aka MSTest). I prefer NUnit to MSTest though.

What is the right amount of code coverage?


If I have to give a number, I would say between 70% and 80%. I would have a higher number for code that is heavily used and relied upon by other parts of the solution.

How would you go about writing unit tests?


I like using TDD on more complicated/intricate code because it let's you work your way through the code step by step. I prefer a Given-When-Then (GWT) approach over Arrange-Act-Assert (AAA). The GWT approach allows you to write more human-readable unit tests. The AAA approach works, but is not as easily readable. In general, writing clear and understandable code is the goal. Here are a couple links that talk about GWT vs AAA:

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Code for readability.

John Woods

What other tools can be used to improve unit tests?

What are some pitfalls of unit testing?

  • Testing the wrong thing - Software development teams need to make sure they are writing unit tests to cover code that they have written.
  • Getting lost in setup hell - This occurs when the setup for your unit tests starts to become tedious and takes a lot of time to get right. Using a GWT style seems to help with this.
  • "I'll just comment out this unit test to get things working so I can check in my changes." - I think this is just developers being lazy and apathetic about the changes being made to the solution. It is not a behavior I would encourage on my software development team.

So that's my current philosophy on unit testing. What do you think? Am I wrong? Did I miss something? Feel free to post a comment or send me an email.

Thanks to Risa for the good question!

Category: .NET, C#, interview questions, unit testing | Comments Off on What Is Your Philosophy on Unit Testing?
June 22

Microsoft Certified: DevOps Engineer Expert

Microsoft Certified: DevOps Engineer Expert
Microsoft Certified: DevOps Engineer Expert

I picked up Microsoft Certified: DevOps Engineer Expert certification last week. I posted it to LinkedIn but it didn't make it here until now.

To get this certification, you have to do the following:

What's next? I have several possibilities of things to do:

I'm open to any other suggestions. Got some? Let me know.

Category: Uncategorized | Comments Off on Microsoft Certified: DevOps Engineer Expert
June 13

Deploying an ASP.NET Project From a Multi-Project Solution Using GitHub Actions

I've been studying for the AZ-400: Designing and Implementing Microsoft DevOps Solutions exam. As part of the preparation for that exam, you build a bunch of CI/CD pipelines. Every example given has a GitHub repo with 1 solution and 1 web project. That's great for demoware, but we aren't writing demoware.

Let's say you have a website you wrote about 10 years ago using an earlier version of ASP.NET (read that as non-.NET Core) that you want to modernize/revamp. The approach I took was to create a new ASP.NET Core web project next to the older version of the website in a single solution.

The idea is that I could take my time moving parts from the old project to the new and still have a running version of the old website. Putting my DevOps hat on, I wanted to create a CI/CD pipeline using GitHub Actions. I started building the pipeline using the examples available in the Azure/webapps-deploy repo. I got the pipeline to successfully execute, or at least run with no errors. It was deploying the entire solution directory! Well, that ain't gonna work.

For the purposes of this project, I just want to deploy the ASP.NET Core project. Using the .NET Core CLI, we can build the entire solution or individual projects.

We need to build the ASP.NET Core project only. In this example, we are using the Release configuration and I've told it not to restore NuGet packages because I did it in a previous step (not included in this blog post).

    - name: Build
      run: dotnet build ./NewWebsite/NewWebsite.csproj -c Release --no-restore

Next we need to gather the output for the project to be deployed. This example will publish the output of the NewWebsite project into a directory called publish located in the root of the repository. It will do it with the Release configuration.

    - name: Publish
      run: dotnet publish ./NewWebsite/NewWebsite.csproj -o ./publish -c Release

Once that is all gathered/packaged up, we need to deploy to the target Azure App Service. The value for app-name came from the Azure Web App Publish Profile. The publish-profile value is going to be the Azure Web App Publish Profile copied from Azure and added as a secret to your GitHub repository. The last part and the reason for this blog post, is the package setting. This should point to the directory you want to deploy.

    - uses: azure/webapps-deploy@v2
      with:
        app-name: 'newwebsite'
        publish-profile: ${{ secrets.azureWebAppPublishProfile }}
        package: ./publish/

That will deploy the contents of the publish directory to Azure. The trailing slash is important, if you leave that off, it will deploy the publish directory itself which is incorrect.

That's what worked for me. I hope this helps you with your DevOps experience.

Category: Uncategorized | Comments Off on Deploying an ASP.NET Project From a Multi-Project Solution Using GitHub Actions
June 1

Microsoft Certified: Azure Developer Associate

Microsoft Certified: Azure Developer Associate

As I posted back in March, I have completed another Azure certification (Microsoft Certified: Azure Developer Associate). This time I took the AZ-204: Developing Solutions for Microsoft Azure exam. I took the exam back on April 15th and because the exam was in beta when I took it, I just got the results of the exam on May 28th. It was the first exam I have taken here at the house as opposed to going to a testing center. It wasn't too bad except for the dogs barking and not being able to get up to tell them to knock it off.

The next one up will be Exam AZ-400: Designing and Implementing Microsoft DevOps Solutions to get the Microsoft Certified: DevOps Engineer Expert.

Thanks to this COVID-19 stuff, I'm still looking for a new opportunity. If you are looking for a .NET Core developer, let me know.

May 7

Virtual Brown Bag Meetings

Just recently Claudio Lassala and George Mauer have resurrected their Virtual Brown Bag Meetings on Thursdays from 12-1 pm Central. I like to attend them because it gives me a look at what people are doing outside of the tech stack I usually play in or ideas for new ways to play with my current tech stack.

Claudio posted something about the last meeting on LinkedIn where he said something to the effect of "come get alittle better than you are now". To that end, I'd like to share a piece of info I learned in today's meeting: Advanced Distributed Systems Desing (Online Course) from Particular Software is now FREE for a limited time. If you haven't heard of Particular, you should know that Udi Dahan works there.

If you have time next Thursday between 12 and 1 come join the meeting!

Category: Uncategorized | Comments Off on Virtual Brown Bag Meetings
March 30

Azure Certifications 2020

So thanks to this COVID-19 stuff, I suddenly find myself with more time on my hands. In an effort to try not to waste this time, I've decided to start taking some Microsoft Azure certifications. I have already taken AZ-900 Microsoft Azure Fundamentals. So the next step is gonna be AZ-204 Developing Solutions for Microsoft Azure which will give me an Azure Developer Associate certification. (Thanks for the idea Marianna!)

Oh, if you are looking for a senior .NET developer with Azure experience, let's talk and see if I can help you out.