I used to be a C# SharePoint Developer – Part 1 – Why JavaScript

Why am I writing this?

JavaScript is one of the most hated languages on the face of the planet. There is no disputing this. The question is you have to look at is why? It does what it does, and it does it well. Is the hatred because you don’t understand it properly, or that you disagree with it’s implementation? If it is the latter you will most undoubtedly stick to CSOM and TypeScript as much as possible.

I am not going to ask you to forget everything you learnt in C#, do not forget all the best practices and patterns you learnt. Programming is programming is programming is computer science.

C# can be developed in exactly the same way as JavaScript as you wish, and in that point JavaScript should be developed at the Enterprise level as if it was something you are writing in C#.

The same Namespace, patterns and practices apply in both languages. Implementation is slightly different. As a SharePoint C# Developer you probably have never had to deal with asynchronous code, complex event handlers and thousands of optional frameworks.

With this in mind, where applicable a blog post will compare the JavaScript and the C# way of doing things. For those with a Computer Science background, I will also explain the mathematics and science behind certain parts in order to better explain what is going on.

What the SharePoint Developer has to realise

JavaScript is here, it is becoming the core of your development life and you have to learn it in order to stay in the SharePoint Enterprise market. Hate it, love it, respect it. It does not matter it is here, and for the foreseeable future, to stay.

Each version of SharePoint has shifted more and more of the code to the client. This in turn has helped speed up the server processing, and as the product became more complex this has helped to reduce the ever increasing server requirements. It also increases server stability, and increases perceived speed with less page load times in SharePoint.

A distributed development model for SharePoint is the best way. and things will only progress from here.

How do I make the most of my learning experience?

You cannot be a Master without Practicing the basics every day. This applies to everything in the world. No matter how good you are at anything. If you don’t practice the basics. If you don’t keep this knowledge sharp. Then you will lose at least some of it.

Sure programming is a little different, and I’m not saying read this book every day. But apply this knowledge, and always apply the best practices, and spend some time coming back to review this knowledge periodically will mean that these skills won’t dull.

When I draw, I spend the first 10 minutes drawing circles. I spend the next 5 minutes shading them into spheres. Then I spend the same amount of time drawing cubes. It’s my warm up exercise that allows my hands to get used to a pencil again.

When I do my patterns for Taekwondo, I start with 20 front punches, 20 leg raises off each leg, two fundamental movement exercises and then the first pattern.

When I program I do the same. I don’t just jump into a JavaScript file. I will read over my cheat sheet and get it clear in my head what I am writing. This only takes me ten minutes, but saves a lot of time while coding. I have studied over 40 computer languages, and the syntax can get a little muddled at time, this technique has helped me. This is because mainly when we switch languages all the time. It is very easy to write Console.Write when you meant to write console.log and very easy to forget simple things like the how a switch statement is formatted.

I also do code challenges. I look for websites that offer coding challenges, and go through them. I always research common algorithms such as tree traversal when I need to implement one. I know exactly how I have implemented these in the past, but there are people who research these things full time. Further I can guarantee that you will have forgotten something in the time since you last implemented that algorithm.

So where next?

In my next post I will deal with the history of JavaScript, to build up the picture in your head of what JavaScript really is. Then I will go through the basics of JavaScript. The following posts will break down each of these basic fundamentals and deep dive into each one. For each step I will also be comparing JavaScript to C#. Later on I will do a direct comparison of the two at a raw level.

© Hugh Wood 1980-Present