Web Development Re-imagined.

HEY! A blog post actually related to development topics! Crazy! I know I haven't done one in a while. But my work of late has been divergent from the usual coding activities. But, now I'm back, at least on the side and looking into TypeScript.

I'm looking into TypeScript because I know of a need to know how to use in the future. Having done what I've done with it so far and I can't help but feel like this is the beginning of traditional web development being replaced with a more applications development paradigm. Which, from my perspective is a truly awesome thing, and probably from a web developer point of view a truly wretched thing.

For those who don't know, TypeScript is a super set of JavaScript which is, of course, about (or perhaps actually) the most widely used programming language for web development. TS is really more of a wrapper around JS. Your web sites will never directly utilize a TS file. TS is just compiled down to JS. And then the web site uses the resultant JS file.

So, if at the end of the day, TS is really just boiled down to JS, then why use it? TS adds some keywords and conventions like allowing variables to be strongly typed for instance and allow it to be used in a fashion more similar to conventional programming languages. This is probably a heated debate of sorts, and strongly typed variables and weakly typed variables have their respective places. In my opinion, the places where weakly typed variables "belong" is a very small niche area. Mostly in small applications/web sites that are either not maintained or indefinitely maintained by the same person who wrote it originally.

The "problem" with weakly typed variable is that, especially if they are passed around to functions or other scopes it can get maddeningly difficult to keep track of what type of value is actually stored in variable at any given line in your code or might be returned. Many work around it with naming conventions or other frameworks but then... if you're using other techniques to enforce consistency... why would you want weakly typed variables in the first place?

As to why something like this hasn't happened before is a fairly easy question to answer as well. It likely has, but went largely unnoticed due to lack of demand. While there has been some convergence between applications and traditional web sites, generally they haven't gotten too deep in bed together. And largely because there has been nothing to drive them together. Web Sites are generally less complex than applications and instead of maintaining them they are "updated" on some frequency which is code in the industry for "hire a contractor who will rewrite the whole damn thing from scratch anyway". Applications on the other hand generally employ full time developers dedicated to the application and applications are rarely rewritten from scratch, even when core developers leave.

The force driving them together now is the growing diversity and uncertainty in computing devices. Historically, if you wanted an application you simply delivered a Windows application and everyone was happy. Nowadays however Apple PC's are growing more popular as are Android and iOS tablets. There are also a variety of cell phones which adds BlackBerry, Windows Phone and some non-compliant Android forks to the mix.

With all of these platforms out there and business often demanding support across any one of them, or even multiple it is no longer viable in many markets to deliver an application in a single codebase. But supporting multiple codebases is an even bigger PITA. The answer to which is the web. Every one of these devices has a browser. And every one of these browsers can run JavaScript. The web sites can be aware of platform and form factor and deliver a better experience for the device in use. And all of this combined means a lot of the more traditional applications developers are now rushing to find a way to get their products into a browser compliant format. And that is where TypeScript and I imagine other similar languages in the future come into play.

Those developers are used to modern programming languages. Their projects are massive. Products that are hundreds of thousands or even millions of lines of code are not easy to maintain with weakly type variables. They also need better tooling. And better tooling also requires more consistent conventions to be adhered too. TS and JS are still weird-ass alien languages to a guy who has spent less than a day with them after coming from years in C#/Silverlight (me), but having a variant of JS that enforces standards that not only stops me from doing stupid things in my code, but also provides me with Intellisense is a godsend. Even if the syntax and some of the concepts are a little different, it at least allows me to write code that can conform to some reliable standards which I'm familiar with and understand.

So, TypeScript may not be the end of the line. And, in fact, it probably won't be. It needs more to replace to a language like C# still like dedicated libraries for certain activities like managing data or additional UI specific syntax and conventions, etc... But I can't deny that this is a step in the right direction. We may soon see "proper" JS based frameworks for traditional applications developers that deliver everything they would expect. If I'm disappointed about one thing here, it is that they didn't use a XAML/C# rendered to HTML/JS approach. It would be in the same vein of what was done with TS and appeal even more to application devs. But, but project Roslyn out there, maybe someone will do such a thing.

Comments

Popular Posts