Should I use a prototype or use OOP for javascript?

I am a developer once now, and over the past few years I have been using the prototype structure and its implementation for OOP, which will be used in Javascript. I also used jquery and some other frameworks.

I am studying the work of js and how it differs from OOP, as it is a prototype oriented language. In my opinion, this is actually a great concept, focused on the prototype language.

Given the correct attention to:
- this is how the language should have been used, therefore it is faster, more productive and theoretically, simpler and smoother.
- Each browser has its own implementation for how javascript should work, which sometimes makes it impossible to work with short code in all browsers, or at least most.
- Usually these OOP frameworks (dojo.declare (), Js.Class, MooTools, etc.) are more than suitable for pleasant work, and they are cross-browsers.

I can't help but wonder if it's worth starting to do RIA using a javascript prototype? Or do I need to go to Dojo.declare () , js.class or something similar?

+5
source share
2 answers

I do not think that you should lose OOP when programming in JS ; I suggest you declare OOP !

  • I prefer the ExtJS library , which provides classes, encourages subclassing, and provides a very good example of a well-defined class hierarchy.
  • Douglas Crockford contains examples of how member data and member functions are private (without protection).
  • Many people use the JavaScript prototype as a means to implement inheritance; see again Douglas Crockford .
  • Polymorphism is simple, since JS is not strongly typed.

, JavaScript- ; , , "ifs" , , JS.

, SO.

+3

prototype.js RIA. , , jQuery. , prototype.js, jQuery. -, prototype.js, , . , . . .. .

0

All Articles