(no title)
penprog | 11 years ago
Also how have you not, in a java class, written code that uses polymorphism? That would be the easiest way to understand how useful interfaces are.
penprog | 11 years ago
Also how have you not, in a java class, written code that uses polymorphism? That would be the easiest way to understand how useful interfaces are.
jekrb|11 years ago
My preferred method of "inheritance" really is just extending an object. Which js is great at. And there's multiple ways to do this, with multiple kinds of prototypes. For something quick an easy I can make a prototype and just pass that through object.create() and now I have a new object that has all the properties of what I would loosely consider to be a "parent". It's more cloning than it is inheritance, and I can completely override properties however I want, while the original properties stay unchanged.
IMO polymorphism and interfaces in Java seem more like hurdles and added complexity compared to object extension and cloning in JavaScript. _.extend paired with browserify also makes for extremely modular code that I haven't seen any Java code compare too.
woah|11 years ago
I think that a lot of "classical" programmers simply don't understand how important modules are to JS development.
This is why you get these posts about "how can you manage 1,000,000 LOC in JS!!?", when they don't understand that you never have 1,000,000 in JS, you have a bunch of small, unit tested modules.