RIP, James Bond. While watching Goldfinger last night, I forgot about the best feature of Connery Bond films: if you’re confused about the plot, the villain will explain it all to you right before the movie ends. Ah, the original “let’s have retro before the sprint ends.”
- Is Blazor ready for the enterprise?
- Dev Discussions: James Hickey
- Last week in the .NET world
Is Blazor ready for the enterprise?
If you’re slinging code for a decent-sized company, you might be wondering if Blazor is ready for the enterprise. Can you convince your pointy-haired bosses to use it for new, and maybe existing, apps? I think it’s ready. However, this isn’t an “easy yes”—it involves a nuanced answer. We’ll answer this question by answering some common questions.
Is it supported with a good ecosystem? Because Blazor lives in the .NET ecosystem, it comes with official Microsoft support just like any other product (and, last week, we discussed .NET 5 support). Additionally, Microsoft continues to devote significant investment in it and has a long history of backwards compatibility. The ecosystem is not as evolved as it is with Angular and React—they’ve had a head start—but is growing tremendously. As Peter Vogel mentioned, Blazor already has 25% of the interest that Vue has (from Google Trends).
Does it perform well? Compared to other SPA frameworks, Blazor’s performance is … fine? It’ll pass the eye test with Vue and whatnot in most cases but there will be some waiting—Blazor Web Assembly has a large-ish download size (as its loading .NET in the browser), and Blazor Server has a network hop for each user interaction. The team has made a lot of progress in addressing performance, and AOT compilation is the most popular request for ASP.NET in .NET 6 (and will impact non-Blazor apps in ASP.NET as well). If you’re dealing with huge amounts of data, you might want to wait for these improvements—but should be suitable in most business cases.
Dev Discussions: James Hickey
When designing a real production system—especially over the web—there’s a lot to think about past coding features for stakeholders. For example, how do you manage events? What about scheduling tasks? What about your caching mechanism? A lot of these considerations make you wonder if they should be supplied out-of-the-box with ASP.NET Core.
James Hickey’s Coravel project is here to assist. Billed as a “near-zero config .NET Core library that makes task scheduling, caching, queuing, mailing, event broadcasting, and more a breeze,” it ships with an impressive set of free features—and you can look at Coravel Pro for a professional admin panel, UI management, health metrics, and more.
I caught up with James to talk about his project, software design, and more.
As the author of Refactoring TypeScript, what are your biggest tips on keeping a codebase healthy?
- Simplicity rules the day. If you “feel” like your solution is getting complicated, then step back or take a 15-minute walk!
- Reuse is over-hyped. It leads to coupling. Coupling more often-than-not causes trouble down the road.
- Abstract I/O from other kinds of logic. Don’t do direct database or file system access from the core logic in your system. Put that behind an interface.
- If you want to get good at designing code, then get good at knowing how to build unit tests that have minimal (or no) mocking/stubbing.
- Use automated quality analyzers to fail builds when code standards are violated.
- Fix broken windows.
Let’s talk about your Coravel project. I love your bold selling point: “Near-zero config .NET Core micro-framework that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!” Can you walk through what caused you to pursue this project, how Coravel can help me, and how it works with existing .NET projects?
Back in the day when I was building .aspx WebForms, I discovered the PHP framework Laravel and loved how it included all these additional features like queuing, task scheduling, and so on out of the box. When .NET Core was gaining traction, I found myself wanting some of the conveniences of Laravel but in .NET Core.
Coravel can help you get a new project up-and-running faster by including things like automated task scheduling, background task queuing, and so on out of the box without having to install extra infrastructure. It works with any .NET Core projects and is (supposed to be) super easy to install, configure and use.
For scheduling and event management, I know a lot of folks like utilizing things like triggered Azure Functions and Service Bus and the like—is there an advantage to using Coravel over that?
One disadvantage is that Coravel doesn’t (yet!) support distributed scheduling, queuing, and caching features. One advantage though, again, is you don’t have to install any additional infrastructure. You can install a NuGet package, add a couple lines of code and you’re good-to-go!
You can use Coravel and these other products together, too. For example, we often use a distributed service bus to integrate separate systems via async messaging. Coravel can support the internal integration within a system—like how you might emit domain events between aggregates. Doing this in-memory has certain advantages. Jimmy Bogard, for example, has written about using in-memory domain event processing.
I know by default, Coravel caching is in-memory (but has options to persist to a database). How does this compare to something like Redis?
Again, using Coravel you won’t have to muck around with installing, configuring, and so on with that additional infrastructure. Redis is a fantastic product and I’m hoping to eventually offer providers for Coravel to hook into Redis—which could make using Redis caching, messaging, and so on even easier. I just need to find some time 😉.
Do you view Coravel as an enhancement over the BCL, or filling in for some of its shortcomings? This is part of a broader thought about OSS’s role within .NET Core.
I view Coravel as enhancements over the BCL. I wouldn’t expect to see these features included in a barebones console application, for example. But when it comes to web applications, these are all features that you’ll need pretty much out-of-the-gate if it’s anything more than a demo application.
I’m a fan of your “Loosely Coupled Show” that you run with Derek Comartin (sure beats the “Tightly Coupled Show”)—a great spot to discuss software architecture and design. In such a fluid industry, are there any firm principles you are stubborn about?
Generally, I stick with using a feature folder approach to structuring any projects I work on. I’ve written about this before and Derek just wrote about it. I’m a huge fan of CQRS and think it fits perfectly with the feature folders approach.
I’ve given a talk on these topics at the Florida .NET meetup if anyone’s interested in hearing more about it.
Check out the full interview at my website.
What is your one piece of programming advice?
Make sure you get lots of sleep and step outside once in a while. 😅
🌎 Last week in the .NET world
🔥 The Top 5
- Jimmy Bogard finds a .NET 5 breaking change with IndexOf.
- Jeremy Likness asks for help planning EF Core 6.0, and also announces version 1.0 of .NET for Apache Spark.
- James Newton-King walks through gRPC performance improvements in .NET 5.
- Damien Bowden uses Azure Cognitive Search suggesters in ASP.NET Core and autocomplete.
- Rachel Appel builds serverless apps from Azure Functions.
- Tara Overfield offers the .NET Framework October update for Windows and Windows Server.
- Lily Ma outlines the Azure SDK GitHub issue support process.
- Leslie Richardson talks about the future of Visual Studio extensions.
📅 Community and events
- For community .NET standups, we’ve got a brand new game dev standup, Entity Framework talks about EF Core 5 collations, and ASP.NET talks about updating Scott Hanselman’s blog to .NET Core.
- The .NET Docs Show talks with Sam Basu about Blazor and Comet for Native Mobile Apps.
- You can check out a stream of this weekend’s .NET Dev Summit 2020 - Asia Pacific.
😎 ASP.NET Core / Blazor
- Dave Brock (ahem) introduces his Blazor project, and also writes and tests a 404 Blazor component.
- Jon Hilton asks: should your enterprise pick Angular, React, or Blazor?
- Scott Hanselman uses the ASP.NET Core environment feature to manage development vs. production for any config file type.
- Jeetendra Gund passes multiple parameters to a GET method in ASP.NET Core MVC.
- Thomas Ardal talks about how he does bundling and minification in ASP.NET Core.
- Filip Woj shows off compact APIs with C# 9, .NET 5, and ASP.NET Core.
⛅ The cloud
- Paul F. Wood discusses when, why, and how to use Azure Key Vault.
- Matteo Prosperi tinkers with client-side Blazor and the AWS SDK for .NET.
- Nwose Lotanna Victor deploys an Angular app with Azure Static Web Apps.
- Ben De St Paer-Gotch sets up cloud deployments using Docker, Azure and Github Actions.
- Matthew Jones writes about interfaces and abstract classes in C#.
- Munib Butt shows off the Producer Consumer pattern in C#.
- Tomasz Pęczek consumes JSON Objects Stream with HttpClient.
- Khalid Abuhakmeh generates QR codes with C#.
- Nick Gamb authenticates with SAML in ASP.NET Core and C#.
- Eric Potter upgrades a .NET Framework library to .NET 5.
- Jason Farrell continues his series on unit testing.
- The Uno Platform Team discusses WebAssembly tools, frameworks, and libraries for .NET devs.
- ErikEJ sets the command timeout with the latest .NET SqlClient.
- For Visual Studio: Mads Kristensen offers tips on searching in Visual Studio, and Steve Smith configures Visual Studio to name private fields with underscores.
- Andrew Lock monitors Helm releases that use jobs and init containers.
- Over at Code Maze, they work with Elasticsearch in ASP.NET Core.
- Rajeev Bera talks about Git tips and tricks.
- Sanjay Modi uses MiniProfiler in ASP.NET Core 3.1.
- Mark Seemann talks about how to keep REST API URLs evolvable.
- Charlin Agramonte says: stop doing IsVisible=”true/false” to show hide views.
- Jean-Marie Alfonsi discusses Sharpnado.Tabs 2.0.
- Leomaris Reyes replicates an event app UI.
The 6-Figure Developer podcast talks about managing cloud cost with Omry Hay.
- Kathleen Dollard talks about the difference between .NET Core, .NET 5, and .NET Framework.
- Data Exposed talks about creating your first Azure SQL database.
- Jeff Fritz talks about SOLID and dependency injection in C#