Thoughts from the Wet Coast

The musings of an ASP.NET Developer from Canada's We(s)t Coast

JavaScript For C# Developers: 1. An Introduction

Category: JavaScript
Tags: ajax c# patterns
Last Modified: May 2 2017
May 14 2015

JavaScriptI am a Web Developer – and so you would think that I use JavaScript as a routine part of my job. 

However, until relatively recently I have been mainly involved writing “server-side” Visual Basic or C# code in the ASP.NET Web Forms model.  In that model, when a user clicks a button (or hyperlink) on a web page or makes a selection in a drop-down control this invariably results in a post back to the server which responds to the client-side action, and then completely refreshes the page.

In the previous paragraph I wrote “until recently”, and that is because for the 2 or 3 years, JavaScript has become a significant part of my job.

JavaScript is not new for me – my first Web Development job was working on a predominantly JavaScript project in the late 90’s. 

Internet Explorer 5 had not long been released, and it was the first major browser to support XMLHTTP Requests – the X in AJAX development.  I was working on a project which used JavaScript in the client, XMLHTTP Requests to communicate with a Classic ASP webpage on the server which in turn interacted with a Visual Basic 6 DCOM Component (the model) – sounds suspiciously like a “Single Page Application” to me – and this was 1998/9.

During the intervening years JavaScript was not a focus in my daily routine – and my skills developed on that project became a little rusty. 

So now I have decided it is time to relearn the language – learn to use it the way it was designed rather than through the lens of an object-orientated language like C# (or Java).  There are a lot of syntax similarities between the languages as they are both “syntactically” C-style languages, but in many ways this is as far as the similarities go.  JavaScript owes more to Self and Scheme, themselves dialects of Smalltalk and Lisp respectively.

And so as part of this commitment to relearn JavaScript, I have decided to blog about what I learn, with a focus on pointing out the best “Patterns and Practices” of JavaScript (as well as some of the bad bits or “anti-patterns”) and how JavaScript differs from C#, Java and other object-oriented languages.


Resources:

There are three main resources that form the foundation of my studies to date.

Douglas Crockford – JavaScript: The Good Parts, O’Reilly Press

Stoyan Stefanov – JavaScript Patterns, O’Reilly Press

JavaScript 101 – dailyjs.com

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Categories

Tags