Going native with Javascript

Like many others, I rely a lot on Javascript frameworks like jQuery when building web sites. It makes things easy when you’re building more-than-simple interactions and web apps. There are often tons of free plugins written by others that you can just download and go without knowing how it all works. The problem with frameworks like this is that you become reliant on them even for simple things that you should otherwise know how to write without the help…but sometimes, you just forget.

I started learning Javascript well before jQuery was even a thing…before there were any real libraries in fact, and I know I’m not alone…but it was basic. I first used the Prototype framework when I started building web apps. As jQuery became more kick ass than Prototype, I switched (we all did) and that was that. I always felt good knowing that I had some “true” Javascript knowledge and didn’t learn JS via jQuery, but I fell into a trap that snags the best of us…I got lazy.

Sometimes you have to go back to go forward

When I redesigned my blog I wanted to keep things simple, both the design and the interactions. The only interaction is the menu at the top of the page, which simply toggles a few links. It’s simple stuff you see everyday and it’s basic code that was driving it, but it was all library-based code. Whether using Tire JS or jQuery, I was using helpers for something I had forgotten how to do natively and I didn’t feel good about it. Frameworks and libraries help a lot but that comes at the cost of download size and speed. A framework like jQuery a toolbox with 1,000 tools but you only need 3 of them. Why carry around all that weight when you can get by with a hammer, screwdriver and a saw? You don’t and you shouldn’t.

So I spent some time refreshing myself with the basics and feel so much better. Looking at the DOM reference sheet for Javascript, I didn’t realize how much I had actually forgotten. You think you know the basics but helpers make you lazy and that should be a warning sign. I take pride in making performance part of my design planning and knowing how to not use expensive helpers needs to be part of that discussion. Every K matters so if I can ditch a 30k lightweight library for something I can write myself at 2k then it’s well worth it.

Sitting all day writing complex web sites and apps that really do require help like jQuery made it so when a simple problem came along I was caught with my pants down. May it never happen again.

Categories: All, Web World

Leave a Reply

Your email address will not be published. Required fields are marked *