What do you mean your 20 user app doesn’t support MFA, SSO and Social Login?!
How can you NOT validate your forms on the front-end too?
for simple toy use-cases it’s fine… but for a real app you should use a library
In our vast Javascript ecosystem we have access to endless libraries and frameworks. There is no day passing without a new, state of the art library popping, and promising to change how we do things.
We have libraries to solve almost any problem that exists (and probably some that doesn’t exist)
But should we actually use them?
Can it be that there is more harm than good in npm install
ing our way to success?
There is obviously a case for both sides and I want to ponder a little about it.
Just pound some code
I don’t know about you but when I just started to code I didn’t know about libraries. Also, I was like 9 years old so I barely knew English as well, but it’s not important. The important thing is that whenever I faced a problem, I had to solve it! No cheat codes! Just hard work.
And guess what? It made me a better developer!
I knew exactly what my code was doing.
I could change and evolve it any way I wanted to.
When things broke I knew how to fix them.
And I learned so much along the way.
Use a library
I grew, and the community grew and evolved as well.
I saw all those shiny libraries. I could just npm install
and I needn’t code anything! I could just focus on my app’s logic.
Need to keep your state synced with the DOM? No problem
Need to authenticate your users with a password? Social? MFA? You got it
Want to use one schema to validate both on the browser and on the server? Piece of cake 🍰
It got so easy to create production grade apps and use the same tools that all the big companies use.
If it works for Facebook it would definitely work for me!
This library got 2.3M Github stars! Of course, I can count on it to solve my problems!
Just pound some code
But then life happened.
I sank under the heavy burden of the infinite node_modules
folder.
I found out that I was in a gold cage. I was locked by the libraries! 🗝️
I started spending more time reading documentation and source code, and trying to explain why this and that cannot be done instead of solving problems!
I found out that our site is SLOW! and that we are shipping like 4MB of unnecessary javascript to our clients! and for what?! for animating some divs?
I was trapped.
And worse than all, I just didn’t know how any of these things worked! For the life of me, I couldn’t understand what was going on in my stack traces, and there was no way I could create those solutions myself.
So I needed to start again, to peel off all those libraries and learn again how to do things myself, and just pound some dirty ol’ code.
Pound some of the code
I needed to go through this vicious cycle though. I had to taste the sweet and bitter taste of libraries so that I could be a better programmer today.
Now I know that pounding code is fine, and using libraries is fine as well. But caution is needed.
It is perfectly fine to have your own solutions even though libraries exist.
It is important to understand what your code is doing and have ownership over it.
And it is also important to know when to let go. There are great libraries out there and if your business is not crazy dashboards, you probably have better things to do than figure out how to draw a pie diagram.
And in many cases, it is just fine to start pounding some code, learn the ins and outs, and only then decide whether some library can do it better.