About Us

The challenge: JavaScript productivity

Since 2001, the SharpKit team has been designing and implementing Rich Internet Applications infrastructure for SAAS companies across the globe. As applications required higher level of user experience, we’ve found ourselves writing more and more JavaScript alongside C# server side code.

As many other web teams, we’ve realized that JavaScript productivity can be extremely challenging. JavaScript code turned out to be very hard to maintain, mainly due to the fact that JavaScript’s interpreted nature does not allow IDEs such as Visual Studio to provide high productivity. For instance, Many C# features, such as syntax verification, code completion and refactoring, are simply not available while coding in JavaScript. On top of that, different JavaScript API implementations across web browsers made it even harder to evaluate code correctness during development.

The idea behind SharpKit was to enable web development teams to leverage C# productivity for JavaScript development. Since JavaScript syntax is basically a subset of C#, it makes sense to create JavaScript from C#. The key design goals were:

  • Do not change native JS syntax
  • Do not change JS file structure
  • Do not require additional JS files
  • Allow reverting back to native JavaScript at any time

The logic behind these goals was to allow companies with legacy JavaScript code to benefit from SharpKit, and to deliver with no lock-in to a specific product or library.

How we’ve implemented SharpKit

The first phase in implementing SharpKit was to create a C# to JavaScript cross-compiler. This was achieved by parsing C# code into an Abstract Syntax Tree (AST) and then translating it into JavaScript.

The second phase of the implementation was to parse the HTML and JavaScript specifications and documentation into a standard .NET assembly, and to expose the native browser object model and JavaScript API within C#.

The third phase of the implementation was to iterate over the browser model and determine which browsers support which APIs. This was achieved by translating the elaborate quirksmode.org website into custom attributes that decorate the browser model and can be verified during compilation.

Finally, SharpKit was packaged as an MSBuild step to allow intuitive usage from within Visual Studio. The end result is that by adding a single line to any existing CSPROJ file, developers can start coding C# classes that translate into JavaScript files during compilation. This means web development teams can now leverage C# productivity for JavaScript development, without affecting the production environment.

Let us know what you think!

SharpKit was created by developers, for developers. If you have any questions, remarks or suggestions, please drop us a line at contact@sharpkit.net

© Copyright 2005-2015 SharpKit