01 Oct 2019

Web Development is About to Change in a Big Way

0 Comment

By: Joe Kunk

I love writing software. It is absolutely thrilling to create something from scratch that provides a new capability, solves a difficult problem, or revises an existing process for the better. Each new project represents a personal challenge to leverage new tools and recently learned techniques to code better or faster than last time. After decades of software development, coding is still very exciting and rewarding to me.

But I have a confession: I do not like writing web pages, specifically JavaScript. I avoid it. Even with tools like Typescript and advanced frameworks like React, Angular 2, Vue, or Backbone, JavaScript development is frustrating, and the learning curve is high. This has left a hole in my software development skillset that I desperately want to fill. Finally, there is a solution!

Released just a week ago, Microsoft Blazor will finally allow me and other developers to create rich, fast, secure web applications much easier and faster without becoming JavaScript experts!

How does it work?

I will try to keep this simple. Code written in a Microsoft C#.Net Blazor project is compiled and passed to the browser which runs it using another new technology called WebAssembly. The result is an application that runs much faster than JavaScript, more reliable, more secure, and easier to code. That translates to better applications delivered faster, using skills already possessed by a much wider range of developers. Wow!

Isn’t this just Microsoft Silverlight all over again? That failed …

No, it is not. Silverlight was a plug-in that ran independent of the browser. That allowed it to do many extra things, including running buggy code that would crash the browser. Blazor runs inside the browser so it cannot do anything special, it must follow the same rules as any web page.

Will it work in my browser?

Blazor will run on any PC or mobile browser that supports WebAssembly for Windows, Mac OS, and Linux. At this time, that includes Firefox, Google Chrome, Microsoft Edge, and Safari; I believe other browsers will support WebAssembly soon. 

Note that Microsoft has essentially abandoned Internet Explorer and it is unlikely to ever support WebAssembly.

Is it true that I don’t need to know any JavaScript?

The most likely scenario is that you will develop the web page layout with HTML and CSS, adding some simple JavaScript for basic screen functions. Blazor components will deliver the advanced functionality beyond that. But the JavaScript learning curve for this is much less than building a full JavaScript application.

There is no need to throw away your existing JavaScript; you have the best of both worlds. Blazor can call JavaScript and vice-versa. You can add little pieces of Blazor to your existing JavaScript application or write your Blazor application to call JavaScript where it makes the most sense.

Is Blazor more secure than JavaScript?

It can be. JavaScript is text readable code in the page and therefore can be changed by a bad actor that can intercept the page before it is delivered to you. Any HTTP page (not HTTPS) is at risk for this. Blazor is binary compiled code that is not human-readable, so much less at risk for this kind of attack.

How does Blazor make me a more productive developer?

Write less code. The exact same C# code can run in both the server and the browser. Before Blazor, you had to write JavaScript to verify use input in the browser, then verify it again in C# when it was sent to the server. Now one copy of the validation does both.

Code more efficiently. Blazor applications are developed in Microsoft Visual Studio 2019. VS has continued to evolve since its first release in 1997. I believe VS to be the best development IDE available for Windows developers and little-brother VS Code is available on Mac OS and Linux. Blazor apps can be written in the Community Edition, which is free to students, individual developers, and open-source contributors.

Use existing code. Blazor applications can use existing tools for building layouts, navigation, unit testing, etc. You have much less code to write, just call what you need. Automated unit testing runs tests on your code to make sure it is working properly before you deliver it, much fewer bugs!

Who will benefit the most from Blazor?

Developers who are already comfortable with Microsoft C# will be the first. 

Developers that are new to the web will appreciate the much-lower learning curve for C# compared to advanced JavaScript. Learning C# provides the benefit of using the same skills to also build desktop and cloud applications, not just web applications.

Those already proficient in JavaScript should learn Blazor to supplement and enhance their applications, using the best tool for the feature.

What do I see for the future of Web Development?

I expect to see other browsers such as Opera and Netscape Navigator adopting WebAssembly. I also expect to see other languages such as Java, VB.NET and Python eventually running on WebAssembly. The languages C, C++ and Rust can already run on WebAssembly. Over the next couple years, I expect to see more and more developers choosing Blazor over large JavaScript frameworks due to the improved productivity.

Is Blazor production ready?

Like any brand-new technology, Blazor has a few initial bumps. Initially loading the C# assemblies is a few seconds slower than JavaScript. However, once loaded, it runs much faster for the entire life of the web page. Microsoft has committed to improving this. Additionally, C# assemblies need to be translated into WebAssembly after they load in the browser; that translator called Mono for WebAssembly is not finished yet, with no release date announced at this time.

Now is the time to experiment with Blazor and decide how it will fit into your web development strategy. It will be ready for production use as soon as the new version of Mono is completed. This is a high priority for Microsoft, so I look to see it before the end of the year or early 2020.

About the Author

Joe Kunk is a Senior Software Architect for Dewpoint in Lansing MI. Joe is a five-time Microsoft MVP and former author at Visual Studio Magazine. 

Joe is an organizer for the local GLUGnet Microsoft.Net Developers user group (https://www.meetup.com/glugnet/) and the GLASS SQL Server user group (https://www.meetup.com/GLASS-Greater-Lansing-Area-for-SQL-Server/). 

Joe can be reached at Joe.Kunk at Dewpoint dot com or on his mobile phone at 517.719.9557.

[top]
About the Author