Do you know why we often create objects with factories rather than classes?
I did not. As a backend developer forced to write JS during a fullstack freelance gig, I wrote factories because “that’s how the other code looked”.
Now that’s a terrible reason. The differences are simple, and a basic understanding will save you headaches.
In a nutshell, a factory is a function that returns an object, while a class is a template for an object.
But let’s walk through an example of a
RocketShip class to understand how behaviour differs.
Who else loves to write side-effects-free functions? I think we, as programmers, all do. Today, in this story, I will walk you through the basic principles of functional programming that will make your coding life easier.
Formatting code consistently is a pain, especially when working on a team. The beauty of modern-day web development is that the tooling has gotten so much better! In this article, we will look at setting up Prettier to automatically format your code in Visual Studio Code.