4 ms·
I was just replying to the class vs prototypes part. There usually is a once-in-a-year situation that is solved better with classes, so I somewhat agree with yo
by egeozcan 5y ago
I was just replying to the class vs prototypes part. There usually is a once-in-a-year situation that is solved better with classes, so I somewhat agree with your 99% code doesn't need it estimation.
Also I should mention that in the rare case when I did use the prototypes, I always used the adapter pattern (an adapter function that takes a slice of "this", calls an independent function, and merges it back to "this"), it was easier to test.
But people are so unused to declaring dependencies as parameters (even function dependencies aka services), they cry untestable whenever they see independent (static) functions. I know this from the PHP, Java and .NET world. To this day, it didn't help to explain what they call DI is just passing parameters (but rather more bureaucratically).