DEV Community

Discussion on: Organize your JavaScript OOP code better with this functional programming trick

Collapse
 
andi23rosca profile image
Andi Rosca

I was originally going to talk about freezing but then I decided to scope the article down to only the bare essentials.

I know if you do a freeze on the whole class instance it has weird effects on subclasses and inheritance in general. But it is a pretty good idea to "ensure" that nobody can mutate stuff.

I do think that in some cases you might want to keep your classes mutable though. Just depends on the use case and what you're using them for.