1. Code management
Be it a simple Todo list or a Nuclear science project you are working on, your code will get messy. You don't know where the URL came from and how it's handled after a point of time. Eventually you'll end up having yelling WTF is happening here syndrome. But if you are stubborn on not using a framework, use ES Modules to segregate your code module wise.⚡️Give this amazing article a read
2. We don't know to use DOM operations
Yes. DOM operations are costly and pretty much differs from browser to browser. Manipulating and updating the DOM tree efficiently is not a piece of cake. And if your application is going to be big enough, you'll end up thinking about performance and scratch your heads.🤢
3. Direct access to DOM
It ain't a good thing to go and touch the DOM directly. So this depends on the scale of your project. If it's a smol news site which just displays the article from a CMS, cool. It's a one time change. If it's a social network where people fight their ass off and end up having millions of comments,🤕Oh boi don't touch the DOM with bare hands.
Because DOM updation is costly and only the specific DIV or a SPAN has to be updated. That's why libraries like React, Vue and so on make you create the document on their virtual DOM and they do the hard work for you using DOM diff techniques to calculate the dynamic parts of your views. At the end they too are going to query the DOM by using document.getElementById and create elements with document.createElement. So trust a framework on this.
4. You'll end up building your own framework.
When your application grows, it suffers from scalability. So you'll start building custom solutions for the problems and end up developing a half baked framework which might not work for the future cases coming to you.
Let's say you have a templating engine like EJS and got to put the data in a bucket store. First you'll start building a data store and then it requires a middleware rendering engine to get the data efficiently to EJS. So you'll build a rendering engine. Then the routing problem comes and so on. You'll end up investing most of your time reinventing the wheel and in building the infrastructure than the application you want to build. Picking a framework that already has solved the problem you have would be a smart choice.
Conclusion
So plan your architecture and the frameworks you want to use before starting building the application. If you are like if the application grows I'll use a framework, you might suffer from scaling.
Happy hacking 🚀
Top comments (2)
It's an awesome writeup., keep writing dude!!
Thanks bud!