On this episode of The DroidDevCast podcast, Esper Platform Evangelist Rin Oliver spoke with Deployed Principal Software Developer and Manning Publications author of Blazor in Action Chris Sainty to learn more about Blazor, a C# based front-end framework from Microsoft. Blazor blends HTML markup and C# components for use in front end web development, giving developers the the ability to also run C# in the browser. This is a compelling way for developers to leverage deep expertise in the Microsoft stack to build Android-based solutions for device fleets.
Sainty’s journey with Blazor started after finding a YouTube video series from Steve Sanderson, a developer at Microsoft on the ASP.NET team, showing the first prototype of Blazor. From there, Sainty was hooked. Having always had an interest in front end development, he saw the opportunity presented by Blazor, and began working with it by forking the project’s open source repository that the ASP.NET team had set up on GitHub. While making contributions to the project, Sainty began blogging about his journey with Blazor. He then created some open source packages for it, while continuing to write about the framework for a variety of media outlets. Eventually, he was approached by Manning Publications to author Blazor in Action, which will be available from Manning Publications the Summer of 2021.
Why Developers Should Consider Blazor
Blazor is a language that is, “Very productive,” Sanity noted, explaining that developers who have a background in C# will likely be able to get up to speed with Blazor and begin creating and producing applications quickly. “I think if you’re coming from that kind of background, the learning curve is quite shallow to be able to produce something, which I think is a massive benefit nowadays.”
“We live in a time where there’s lots of frameworks, there’s lots of different ways that you can do things,” Sainty said. “And sometimes that involves changing your stack, you have to jump from one language to another. That’s context switching.”
“Context switching takes away productivity because you have to kind of run down from one and ramp up onto the other.” But, “with Blazor, if you’re running .NET everywhere, then it just works and you can just get on with things,” said Sainty.
The Intersection Between Blazor and Android
While some may recall that .NET was previously strictly a Windows-based framework, this is no longer the case. Now a fully cross-platform option for developers, .NET and by extension, Blazor and its features, are available to Android, MacOS, and Linux developers as well.
“So if you’re an Android-based operating system, then all of this is for you,” says Sainty. “You can work with Blazor, you can work with .NET, you can work with C#, all the tools are there for you.”
“And Microsoft’s really committed now to this cross-platform model and exposing these products across all of the different operating systems for everybody to use. So I think that’s probably the key thing to highlight, really, is that if you’re an Android-based operating system, then there’s no limitations,” said Sainty.
Blazor particularly shines when developers have a .NET back end, and if one has a .NET API, it fits well there, however, Sanity notes that you don’t need .NET anywhere else in your stack in order to use Blazor.
One can write applications in Blazor and call them on any backend API they choose.
“The great thing is, if you’ve got an existing REST API and you’re interested in building a UI for it and visualizing some of that data, making some of those tasks a bit easier to do through a nice UI, then Blazor is a tool that can help you do that.” And let’s say you can build that agnostic of whatever your backend technology is,” said Sainty.
Another area that Blazor stands out in is that of GRPC-based APIs, but Sainty was quick to add that that feature, while impressive, isn’t one of the most powerful things that one can do with Blazor, adding that, “I think one of the most powerful things with Blazor is where you do have a .NET backend, because you can actually share code between your backend and your front-end, because it’s C# through the entire stack. You can actually take models, people call them different things, but DTOs, or models, or whatever that you would normally use to transmit data back and forth between the client and the API. You can take those and put them in a shared project, and you can reference that project from your Blazor app and from your API. And now if you want to update a model, you can do it in one place, and instantly both applications are using that new updated model.”
This means that rather than running into problems with TypeScript where things would eventually become out of sync between the front end and the back end, with Blazor, developers running full stack .NET application can share their model classes in a shared library, eliminating the need to update models to stay in sync.
Resources for Getting Started with Blazor
If you’re interested in learning more about Blazor, Sanity recommends the following resources to get you started on your journey:
In this Episode of The DroidDevCast:
00:55 – How did you get started with Blazor?
04:43 – What are some of the key benefits to working with Blazor for developers?
08:39 – What are ways that Android developers can benefit from using the Blazor framework?
10:46 – How can developers build and work with APIs using Blazor?
11:55 – What are some of the other ways that Blazor helps developers leverage the power of API-based solutions?
14:03 – What’s your favorite thing you’ve built with Blazor?
16:48 – What’s a piece of advice that you would give to someone that was interested in getting started with Blazor?
The full transcript of this interview is on Simplecast. Please subscribe to Esper’s YouTube to be first in line for future episodes of The DroidDevCast. Next week we’ll be dropping a panel discussion of expert takes on 2020 Android trends. Esper’s Yadhu Gopalan, Shiv Sundar, Keith Szot, Chris Stirrat, and Jasmine Henry will look at what happened in the Android ecosystem and what they think comes next.