re: Do we really need classes in JavaScript after all? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Even though javascript is a 'functional' language, I would bet that most javascript developers write OO code. If you remember the javascript protot...
 

Of course, I remember definitions on prototypes. But then, I didn't understand very well what's was going on with them. Classes made this simpler and cleaner. Also, they introduced own problems.

The side effect of the SimpleCounter is outside of the definition in purpose. It is private, so users can't trigger it accidentally. It might be strange at first, but it has own sense.

This concept is also great for testing. As you can see, we can export side effects, and create unit tests for them without component initialization. They are just simple functions.

I am not sure what it would look like completely, but this is a great start.

This is exactly what I want, a discussion about better web development. And I will be my success if I encourage someone to create next great ideas.

code of conduct - report abuse