4 Benefits of Migrating to ASP.NET Core 2.0
4 Benefits of Migrating to ASP.NET Core 2.0
With ASP.NET Core 2 released, should developers start migrating their code? In today's post, I'll show four benefits as to why you should migrate your code to Core 2.0.
Join the DZone community and get the full member experience.Join For Free
Learn how error monitoring with Sentry closes the gap between the product team and your customers. With Sentry, you can focus on what you do best: building and scaling software that makes your users’ lives better.
With the onslaught of .NET Core 2.0 blog posts and coverage released over the past week, I'm sure the most asked question in the developer community is, " should I migrate my web application to ASP.NET Core 2.0?"
My heart says answer with a resounding "YES," but my head is forcing me to say "it depends."
While there are a number of reasons to move to Core 2.0, it all boils down to what your application is currently written in. Is it currently written in ASP.NET 1.1? ASP.NET MVC 2.0? ASP.NET WebForms?
I know I addressed this previously with a post called Transitioning to ASP.NET MVC Core, but I feel today's post is more of an overview of how upgrading from one technology to another can give you tremendous gains without even trying.
In this post, I'll show you some benefits and why you should migrate your application to the new "hotness" and how it gives you dividends in the long run.
Benefits of Migrating to Core 2.0
The most obvious benefit is performance.
As newer technology and language enhancements emerge, code is automatically optimized when you compile your code.
The best part about this particular benefit is you don't need to change your code. The compiler will, by nature, optimize your code when re-compiled with the new language enhancements.
TechEmpower publishes their ongoing Web Framework Benchmarks (Round 13) on over 230 framework implementations with ASP.NET Core making huge strides in performance.
Since the Round 11 results, the recent (well, last year) results from Round 13 proclaim ASP.NET Core has performed at a jaw-dropping 85,900% improvement.
Yes, 859 times faster than Round 11.
This proves Microsoft made a long-term commitment to performance in ASP.NET Core.
With these new language features, you write less code.
A couple examples of less code is include:
- LINQ (Language INtegrated Query: removes a LOT of for..next loops in your code making it easier to write a one-liner loop.
- In-line ternary operator (?): removes the need for a simple if statement also making it a one-liner.
Keep in mind these have always been in C#, but I'm using these as examples of new language changes to help the developer community.
These language enhancements provide ease of use, yet there is a drawback.
To a developer who doesn't pay attention to new language changes, they may be resistant to change and think a for..next loop is just fine instead of using a LINQ statement.
Sometimes you can lead a horse to water...
Less code is always welcome in my eyes.
As a matter of fact, the C# team continues to enhance the C# language with even more enhancements in version 8.0. Seth Juarez from Channel 9 has a great video with Mads Torgensen discussing what's on the drawing board for C# 8.0. Also, the complimentary article about C# 8.0 on InfoQ.
Quick Note: If you are looking to create less code with C#, I would recommend Code Katas for practicing your coding skills.
When there is lesser code, it's always easier to maintain.
However, it may not be as easy for a developer to notice a strategy pattern or an In-line ternary operator (?), but to a veteran developer, one should know how to optimize code with as few statements as possible.
Keeping up with the latest enhancements of the language is always part of the job whether you're a web architect or an entry-level developer.
You should always be aware of the latest changes to the language.
Yes, .NET is cross-platform. You can now write applications for Mac, Linux, oh... and Windows.
This particular benefit gives businesses the ability to gain more traction on other platforms. For example, using Xamarin, you can build an Android mobile app, turn around, and use that same logic while building an iPhone front-end.
All while using the same C# code. The only thing you need to code is the front-end (iOS, Android, or Windows).
Using the new .NET Standard libraries will give you your cross-platform capabilities. As a side note, PCLs (Portable Class Libraries) are deprecated).
I've already had a couple readers ask me if it was ok to transition their applications over to Core 2.0.
I can sit here and say everyone should move to Core 2.0, but I don't know your application. There may be Shell commands in your application or serialization issues that Core 2.0 doesn't know how to handle.
My point is to proceed with caution, but keep that forum tab open just in case you have a question.
What is moving you towards ASP.NET Core 2.0? Performance? Cutting-edge? Your Boss? Post your comments below and let's discuss.
Published at DZone with permission of Jonathan Danylko , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.