Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Java and C# aren't going to give you the same flavour of protypical inheritance that JavaScript has.

Perhaps you might try Lisp or scheme:

http://www.crockford.com/javascript/little.html



Neither Lisp nor Scheme offer prototypical inheritance out of the box. Lisp uses ol'-fashioned nominal subclassing, while Scheme doesn't even have "objects" in the OOP sense. They're powerful enough to add it, but nobody does because the prototypical object model pales in comparison to CLOS. Come to think of it, every object model that's not CLOS pales in comparison to CLOS...

I think this is a poor recommendation regardless, because programming in JS really is more similar to modern C# than it is to Lisp or Scheme.

Also, Douglas Crockford is an asshat. How did he wind up an authority on anything?


No, not the same. The general concepts are similar, though.

My thinking goes: understanding classic OOP is helpful in learning JavaScript because the high level concepts are the same but in my opinion more obvious and easier to implement in Java/C#.

By more obvious, a Java/C# (+ others) program starts with a class and to add functionality you either have to add more methods to that class or implement another class. So to a new programmer "duh, everything is an object and objects are instances of a class".

It's kind of hard to convey the same idea to someone in JavaScript when {} is called an object, "xxx" is an object, and to compose a new class, you compose a new function.

However, to someone who already understands classes and objects, it's just a new/different way to create classes and objects.


Try not using prototype or class in JavaScript for a while, and you will do just fine without them. If there's a paradigm, or best practice, and you want to learn, don't follow it and see what happens.


I write procedural scripts all the time for just getting things done, often in JavaScript, Perl and PHP.

I've only worked on one application written without any OO patterns, completely procedural, and it was a complete mess.

Adding or extending features caused cascading bugs. Eventually we had to rewrite the backend (PHP) into MVC to be productive. I quit because I dreaded the work. I didn't want to write another line.

I have been pretty interested in functional programming lately, or the functional paradigm everyone in JS is following nowadays, but haven't gotten the chance to take a deep dive yet.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: