I have found what I believe to be the best stack for building applications in 2016.
Why This Stack?
I thought I had found programmers nirvana when Node.JS became popular a few years ago.
It seemed awesome to be able to program in the same language on the middle-tier server and the client. And while Node.JS made popular several things we now take for granted —
- use the operating system’s features as much as possible
- do use asynchronous operations to better take advantage of the multi-core hardware architectures popular in today’s world
- leave the complexity of multi-threaded programming to the systems programmers
But for now, Java and .NET are the go to platforms for such companies.
Having spent more than 12 years working with Java and watching it regress from an elegant, simple language I lost my desire to work with it. How could a standardization body get generics or templates so wrong? Sigh.
In contrast, C# continues to get better and better with each revision. This is due in large part to the incredible work of Anders Hejlberg.
If you are not familiar with that name and you are a programmer you should be! He is the creator of the Turbo Pascal platform that fundamentally changed the way we think about the development workflow.
In addition to the language, the ASP.NET Web API framework is pretty mature and robust at this point. It contains several security features including OAUTH and cross-site scripting attack prevention support.
Also, the concepts of model binding and formatters for content negotiation is very powerful. Most of the time you simply return an instance of your model class (or an IEnumerable<T>) and the framework will automatically convert it to JSON (by default) or XML, etc. This makes building services a dream. Spend your energy focusing on your business logic instead!
Regardless how you think about the statements I have made above please realize that is the basis of my discovery.
Microsoft has recently released several .NET technologies into the Open Source community. The tech in question runs not only on Windows but also on Mac OS X and Linux. Awesome!
This means that one can easily develop and then deploy solutions into target hosts of their choosing. It becomes a deployment decision – not a development decision. The architect in me jumps with glee.
These are the technologies I intend to use for application development at this point.
- .NET Core is an Open Source version of the Microsoft .NET platform
- ASP.NET Core is an Open Source version of the Microsoft ASP.NET framework.
- Angular 2 is the next version of AngularJS built from the ground up to support features of ECMAScript 6 and specifically TypeScript.
- Angular 2 Material are the Google material design components for Angular 2.
- Docker is a platform (among other things) for deploying micro-architectures.
- Nginx is arguably the most popular and flexible web application container in today’s world.
When you put it all together it looks something like this:
Note that the Linux host could easily be a Windows host. And the docker container OS can easily be Windows with the introduction of the Windows Server Core container. Although the license agreement does suggest that it is not allowed, it is theoretically possible. See this link for more.
This means that a Linux host can host Windows based Docker containers! Also, Windows Server 2016 and Windows 10 can host Docker containers as well. See this link and this link for more. It would seem that there is an official commercial relationship between Docker and Microsoft.
The deployment options are wide open for modern micro-architecture applications.
With this stack comes a whole new set of tools. While they are not as mature (yet) as their older brethren I have to admit I am enjoying the foray back to the command line. There is just something about the power of the command line that attracts me. I typically prototype new APIs as a simple CLI app myself before wrapping the resulting libraries in something more accessible like a Web API.
Here are the minimum set of tools (IMHO) needed to work with this set of technologies.
- dotnet cli – an extensible set of tools used to create a new project, build and run the result
- yo aspnet – a Yeoman based generator for creating and managing ASP.NET Core applications
- angular-cli – a command line based tool for creating and managing Angular 2 applications
- Microsoft Visual Studio Code – probably the best programmers editor I have used in a long time. It borrows many of the lessons learned and technologies from modern editors like Sublime Text and Atom
There are various plugins and extensions that make using the tools above more useful. For example, the Entity Framework extension for the dotnet cli is worth installing.
So far I have been talking about Web applications. But there are frameworks available that can turn your web application into mobile or even desktop applications.
The two in which I am most interested at this point are:
- PhoneGap – based on the Apache Cordova project it turns a web application into a mobile app deployable to Android, iOS or Windows Phone
- Electron – from the folks that brought us the Atom editor; write desktop apps with the same familiar technologies with which you are already working
I spent some time putting together an application that uses (but does not stress) the technologies I have introduced in this post.
With the incredible productivity provided by the ASP.NET Web API framework and the C# language itself coupled with Angular 2 I believe I have found a stack that is deemed to be a home run.
Wrapped in Docker containers and the deployment flexibility available I honestly believe this is the best that is available today.
Just keep in mind that it will be some time before all of this stuff is ready for production.