The Good and the Bad of .NET Framework Programming
.NET is a software development framework and ecosystem designed and supported by Microsoft to allow for easy desktop and web application engineering. It’s a popular free platform currently used for a lot of different types of applications as it provides the programming environment for most software development phases. .NET best suits the businesses that look for a wide range of features like web-based services, desktop software, and cloud infrastructure support.
Microsoft started working on .NET framework in the late 90’s. Since then this tool has undergone a great transformation and now is accompanied by a rich ecosystem represented on the picture below.
.NET ecosystem before 2016
.NET development platform
The .NET comes in three flavors: .NET Framework, .NET Core, and Xamarin. These implementations combined are called .NET development platform. Each of them contains frameworks and libraries to build various applications.
The .NET Framework is the first and the oldest implementation of the platform. It includes three main application models – WPF, Windows Forms, ASP.NET Forms – and Base Class Library.
Windows Presentation Foundation (WPF) is a UI framework used for creating graphical interfaces primarily for desktop client applications on Windows OS. WPF uses the capabilities of Extensible Application Markup Language (XAML).
Windows Forms is a GUI class library within .NET Framework. Windows Forms are used to develop desktop applications with rich graphics that are easy to update and deploy.
ASP.NET. While the previous two components are designed for desktop engineering ASP.NET is used to develop dynamic websites and web applications. There is the Common Language Runtime (CLR) in its core that gives the opportunity for developers to write ASP.NET code using different .NET languages. Common Language Runtime is an application virtual machine that manages memory, implements code access security, verifies code safety, and provides execution of threads and code.
Base Class Library (BCL) provides the most common functionality like classes in namespaces and is the core of the Framework Class Library (FCL), a set of reusable interfaces, classes, and value types that are closely integrated with the Common Language Runtime (CLR). The combination of FCL and CLR constitute the .NET Framework.
As .NET Framework supports only Windows-based devices and the need for a cross-platform package occurred.
.NET Core was released in 2016. It’s a cross-platform re-build of .NET Framework. Unlike the old version, engineers can now use the product on Linux and OS X and create applications that aren’t necessarily tied to the Windows family. The new system aims at conquering the cloud space as some providers like Digital Ocean are Linux-driven. Not only .NET Core is cross-platform, its different versions can be installed side-by-side on the same device. .NET Core includes ASP.NET Core and Universal Windows Platform (UWP).
Universal Windows Platform (UWP) is an API created by Microsoft and used to develop the universal apps that run across all compatible Microsoft Windows devices, i.e. Windows, Windows Phone, and HoloLens.
ASP.NET Core is a re-build of ASP.NET that happened to be a more modular framework than its predecessor. ASP.NET Core allows you to build mobile backend, web apps and services. It’s also cross-platform and runs on OS X, Windows, and Linux.
The third implementation is called Xamarin and is used for mobile applications and Mac products. Originally, Xamarin was designed independently from Microsoft and was a proprietary product until Microsoft acquired it in 2016 making a fully open source branch of the .NET platform. Xamarin uses the Mono runtime and a version of the .NET Framework adjusted to work with APIs for iOS, Android, and Xamarin.Mac. To get an elaborate overview of this product, check our Xamarin pros and cons article.
All runtimes use a common infrastructure that makes the entire ecosystem work. It provides runtime components, languages, and compilers.
In 2016 Microsoft also introduced .NET Standard, a library that combines APIs from .NET Framework, .NET Core, and Xamarin allowing engineers to use a single base class library rather than mastering three different ones related to each .NET implementation. This step unified the ecosystem and brought a higher consistency into reusing components across different platforms.
.NET ecosystem after 2016
.NET development platform is best served with Visual Studio IDE used for building, debugging, and publishing applications across all platforms and devices.
Currently, the most popular implementations of .NET are .NET Core and Xamarin. So, let’s look deeper at the advantages and drawbacks of using .NET development platform. Most of the points can be applied to the entire ecosystem, while some of them relate only to its specific components, which we’ll specify in the respective sections.
Pros of .NET development
Object-oriented software development model
.NET is based on the object-oriented programming (OOP). OOP is a development model with the idea of breaking down software into smaller pieces that are easier to manage and combine. OOP compartmentalizes data into objects, i.e. data fields, and describes objects behavior and contents through the declaration of classes.
A modular structure helps define behavior of objects and their interactions without managing object inner attributes. OOP simplifies programming by making the code manageable, easier to test, and respond to recurring issues. It also eliminates unnecessary programming and generally means less coding for developers. .NET makes it possible to reuse code and components, save time and – subsequently – the cost of development.
Reliable and simple caching system
Caching means keeping data in a temporary storage place to call it faster when needed. The stored data is the result of an earlier information request or the duplicate of information stored in other places that would take longer to retrieve from.
The caching system in .NET is robust and simple to use. It’s also designed to be extensible. The Object Cache class allows developers to create a custom cache implementation to be used for improving performance and scalability of Windows client and server applications.
Visual Studio IDE
An Integrated Development Environment (IDE) is a single product for programmers which makes application development easier by providing all tools to write and test software.
Visual Studio is a Microsoft IDE used for building, debugging, and publishing applications across all platforms, including Android and iOS. The Visual Studio is integrated with .NET and provides the features of language-specific environment.
The key features of the Visual Studio IDE:
- It’s used as a single IDE for all .NET applications
- The IDE has integrated compilation and debugging features
- The solution can be used for applications based on code written in different languages
- The Visual Studio allows for customizing the environment to match user preferences
On top of that, Visual Studio Marketplace offers a wide range of editor extensions from Microsoft and other providers to enable team collaboration, continuous integration, third-party connections, cloud development management, etc. You can find out more about Visual Studio extensions and other tools that enhance .NET development in our dedicated article.
Cross-platform design and language independence of .NET Core
.NET Core is a cross-platform .NET implementation that allows the code to run on OS X, Windows, and Linux. Unlike the original .NET framework – which is only partly open – .NET Core has a fully open source code which ensures that a wide engineering community can continuously contribute to its development.
If you’re writing in C#, F#, or Visual Basic, your code will run on each of the compatible operating systems. This enables companies to reach the widest variety of platforms staying within the .NET ecosystem. At the same time, cross-platform design and language independence ensure that the whole .NET community with a large pool of different engineering skillsets shares experience. Currently, .NET supports more than 25 languages including C#, Visual Basic.NET, J#, Managed C++, IronPython, and IronRuby.
.NET language independence
Flexible deployment and easy maintenance
One of the important .NET Core features is flexible deployment. It can be installed as a part of your application or require a separate installation. The modular design allows for including all the dependencies you need. The deployment itself is as easy as copying a folder.
Another benefit is that you can have multiple .NET Core versions running side-by-side on the same machine to cover different projects and seamlessly perform deployment tasks.
Universal .NET Standard
Since 2016, the .NET ecosystem was enhanced with a large class library called .NET Standard. It’s based on the number of base class libraries for .NET Framework, .NET Core, and Xamarin. These are used to work with common functions such as graphics rendering, database interaction, and manipulations with XML documents. The .NET Standard library greatly simplified developer’s work.
Prior to .NET Standard, a programmer had to redevelop an application or a library for the new platform and then distribute all the updates across various platforms. Currently, the library supports all dependent libraries across applications. However, you should check version compatibility to successfully leverage .NET Standard.
You may check your product compatibility with .NET Standard here and track updates on the Microsoft documentation site
.NET has a large community of developers. Interestingly, it unites engineers from small, midsize, and enterprise-grade companies. This means that almost any issues can be solved with the help of community members.
Since .NET Core is open source, its libraries, runtime, and compiler are available on GitHub and have many contributions. According to Stack Overflow 2018 survey, two .NET products are in the shortlist of the most popular technologies: .NET Core is on the fourth place and Xamarin took the ninth.
Most popular frameworks Stack Overflow Survey 2018
On top of that, there is an independent organization called .NET Foundation that fosters open development and teamwork around the .NET ecosystem. .NET community and commercial developers use it as the main forum for idea exchange.
Automatic monitoring in ASP.NET
ASP.NET has built-in automatic monitoring. The Windows Web Server strictly monitors web pages and applications that run on it. In case any issues such as the memory leaks or infinite loops occur, it immediately alerts about them. This allows for directly correcting these behaviors and creating new processes. The monitoring ensures higher stability and transparency of .NET applications.
Disadvantages of .NET development
Even though .NET is considered one of the strongest engineering platforms out there due to an extensive infrastructure and proven product development history, it comes with a set of problems.
Limited Object-Relational Support
As we mentioned above, .NET uses the object-oriented programming (OOP) language model. This model is based around the objects rather than “actions” and data rather than logic. The support of data-oriented software application development in .NET Framework is provided by the Entity Framework.
Entity is an object-relational mapper (ORM) that bridges between the object-oriented .NET Framework and relational (SQL) databases. Some engineers consider that Entity Framework isn’t flexible enough and may not support all available database designs. This also means that there’s a chance that at some point Entity Framework may not be supporting new database designs. Another problem is that the framework may eventually become abandoned by Microsoft, which will force you to accommodate some new technology that the vendor suggests instead.
On the bright side, we haven’t encountered the problems with Entity yet, so it remains a debatable point.
The second drawback is partly connected with the previous one. .NET is run and based on Microsoft. While .NET Core and Xamarin are open source, the whole ecosystem is far from being the community-driven. This means that your products still depend on the supplier and decisions made by Microsoft.
Building .NET apps isn’t cheap regardless of open source technologies. Mostly, your expenses will be spent on Visual Studio IDE and other additional collaboration and quality assurance services that Microsoft offers to simplify you work. As of today, the base version of Visual Studio will cost you $539/year for one engineer. An enterprise release that includes various cloud, enterprise mobility, QA features and more will be about $3000 per year. However, you still can try to become Microsoft Partner to have a number of subscriptions for free. For non-profit and educational purposes there is also free Visual Studio Community.
Even though you can use .NET Core on Mac and Linux machines, the best way is to use Windows for .NET engineering which also comes with licensing costs.
The barrier will be even higher if you’ve never used Microsoft products before and you have to migrate from say AWS cloud ecosystem to Azure.
The gap between release and stability
Perhaps, this problem cripples all Microsoft products rather than .NET stack only. But it’s definitely worth mentioning. The newly released products lack proper documentation, support, stability, and are prone to drastic changes. In one of AltexSoft projects, our architects decided to use a fresh DocumentDB (now Azure Cosmos DB) but then were forced to design custom data architecture as the product suffered a number of technical issues that could jeopardize the entire project.
One of Y Combinator users has vividly described this issue: “My problem with these kinds of Microsoft technology evangelism articles/videos is that it always seems like Microsoft has juuuust gotten their new hotness to work, and is telling the world that it’s awesome, and ready for production. Then you go to implement it, and as soon as you leave the perfect world of their demo, it all falls apart, and THEN you find out the docs were written for the beta version, and no longer apply, so you’re left guessing at the right invocation signature for the method you need.”
Minor disadvantages include performance issues that occur due to garbage collection in closed systems. And, generally, managed environments are slower that those that communicate directly with hardware.
When to use the .NET
Scalable products. Usually, the business needs are growing and your software has to scale with it. .NET provides scalable environment and allows for redesigning ongoing applications in order to match with the growing needs of the business.
Cross-platform needs. In case you need the app that will work across platforms .NET will be the great choice as most platforms are covered and you can reduce development effort while expanding your desktop or mobile app to other operating systems. On top of that, .NET can be used for such specific engineering cases as gaming (including Xbox) and AR development (including HoloLens).
Enterprise-scale infrastructures. It’s still a debatable point whether .NET is designed mostly for enterprise use. But Microsoft makes sure to provide the widest toolset possible to build and cross-integrate enterprise products, both internal and public ones. It also supports a robust enterprise mobility ecosystem.
This article is a part of our “The Good and the Bad” series. If you are interested in web development, take a look at our blog post on the