开发者

intermediate in javascript looking for a book to learning object oriented programming [closed]

Close开发者_如何学God. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

I am an intermediate javaScript programmer, and i am interested in expanding my knowledge in object oriented programming (especially object oriented JavaScript).

I would prefer a book over browsing scattered web resources, does anyone have an idea of which book will be best to get a head start with?

Thanks


Object-Oriented JavaScript published by Packt was an invaluable resource for me recently when I was trying to learn JavaScript's prototype-based system without letting my traditional OO knowledge (Java, etc.) get in the way and make it more confusing.

For a slightly less in-depth treatment, I also recommend Pro JavaScript Design Patterns and John Resig's Pro JavaScript Techniques. Both have chapters on the topic.


It is important to distinguish between classic OOP and OO JavaScript.

While some languages such as Java, C# and Python are good for learning OO concepts such as classes, objects, inheritance and polymorphism - JavaScript is not one of those languages.

JavaScript can have object-oriented features but through the use of prototypes. It gets more complicated due to the complex data structures.

I think you should define exactly what you are looking after. If it's learning object-oriented concepts, you should go with a classic OO language to learn the basic concepts, and only then continue on to OOJS.


Refactoring: Improving the Design of Existing Code by Martin Fowler while the examples are given in Java, the principles behind it are applicable to most OO languages including JavaScript.


Definitely worth reading: JavaScript: The Good Parts by Douglas Crockford.

The chapter 5, "Inheritance" covers different types of Object Orientation:

  • Pseudoclassical, simulating Class hierarchies by extending prototype objects with new methods
  • Prototypal, without classes, using prototype objects to create new instances with common functionalities, then attaching new functions to these new objects directly
  • Functional, using constructor functions to create a private scope and return a new object grouping a set of methods with privileged access to the private variables
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜