fizzalex (1) [Avatar] Offline
#1
Hello authors and fellow readers, my name's Alex and I've got a few questions. They're not specifically about the book, but I don't really know where else to post them. I don't have much experience with Javascript, so please bear with me. I've got experience with PHP, but that's a procedural (is that a word?) language, not an object oriented language.

Right now, I'm on chapter 3, the one about refactoring. I read and applied the preceding chapters, which I understand clearly. However, I don't really understand what's happening in chapter 3. I went ahead and skipped to chapter 9, to start on the double combo box. I understand what's going on in the code, although writing it from scratch would be a stretch for me. Anyways, I finished the little piece of code, and it worked (as expected). I made minor changes for my own purposes, to understand it a little better, and those worked as well. However, when the chapter started on refactoring this thing, it lost me again. I was quite worried so I went to Appendix B and read the entire thing. It REALLY helped me, but I'm still left with questions. I'd like to ask them now, if that's OK. I don't mind if you don't answer them all, but it would help me a lot if I could get some clarification or links where I can find more information about them.

1. I understand how to create an object, but why would one create an object? Is it to have all the methods and variables in the same bit of code?

2. I'm having trouble getting my mind around the "this." concept. What is it used for?

3. The prototype class (I think that's what it is). Is it used to define a set of methods common to a set of objects, and then build the objects off of it? If so, could someone set up an example where it's clear which properties go where?

4. Constructor - I don't really understand this, could someone explain this in terms I could understand?

In no way am I putting down this book, I realize the book does a great job explaining things for OO programmers. I'm just not an OO programmer (I'd love to learn, with your help). Thanks for reading this, and I hope I can get some resources where I can learn more. Thank you for your time,

Alex