What the Javascript Framework?

Wading through the horrors of modern Javascript web development

Gus Beare

The Emergence of Javascript as a Mainstream Language

I have been a .Net developer for many years now and only used Javascript for small page enhancements such as controls, DOM manipulation and Ajax. Like many other developers I know Jquery well and consider it an essential part of any modern web developers toolset.

But things have moved on. A huge number of developers are now using Javascript for full stack development. This all started with Node.js and the realisation that Javascript could become a new standard language for both the client and server.

Whether or not this was a good idea was hotly debated for many years and revolved mainly around the shortcomings of Javascript itself. Javascript is a difficult and some would say horrible language. But it is getting better and the tooling has mushroomed. Like PHP Javascript will never be the best solution but it is popular and we are going to have to live with it.

Should We Start Again Instead?

Personally I'd like to see the big corporations get together and start again with a whole new language for the web that is designed for the web and not evolved as some kind of botched after thought. Of course, this is extremely unlikely to happen because that would be far too sensible and large corporations like to make our lives a misery. Instead, they are sticking with Javascript and building tools to make working with Javascript more bearable.

The Life and Death of Developer tools

Inevitably, there are tools that come and go which adds to the difficulty of trying to chose a pathway through this morass. I don't blame large corporations for this. They are struggling as much as everyone else to decide they way forward. But it is frustrating and expensive to invest a lot of time in learning a toolset only for it to be quickly ditched.

Angular 1, for example, was ditched and re-written from scratch and it's remaining life is currently uncertain. Visual Studio Lightswitch was a nice tool that I used for a number of projects until its life was abruptly halted back in 2016.

So This is Where We Are. Where Do We Go Now?

The problem that I am now facing is which way to take my web development and which tools and technologies to learn. I have never embraced Javascript fully and never made it through a complete book on the subject. I am wondering if now I have to bite the bullet and throw myself into it properly.

At the moment the landscape is a minefield and if you need to decide how and with what to build an application for the web you are faced with a decision that you may regret terribly at some point down the line.

Of course, your requirements will drive the final decision and these usually come down to a combination of business requirements and resources at your disposal. But even when those are clear you still have to decide from a bewildering array of frameworks and other tools to chose.

Up until now if I was going to build a web site I'd chose either ASP.NET MVC or NancyFx as the server side framework. I'd use Razor for the views and either vanilla js or Jquery for the fancy stuff. Or, if I needed a CMS I'd use DNN or Wordpress.

But today I could chose from Static Site Generators, Javascript Frameworks, Jam Stacks, Content Management Systems or a modern Visual Development Framework.

If I didn't like any of those options I could chose from one of the huge plethora of languages that compile to Javascript such as ELM which is a really interesting option or Haxe which looks great too. Since I am a C# developer I could chose Bridge.Net or DuoCode.

In most of the main options there are more than 5 choices to be made. It's bewildering and this is before we've even tried to build anything. I am not alone in struggling to decide the way forward from here. Web technology, tools and methods have gone mental in recent years and it will be a while before things settle down. In the meantime us developers need to make pragmatic decisions about what we chose to learn to stay in the game. We need to look at the best tools for the job but we also need to be very aware of the trends in the job market otherwise we might be working ourselves out of employment.

Let's assume the client wants a modern Single page application to replace their dated internal system. Do we jump on the AngularJS bandwagon? Do we wager on something lighter and more elegant like Vue.js? Or do we plump for something lean and approachable such as Mithril.js?.

Well, it's not easy but requirements and resources should give you an idea. As a pragmatist I am coming to the conclusion that there are a few things you can do that will stand you in good stead.

Learn Javascript and Have a Good Understanding of the DOM.

Javascript is massive right now and currently the most popular language around. If you learn js properly and you understand both the good and bad parts then you will be able to do both client and server side programming. It's possible to build amazing cross platform applications such as Visual Studio Code using Javascript and the Electron framework. There are few limits to what can be done with Javascript these days.

If you understand Javascript and you know the DOM, you can access and change all the elements of an HTML document.

Learn a Good and Popular Language Such as C# or Python.

Both of these languages are hugely popular and have many uses. A solid understanding of either will stand you in good stead. In addition there are well established options to compile both of these languages to Javascript.

Keep Your Mind Open.

Group thinking can be a dangerous thing. Following the herd and jumping on new tools just because they are popular can get you in trouble. Careful evaluation should be carried out before any tool is used for a serious project.

Play with New Tools on a Regular Basis

Just this past week I have played with Amber Smalltalk, ELM and JS++. These are all great tools and if it wasn't for their relatively small user bases I'd be very happy to chose and learn one of them properly.

Look at What You are Doing and Ask Yourself If it Can Be Done Better.

As a hobby I maintain the Flicka 20 Sailboat web site. I built this site using a prototype web app I constructed in NancyFX. This is mainly server side .Net Razor views with static files, Markdown, Bootstrap and JQuery. It works pretty well and is relatively light and responsive. However, I already have it on the radar for a rebuild using .Net Core and a lightweight Javascript framework.

The Way Forward For Me

I am very tempted by the idea of DotVVM which is a very clever framework based on .NET and Knockout.js. With it you can build modern SPA's and traditional web applications without having to write any javascript at all! I have built a basic app with it for fun and I can tell you that it is brilliant. If it takes off and I really hope it does then it will be a great option for modern LOB applications. Good luck to them I say. I am hoping I will have a project that I can build with it soon.

But, after evaluating all this stuff for a long time I have decided to focus on improving my Javascript skills and learning Typescript. I think that will give me the best chance of staying in the game long term.

The issue with Javascript is that the specifications are changing all the time and browsers are out of sync in the features they support. You can be safe by writing ES5 compatible javascript, however, you would be missing out on the new and useful features of the latest versions. This would be making life harder for yourself for no good reason.

With Typescript you can make good use of the new features and write more robust code and still be able to compile to ES5 javascript. Typescript appears to have really taken off. Angular 2 was written in it and I am seeing more and more examples of single page applications written with a popular framework plus Typescript.

Hopefully, learning Typescript is a good direction for now. There is a great deal to learn and for the moment a complex framework will make learning the language harder.