Normally an article about a programming language and framework that both have been with us for more than a decade would be anything but a page-turner.
When it comes to C# and .NET, it turns out there’s a big story to tell, including things that could spell another decade of that language (and maybe even that framework) remaining relevant. The ramifications of the recent announcements by Microsoft that it would open-source the .NET Framework and take other steps to facilitate cross-platform application deployments alone could fill an article.
The evolution of diverse platforms has not been kind to the traditional incumbents of C# and .NET until very recently. In this article, we will discuss a bit of that history and what has changed, as well as explore the factors and vendors that are making this change possible. Interestingly, almost everyone approached for comment on this topic said something to the effect of “Where do I start?”
So much happening lately makes this a fluid situation, but the three common themes are the open-sourcing of Microsoft technology, Xamarin, and Azure. All of them will be discussed to help understand why C# and .NET may be part of solving the most vexing problem faced by developers these past few years: how to address multiple platforms without going broke, crazy or both.
Many have wondered aloud why Microsoft has not solved this problem. Well, what Microsoft has been doing is not only allowing for a solution or solutions to manifest, but they have also been making some very targeted moves to help them manifest.
Microsoft’s .NET languages
When it first launched .NET, Microsoft put forth two languages. The new C# appealed to developers with C, C++ and Java experience because the syntax was familiar. The other option is the updated Visual Basic in the form of Visual Basic.NET (VB.NET). The power and versatility of the .NET platform is available to both in the form of a Base Class Library that offers a rich set of classes that facilitate platform integration.
At many points in the history of .NET there has been relative parity between the languages. Given my own history as a Visual Basic developer, there have been many arguments about how both languages are equal and how either is just as viable a choice as the other, but you will not hear these arguments much anymore. The reality on the ground is that Visual Basic.NET has been relegated to also-ran status, with the vast majority of sample applications, course examples and virtually everything else being much better supported in C# (if they are supported at all in VB.NET).
This is not to say that Microsoft has watered down or abandoned VB.NET. Its lagging has been more the result of outside factors. For example, most of the developers who work for Microsoft have traditionally been C++ or even Java programmers. This is also the case with most independent software vendors, and it helps explain why so many more software packages implemented with .NET are written in C# than in VB.NET.
Despite fighting this trend for several years, I have come to see now that this is part of what is helping break down the isolation of the Microsoft platform. Visual Basic has many good features, but it has come to represent proprietary Microsoft technology far more than C# ever did. During the formative years of .NET’s evolution, the C# and Visual Basic teams would compete to deliver new developer productivity features, and each in turn would be forced to play catch-up. This competitive dynamic brought great features to both languages, including Generics, Lambda Expressions, LINQ, Late Binding, and most recently Async.
As we will see, C# has earned a unique position in the effort to unify development across platforms thanks to Xamarin. VB.NET does not have the ability to play that role, maybe because C# was defined as a standard with Ecma, but more likely because the people who write frameworks and cross platform-glue are far more likely to be C-type programmers than fans of Visual Basic.
Compounding this is the fact that the C# language has amassed a large and devoted following, including Jesse Liberty, a Master Consultant at Falafel Software and Xamarin Certified Developer. When asked why he liked C#, he replied, “C# is simply my favorite language (and I have programmed in quite a few) because it has everything from extremely fast memory management, to LINQ, and it is a mature, tested and optimized language that is an excellent choice for virtually any kind of application programming.”
Miguel de Icaza, cofounder of Xamarin, is another big fan of the language as evidenced by his actions from nurturing Mono for years to an attempt to port Android to C# a few years ago. In fact, de Icaza has cited the grants Microsoft made when it submitted C# to Ecma as a fundamental reason why .NET is a safer bet than Java, in his opinion.
Since introducing the .NET Framework, Microsoft has played the game just like every other vendor by working to gain advantage in the developer market in much the same way it has in all other areas. The Microsoft development teams relentlessly push out new features to make the products (including the languages) more productive and easier to use.
Often while doing this they adopt an open standard, but they add additional functionality that pulls away from the standard but improves things on the Microsoft platform. This has often been referred to as “Embrace and Extend.” In most cases, there is still the ability to use the standard implementation in a generic way, but there are strong temptations for the end user to leverage the extensions and thereby let Microsoft achieve a level of vendor lock-in.
This is not a nefarious thing, but it has often been cited as evidence that Microsoft is not serious about being open in its efforts to incorporate standards into its platform. This may not go away totally in the future, but it is now in Microsoft’s interest to support platforms beyond Windows. Scott Hanselman, principal program manager for Web Platform and Tools, explained the recent announcements on his blog, saying that Microsoft will be “building a .NET Core CLR for Windows, Mac and Linux, and it will be both open source and it will be supported by Microsoft.”
This move comes after Microsoft has clearly shown that it is much more open to working with Xamarin, viewing its technology as beneficial rather than distracting (or worse: competitive). John Bowen, software consultant at BowenCode LLC, explained how C# has gained in significance by pointing out that “C# has always had great support across Microsoft’s core platforms, but with the ‘One Windows’ convergence, it is now becoming directly portable across everything from cloud servers to the Xbox and even down to embedded devices, while the emergence of Xamarin and the new open-source .NET Core have expanded C# to such a wide range of non-Microsoft systems that by the time Visual Studio 2015 is released, it’s going to be rare to find a system where it cannot be used.”
Microsoft is still playing to win, but now it understands that it cannot play the game in a way that requires control of everything.
New world order
There was a moment where Microsoft was at the top of the hill. It owned the browser, and the iPhone had yet to take the world by storm. The browser scene exploded on it with Chrome, Safari, Firefox and others eating up market share so fast that Microsoft was forced into being reactionary instead of proactive.
Microsoft is at its best when under pressure from serious competitors, but it was caught on its back foot here. This happened again (but worse) in the mobile space as the iPhone and Android have caused Microsoft to reinvent its phone platform twice! The result is that in a few short years developers have been forced to confront not just one, but three mobile platforms.
One strategy to bridge the platforms has been to use Bootstrap or other mechanisms to create a Web-based UI and host it in a browser on the devices or in a frame that hosts a browser control. The problem is that this results in a non-native experience. Further, this approach can tend to be slow, and these implementations do not usually properly leverage the power of each platform. They are reduced to the lowest common denominator.
The other coping strategy has been to just pick the platforms that were “must-have” and only build native apps for the winners. That strategy presented vulnerabilities, and as mobile platforms have evolved, it has become harder to ignore them. For example, Liberty said, “The multiple platforms I personally target at the moment are iOS, Android and to a somewhat lesser degree, Windows phones.”
The point of all this is that the tools are catching up to save the day, and C# is becoming more popular as a result. Liberty said, “My must-have tools include Xamarin Studio, Visual Studio with ReSharper, SQLiteBrowser, Reflector, and TextExpander.” I caught up to him after a recent, very well received presentation he gave at the Boston Code Camp that covered development using Xamarin Forms. Thanks to a specific requirement for compiling for iOS, he pointed out that the “most important must-have tools are a Macbook Pro, as well as representative phones from each platform.”
While Xamarin Forms has emulators, a program is not really tested until it is tested on a real system instead of a simulated one.
The open-sourcing of .NET
Microsoft’s relationship with open source has improved a great deal recently, but for many years Microsoft was “The Empire” to open source’s “Rebellion.” That all started to break down as Scott Guthrie and others like him moved up inside Microsoft. Guthrie now holds the executive vice president spot left vacant when Satya Nadella became Microsoft’s CEO, and since then, more and more significant components from Microsoft have found their way into the ranks of open-sourced projects.
He is not alone in his enthusiasm regarding what kind of impact this move will have. Bowen said, “The massive shift to open source at Microsoft not only gives everyone in the community direct access, but should also allow the .NET platform to become much more responsive in evolving to meet the changing needs of the industry.”
There is no telling what innovations this will lead to because now developers can dig into the guts of .NET and build solutions, or adapt their solutions to work better with .NET. Wagner said, “One week after Microsoft’s Connect announcements, the two most popular repositories on GitHub are the core .NET framework and the .NET framework samples. That’s just an incredible response from the worldwide developer community.”
Roslyn (the .NET compiler) has also been open-sourced. According to Bowen, “The new Roslyn compiler brings immediate benefits in the out-of-the-box Visual Studio tooling, and the openness of the compiler along with Visual Studio’s new extensibility model are going to allow for further improvements to come quickly from both Microsoft and the community.”
The measure of progress
There are still plenty of challenges, but barriers are coming down and C# is poised to be the language that benefits directly from the progress being made across the board. Bowen pointed out how far things have come when he said, “A few years ago, even getting any code shared between projects on different Microsoft platforms (i.e. WPF and Silverlight) required a lot of fragile hacks and hours of frustration.”
He went on to explain that “linked files, lots of preprocessor directives to handle differing syntax and large amounts of code that just could not be shared were the norm. The continuing evolution of Portable Class Libraries and related technologies built around them has now made it possible to even build XAML-based UIs that can be directly shared across everything from Windows desktops to Android phones.”
This probably does not spell another period of pure dominance for Microsoft developer tools, but a reemergence with integration into a very nimble community of tool and platform makers. Bowen summed it up well when he said, “The historic advantage of near-ubiquity across environments that Java has enjoyed relative to C# has nearly disappeared over the course of just a few years, with C# now even having the advantage of reach to the iOS platform and Language choices can now be made based on the merit of the language and ecosystems themselves rather than platform restrictions.”
We live in interesting times.
Building bridges off the island
If you’re looking for a way to get your .NET an C# code to work on other platforms, these companies can help.
Aspose: Aspose has always been the go-to file format component vendor. Its tools allow developers to convert, create and edit a large variety of file formats, from Word to PDF to barcodes.
Danny Cooper, associate director at Aspose, explained it this way: “Aspose offers native versions of our file APIs for most popular platforms, including .NET, Java, and SQL Reporting Services. Aspose also offers a REST version of our APIs for developers working on cloud solutions.”
With cloud solutions, iOS and Android can be serviced with all supported file types, and there are explicit packages for .NET and Android. Cooper said that the company has a package called the Aspose.Total Product Family. He described it as “a product suite that allows developers to work with any of our downloadable APIs, for any platform. It’s a great value for developers who need native cross-platform support.”
Each of the component vendors have had to consider how they will help their customers address targeting multiple platforms. The Cloud approach from Aspose is very adaptable and has been used with Xamarin Mono for a while now.
DevExpress: Widely known for many years as the makers of CodeRush, DevExpress has pushed far into other areas that few other component makers have dared to tread. DevExpress’ Bucknall asserted that “CodeRush is the best add-in tool for writing C# code, and coupled with our suites of controls across all platforms, developers can create apps for different devices that have the same end-user capabilities.”
It should be obvious that DevExpress has been trying the hardest to solve the problems presented by cross-platform development. Bucknall agreed that the C# arena is a big topic, with Universal Apps and Windows 10 promising to help with consolidating development for those targeting the Windows space in all of its incarnations. As a result, he said that “‘thick-client’ apps will be rejuvenated, and now that DevExpress has released their second major release of 2014 (v14.2), the XAML teams can concentrate on creating Universal App controls and frameworks ready for Windows 10 and the first major release of 2015.”
DevExpress has also noticed the relevance that Xamarin has risen to with its Xamarin Forms. “[With] the efforts being made by Xamarin to broaden the devices you can target with C# and .NET, we are about to release our first control (a grid, naturally) for Xamarin Forms, and we will be adding to that over the next six months.”
Developer history is rife with examples of revolutions that have fizzled. Even technologies that succeed eventually are replaced unless they are refreshed or otherwise revitalized. This has made developers somewhat conservative.
“Witness the number of WinForms developers that still work with that runtime, despite WPF being around for many years,” said Bucknall. “I would guess that the early adopters will be jumping all over these new technologies pretty well immediately, whereas the majority will adopt a wait-and-see attitude.”
DevExpress is ready to help developers across this spectrum with the latest tools adapted to the most current technology.
Telerik: In the fall of 2013, Telerik announced its Icenium Extension for Visual Studio, which promised to deliver on the write once, run anywhere requirement that had emerged. Since that time, the offering has been rebranded as Telerik AppBuilder, with the promise to let you “Create cross-platform mobile apps for iOS, Android and Windows Phone using an instantly available, hyper-productive PhoneGap/Cordova development environment.”
Telerik offers IDE tools for Visual Studio and Sublime Text, and it also provides a command-line interface for use with other systems or all by itself.
Xamarin: Xamarin is a company that has its roots in a love for C#, and the idea of using it and the power of the .NET Framework on all platforms. When Novell decided to stop pursuing development on Mono, Miguel de Icaza, Nat Friedman and Joseph Hill started Xamarin. Hill, director of developer relations, and Mike Bluestein, developer evangelist, weighed in on what they are doing and how the game is changing.
“iOS and Android are the dominant mobile platforms, having hundreds of millions of users,” said Hill. “These platforms are also expanding into other areas such as wearables, and devices such as TV boxes. Meanwhile, there are over 6 million .NET developers with code primarily focused on desktop and server platforms.”
Bluestein added, “The C# language has the benefit of being mature enough that developers have learned how to use it well. The .NET Framework has been used in critical applications that have resulted in it having great stability and high fidelity.”
Many well-informed developers are convinced that Xamarin Forms is a big step in making sense of this fragmented landscape. “The ability to share so much code, from business logic all the way up to the UI, in native apps across all of the major mobile platforms by using Xamarin, is a huge differentiator,” said Bowen.
But, to be clear, Xamarin Forms is not a fix for ignoring the intricacies of the various platforms. Bucknall said, “Xamarin Forms is a very young framework and has many issues (that are slowly being addressed, admittedly). The good thing is that Microsoft [is] now helping Xamarin ensure that .NET and C# is standardized across these new platforms and devices—another open-source effort.”
He did not elaborate on the specific issues, but chief among them is likely the lack of a XAML designer and the fact that when it comes time to debug the native application compiled, it is likely that general knowledge and a strong C# background will not suffice. Also, some developers are complaining about price since the tools are not free, though they are quite reasonably priced when compared to the alternative of developing everything twice or even three times using native tools. In an effort to explain what these developers are trying to gain by using Xamarin, Bluestein said, “iCircuit is a great story of a premier cross-platform application built in C#. The developer has a great breakdown of the code reuse it achieves via C#, .NET and Xamarin.” Code reuse equals productivity if the promise can be fulfilled.
All of this tumultuous change is great, but there has to be a reason other than a simple changing of the guard at the top at Microsoft, especially since the changes have been building since before Nadella took command. Microsoft has clearly decided that all concerns (and therefore biases) are secondary to making Azure the go-to cloud. That only happens if Microsoft can ditch the vendor lock-in reputation and help developers bridge the gaps.
To that end, Microsoft has been working aggressively to fill in gaps where it can. For example, recently Microsoft brought out a preview of a new Azure service called RemoteApp. With a promise to help you “run Windows applications anywhere,” this offering extends the reach of Windows developers to previously unreachable platforms, from Android to Mac. This offering, along with the ease of rolling out a Linux VM on Azure, are part of the mounting evidence that the strategy for Azure is for it to be inclusive far beyond just Windows and Windows Phone. Azure is a small part of this story, but it has driven most of the moves by Microsoft that have enabled all the rest.