The thing about Web Development is…

It is always changing. This is good but sometimes it can be a bit overwhelming. For example, ever since ES6 came out and the industry started moving more and more toward using the new specifications. I have started feeling like I don’t know javascript.

I have been writing in javascript for about five years now. The vast majority of it was in jQuery. Some of it has been with front end frameworks like Vue.js and Angular. I worked for about 6 months with meteor.js and node.js at my first development job. I can still drop some jQuery like no body’s business. I have built whole component libraries using jQuery, Scss, and HTML that are fully accessible and easy to implement. Yet when I see code that uses destructuring in complex ways, I am like ‘what the heck is that?’

It is javascript – the new javascript. There are quite a few parts that take some getting used to.

Arrow functions are another example. They are easy to understand and simple to implement. The syntax is simple and straight forward. But I could easily and quickly read and understand code that nested functions before that arrow came along. Now, I frequently see things that I have to take a moment to translate. Here is a fun, and simple example from the MDN docs:


setTimeout( () => {
console.log('I happen sooner');
setTimeout( () => {
// deeper code
console.log('I happen later');
}, 1);
}, 1);

This one is nice because it is fairly obvious what it does. But imagine if it wasn’t so obvious. I didn’t realize how much the word ‘function’ was serving as a visual queue for me until it started disappearing.

When you are learning, arrow functions are simple and straightforward. The syntax is a clear improvement for a simple function.

 

//New version
const cubeThis1 = (a) => a**3;

cubeThis1(3);
// 27

//old version
const cubeThis2 = function (a) {
return a**3;
}

cubeThis2(3);
// 27

When you are working with someone else’s code, they haven’t named their functions and variables so well, and the functions are not so simple, then you might find yourself stopping to translate. Every now and then I rewrite the code in comments or in my own notes with the explicit ‘function’ syntax to make sure I understand what is going on. The implicit ‘return’ of the arrow function throws me off sometimes.

Destructuring can also get very confusing very fast, especially if the writer of the code does not adhere to clean coding principles. The syntax feels backwards to me like I learned to write “The fox will run” and now I am being asked to write “Run the fox will.”

So I am practicing writing code far more than I used too, or than I previously felt was necessary. I have returned to some of the code kata’s and code challenges that I used as a new developer to try those same exercises in ES6. I sometimes refactor my code with more ES6 syntax to see if improvements can be made, and I always think about how my code communicates with other developers.

In spite of all this, I still frequently feel like I don’t know the language well, or rather that I know it less well than I did just a few years ago. It is the programming language that I am primarily writing in, and have plenty of experience with.

But then, in my career I have also had to learn PHP, Python, Ruby, mongo, SQL, HTML, CSS/SCSS, and a half dozen frameworks with their own syntax. And that list could go on because there are the API’s you work with, the libraries, the modules, the automation tools, the testing tools, and the browser dev tools which are perpetually getting new updates. Somehow, the ground is always shifting in web development.

It is so easy to feel like somehow you are back at square one, in spite of the 5 years or more that you have been climbing the web development mountain range. I feel that way. The other day I wrote some code for a small expanding panel with all the needed aria-attributes for screen reader friendliness, for another developer. I knocked it out in a matter of minutes, and then refactored it in another 10. That is when I found myself thinking – “Oh yeah. I do know how to write javascript.”

New syntaxes, and the complexity of incorporating new skills into your existing methods can feel awkward and fill you with doubt. This is a note for my future self the next time I am learning the big new thing that scrambles the syntaxes that I am comfortable with: You are not alone, and you don’t suck at this, so keep moving forward. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s