Dave Brock

Madison, WI

I'm a software developer living in Madison, Wisconsin.

When working on legacy projects (or even new ones!) you are bound to come across code that is interesting—and trust me, your colleagues will say the same about your code from time to time!

There's always a balance between terseness and readability, and sometimes you can go overboard. Here's one I see sometimes that I don't particularly enjoy.

// C# syntax
public bool CheckABoolean(int a)
    if (a > 42)
        return true;
        return false;

Instead, do this. Your eyes and your colleagues will thank you.

// C# syntax
public bool CheckABoolean(int a)
    return a > 42;


How 2018 Went

I'm not a fan of resolutions—how very watterfall-y. In this fail-fast agile culture we live in now, that's a long time to wait to fix things. But since it is the end of the year—a great time for downtime and reflection—it's only natural to take a look back at how the last 365 days went.

Here's why I especially like this exercise: for a lot of us, it's so easy to be self-critical. It's very important to learn and grow from your mistakes but equally important to understand and reflect on your accomplishments.

A mission to become active in the community

In 2018, I made it my mission to become active in the community.

Why? Here are my reasons:

  • Learn by doing: I learn much more when releasing something out into the world
  • Meeting great people: You can reach out to others, make friends, and get out of your bubble by drawing on other's experiences
  • Help others: The developer community has helped me throughout my career and I love being able to do the same
  • Your job: You and your employer benefit greatly from all your work

While I previously enjoyed engaging with the community—a talk here, a post there—I largely was a consumer. At this point in my career, I wanted to give back and help others.

I'm proud to say I reached thousands of developers in 2018 with conference talks, blog posts, and open-source community contributions.

Blogging contributions

Did you know before I went into software development, I was a technical writer? True story. In 2018, I really enjoyed mixing my writing experience with technical expertise to help developers across the globe.

I initially started blogging so I could fill knowledge gaps while preparing for conference talks. As a result, I was pleasantly surprised to learn that my posts reached more people than I would have ever imagined. This reinforced one of my core beliefs: if you learn something, never keep it to yourself. Share it with your friend, your team, or—even better—the world.

Here's a list of my most popular posts this year, according to Google Analytics.

Speaking events

Much like a lot of people, public speaking used to frighten me. I could always speak casually at work, but when I was in front of people everything changed. It was so difficult for me I started to worry about it harming my career.

I tried a casual lunch session at work in front of friends and co-workers. It wasn't pretty at first, but I was happy to conquer my fears head-on. As I kept speaking and my confidence grew I also came to a realization: I actually like doing this.

For example, at Twin Cities Code Camp in April I spoke in front of about 100 people—my first time in a group this large. It was a great feeling to not be completely mortified of public speaking anymore.

I'm not a great speaker by any means, but I'm getting better after every talk I give. It's time-consuming, exhausting, and sometimes scary. But when someone comes up to you after a talk and thanks you for teaching them something new, it's all worth it.

In 2018, I spoke at these events:

  • South Florida Code Camp
  • Twin Cities Code Camp
  • Central Wisconsin IT Conference
  • MADdotNET (.NET user group in Madison, WI)
  • Milwaukee Code Camp
  • Chicago C# Developers Group

Open-source contributions

As a developer in the .NET space, it's great to see how Microsoft has transformed into an open and inclusive culture. For example, if you see an issue or content gap with developer documentation you are empowered to suggest a fix or even do it yourself.

I made a lot of contributions to the ASP.NET Core documentation this year—and in total, I had 38 pull requests merged and live. Obviously, some of them were cosmetic (I'm not immune to a "typo fix" commit) but was happy to be a big community contributor to the documentation this year.

The entire ASP.NET Core Docs team deserves a lot of praise for living open source (I've personally worked with Rick Anderson and Scott Addie the most on that team). It isn't easy being out in the open, but they live it and are truly community-driven.

Looking ahead

It was great being a part of the community this year, and hope to make 2019 even more impactful. If you have any feedback for me—including talk ideas or general suggestions—let me know!

If you do any work in open source, you probably live for GitHub. With all the time you spend using it, you can improve your experience by leveraging a variety of browser extensions.

The following is a rundown of my favorite GitHub extensions on my preferred browser, Google Chrome. While I am focusing on Chrome extensions, you'll find that there are plenty of GitHub extensions for other browsers, too.

Do you prefer a GitHub extension not listed here? Let me know in the comments!

Awesome Autocomplete for GitHub

The Awesome Autocomplete for GitHub extension, by Algolia, is by far my favorite GitHub Chrome extension.

This extension supercharges the top GitHub search bar by adding auto-completion, last active users, top public repositories, and more.


You can even type aa<space> to find GitHub repositories directly from your Chrome address bar!

File Icon for GitHub, GitLab and Bitbucket

The default file icons in GitHub are so, so boring. Are you tired of seeing the default notepad icon next to every file, no matter the extension?

The File Icon for GitHub, GitLab and Gitbucket extension, by Homer Chen, adds file icons to GitHub repositories. Personally, this makes it easier for me to find certain files in folders with many files.


GitHub Code Folding

Any reasonable code editor gives you the ability to easily expand or collapse code blocks for readability. The GitHub Code Folding extension, by Noam Lustiger, allows you to do this inside the GitHub user interface.


GitHub Repository Size

The GitHub Repository Size extension, by Harsh Vakharia, is another extension that is short, sweet, and useful.

The extension lists the size for an entire GitHub repository and also the size of each file.


Hide Files on GitHub

The Hide Files on GitHub extension, by Sindre Sorhus, hides nonessential project files and folders from the GitHub user interface (like Yarn lock files, the .git folder, and so on). Of course, you can customize which files to ignore.

Isometric Contributions

The Isometric Contributions extension, by Jason Long, shows an isometric pixel art version of a user's contribution chart. It also includes more granular user data, like a user's busiest day, current streak, and longest streak.

Of course, you can easily switch between the isometric view and the default view. This extension does not have certain functionality like hovering over a day for details.


Notifier for GitHub

The Notifier for GitHub extension, by Sindre Sorhus, displays your unread GitHub notifications count. This way, you can keep track of any missed notifications even when you don't have GitHub open.

(The screenshot grabbed from the extension's repository.)



I cannot do without the Octotree extension. This extension offers an easy-to-navigate code tree, allowing for lightning-fast browsing of a repository's files.


Refined GitHub

The Refined GitHub extension, by Sindre Sorhus, offers a slew of features that is missing from GitHub. If you look at the repository, you'll see that GitHub has integrated functionality that was first developed in this extension.

Some functionality includes the ability to mark issues and pull requests as unread, reaction avatars on comments, clickable references to issues and pull requests, and links to an issue's closing commit or pull request.

Render Whitespace on GitHub

Where do you stand on the tabs vs. spaces argument? You can only pick one. (In an effort to keep all my readers, I will abstain from this one.)

The Render Whitespace on GitHub extension, by Gleb Mazovetskiy, allows you to quickly find out the formatting of a repository's code.


Twitter for GitHub

When I discover a GitHub repository, I like to find out information about the author—generally this includes following the person on Twitter, which is often the best place to contact someone or and learn about them. If the author does not include their Twitter handle in his or her GitHub bio, it can be tedious and time-consuming to search on Twitter.

The Twitter for GitHub extension, by Nicolás Bevacqua, attempts to find a user's Twitter handle and display it on a GitHub profile.


The beauty of a cross-platform framework like ASP.NET Core is your ability to choose tooling you prefer. With all its advantages, Visual Studio can sometimes be too powerful for what you need.

With ASP.NET Core, the days of being locked down to writing .NET in Visual Studio are over. For example, you can write your applications on editors like Visual Studio Code, whether you are on Mac, Windows, or a flavor of Linux.

Earlier this year, I spoke and wrote extensively about how to write an ASP.NET Core app with Visual Studio Code. As this support is evolving, you may notice experiences here and there that do not compare to using a full-fledged editor like Visual Studio—but if you are using Code for your Core apps you may find the trade-off worth it.

That gap is narrowing with the announcement that Visual Studio Code now has support for Razor, the .NET markup syntax engine that allows you to write dynamic views using .NET code and HTML markup.

Take advantage of Razor support in Code

Before you look at Razor support in Code, create an ASP.NET Core application in Visual Studio Code. We will just create an application based on the ASP.NET Core web application template. (For an in-depth tutorial on using ASP.NET Core with Code, you can review my blog post or an in-depth tutorial at the official Microsoft Docs site.)

As prerequisites, make sure you have Visual Studio Code, the C# extension, and the .NET Core SDK installed.

Create a quick .NET Core web app in Visual Studio Code

From Visual Studio Code, enter the following commands from the integrated terminal (if you don't see it, click Terminal > New Terminal):

dotnet new webapp -o TestRazorSupport
code --reuse-window TestRazorSupport

The first command uses the .NET Core CLI to create a new application based on the webapp template. The application now exists within a TestRazorSupport folder. The second command uses a Code command-line switch to open the application in your active Code window.

Now, you can open any view file (.cshtml) to experiment with Razor support.

Explore Razor support in Visual Studio Code

If you open a view—I will be looking at Pages/Contact.cshtml—you can see Razor support in action.

First, let's update the ContactModel with some additional properties. Here's what my Contact.cshtml.cs now looks like:

using System;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace TestRazorSupport.Pages
    public class ContactModel : PageModel
        public string Message { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }

        public void OnGet()
            Message = "Your contact page.";
            Name = "Dave Brock";
            Email = "dave@myemail.com";

In Contact.cshtml, let's access the Name property to check out the Razor support.

It works as you would expect—even inside HTML attributes—as we access the Email property:

And if we access .NET APIs (and steal from the announcement) it works beautifully!

Disclaimer: Support currently in preview

As discussed in the announcement, this is very much in preview and has limitations. Read the article for details on what these limitations are, how to provide feedback, and how to disable it if you come across issues.

(Some context: Blazor is an experimental .NET web framework using C# and HTML in the browser. See the preview documentation for more details on the project and how to get started.)

As developers, we often take advantage of the benefits of sharing common code in a specific project. That way, it can be shared and maintained in a centralized way - accessed easily whether it is your team's source control repository or, in the .NET world, a NuGet package.

This is no different with Blazor. When we use shared libraries, we can easily share components across projects. When we share components, all our target project needs to do is reference the shared project and add the component - no style imports necesssary!

In this article, we will demonstrate the power of Blazor shared libraries using a simple example with the default scaffolded Blazor application.


Before getting started, make sure you have the following minimum prerequisites installed:

Create a Blazor application

Let's create a Blazor application.

  1. From Visual Studio 2017, click File > New > Project and select the Visual C# > .NET Core > ASP.NET Core Web Application.

  2. Give it a name, like MySharedLibDemo, and click OK.


  3. Select the Blazor template and click OK. This will scaffold a default SPA application that is integrated with WebAssembly.

  4. After the scaffolding completes, click Debug > Start Without Debugging to run the application. Your site should resemble the following.


    Leave this running so we can save the application in Visual Studio and reload it.

    Next, we'll add a shared Blazor library. At this time, a Blazor shared library is not available in Visual Studio. We'll use the .NET Core command-line interface (CLI) to accomplish this.

  5. Right-click the solution and select Open Command Line. From your preferred command line utility, enter dotnet new to see all the .NET Core templates available to you. We will be adding the Blazor Library template to our project.


  6. From your prompt, enter dotnet new blazorlib -o MySharedBlazorLibrary. This will add the MySharedBlazorLibrary project in your directory.

  7. Right-click your solution and click Add > Existing Project. Browse to your library, select the MySharedBlazorLibrary.csproj file, and click Open. Your project structure will now resemble the following.


  8. Finally, reference the shared project. From your main project, right-click Dependencies > Add Reference... Then, select your newly created project and click OK.

Update the ViewImports.cshtml file

For Blazor to use your shared project, add the following line to the _ViewImports.cshtml file that sits at the root of your main project.

@addTagHelper *, MySharedBlazorLibrary

This is a temporary solution. The Blazor team hopes to have this resolved. Until then, this is a required step.

Add shared component to your main project

Now, all you need to do is add the component to your project. If you remember, the shared project includes a Component1.cshtml file that includes a styled component. We will now add this to our main project.

From your Pages/Index.cshtml file, below the SurveyPrompt component, add the Component1 component. As you begin typing, you can use IntelliSense.


Your Index.cshtml component should now look like this:

@page "/"

<h1>Hello, world!</h1>

Welcome to your new app.

<SurveyPrompt Title="How is Blazor working for you?" />

<Component1 />

Notice you don't even need a @using statement in your view to reference your component!

View your changes

After you save your changes, reload the page to see your new component in action.


You have just referenced a component from a shared library with minimal effort. By merely importing the library, you were able to add a component and its styles quite easily.