Looking for a way to dynamically generate and assign variable names to objects in javascript, I found this post on creating a sort of variable variable in Javascript. Reading the post itself, I found the answer to my immediate question. However upon reading the comments, I feel like I had a moment of clarity in my understanding of the truly awesome power of javascript, dot notation, and prototype. Why is javascript so underestimated? I see this changing in the very near future...
http://www.i-marco.nl/weblog/archive/2007/06/14/variable_variables_in_javascri
Showing posts with label object-oriented. Show all posts
Showing posts with label object-oriented. Show all posts
Javascript Variable Variables
Posted by
sarahbee
on Friday, August 7, 2009
Labels:
javascript,
object-oriented,
prototype,
variables
/
Comments: (0)
Prototype vs OOP
Posted by
sarahbee
on Wednesday, July 29, 2009
Labels:
javascript,
object-oriented,
prototype
/
Comments: (0)
Wikipedia tells me many things. Most importantly at the moment, it tells me how to move my fresh new conceptual understanding of object oriented programming over to Javascript, which is not Technically object oriented, by prototype based.
Yep, the same prototype I discovered and mentioned earlier.
Are you following along children? This rabbit hole keeps going deeper...
http://en.wikipedia.org/wiki/Prototype-based_programming
UPDATE:
This article is an excellent stepping stone for understanding prototyping in javascript. Excellent even for those with shaky knowledge of OOP.
http://www.packtpub.com/article/using-prototype-property-in-javascript
Yep, the same prototype I discovered and mentioned earlier.
Are you following along children? This rabbit hole keeps going deeper...
http://en.wikipedia.org/wiki/Prototype-based_programming
UPDATE:
This article is an excellent stepping stone for understanding prototyping in javascript. Excellent even for those with shaky knowledge of OOP.
http://www.packtpub.com/article/using-prototype-property-in-javascript
Sarah Takes the Plunge into OOP. Finally.
Posted by
sarahbee
on Tuesday, July 28, 2009
Labels:
object-oriented,
php,
tutorial
/
Comments: (1)
Hello non existent blog readers.
*thanking Firefox for spell checking so I don't always spell existent wrong*
This is it. It's time to face the facts. I don't really know anything about Object Oriented Programming - beyond the abstract concepts. And I must. So here goes.
I'm going to be working on it from a PHP angle, as that's the OO language I'm the most comfortable with. I'm going to be starting from here:
http://www.codewalkers.com/c/a/Programming-Basics/Beginning-Object-Oriented-Programming-in-PHP/
Updates to follow of course. Wish me luck.
*thanking Firefox for spell checking so I don't always spell existent wrong*
This is it. It's time to face the facts. I don't really know anything about Object Oriented Programming - beyond the abstract concepts. And I must. So here goes.
I'm going to be working on it from a PHP angle, as that's the OO language I'm the most comfortable with. I'm going to be starting from here:
http://www.codewalkers.com/c/a/Programming-Basics/Beginning-Object-Oriented-Programming-in-PHP/
Updates to follow of course. Wish me luck.
Javascript IS object oriented...sorta.
Posted by
sarahbee
on Monday, July 27, 2009
Labels:
javascript,
links,
object-oriented
/
Comments: (0)
http://robertnyman.com/2008/10/14/javascript-how-to-get-private-privileged-public-and-static-members-properties-and-methods/
Helps if you understand object oriented programming - of course, this article is so straightforward it can almost help you understand it!
The extremely long url says it all.
Helps if you understand object oriented programming - of course, this article is so straightforward it can almost help you understand it!
The extremely long url says it all.
Terms: Static Members
Posted by
sarahbee
Labels:
definition,
javascript,
object-oriented,
static member,
terms
/
Comments: (1)
Static Members are used with object oriented programming. A static member is a variable shared between all instances of an object. For example, if you had an object myObject with the static member objectCount, then myObject.objectCount++ would increase this value by 1 across all instances of myObject.
As javascript is not a typical object oriented language, the way object are created is slightly different. It seems typically they are assigned to a function - ie:
myObject = function(){ createObject(); }
and then
myObject.objectCount = 0;
Yes. This does mean you are assigning values to functions. I know! I'm still trying to wrap my head around it as well. I'm not even sure I'm using the right terminology to define this. So HA!
Let's just worry about understanding the definition of static member for now, shall we?
As javascript is not a typical object oriented language, the way object are created is slightly different. It seems typically they are assigned to a function - ie:
myObject = function(){ createObject(); }
and then
myObject.objectCount = 0;
Yes. This does mean you are assigning values to functions. I know! I'm still trying to wrap my head around it as well. I'm not even sure I'm using the right terminology to define this. So HA!
Let's just worry about understanding the definition of static member for now, shall we?
Tems: Prototype
Posted by
sarahbee
on Friday, July 24, 2009
Labels:
definition,
javascript,
object-oriented,
prototype,
terms
/
Comments: (0)
Hello again children. Today we are going to learn about a nifty little property in Javascript - PROTOTYPE.
First off, have you ever worked with objects in Javascript? Tell me about it in the comments if you have. There is some debate over whether Javascript is truly an object oriented programming language or not (see here: http://javascript.crockford.com/javascript.html to learn why we tend to underestimate this language.) Either way, the prototype property is meant for working with javascript objects. Since I don't really know much about Object Oriented programming myself (which I plan to soon change!), I can't honestly give you a full run down on what it means/does. I'm just going to tell you the gist and give you the link so you can read for yourself.
Basically the idea is by using someObject.prototype.someMethodOrValue = something, you are in fact assigning that method or value to all instances of this object.
I have a hunch that this little feature may be at the heart of what makes JS object oriented. But I think I'll have to get back to you on that once I actually KNOW something about it. In the meantime, read about it for yourself.
Ta ta for now!
First off, have you ever worked with objects in Javascript? Tell me about it in the comments if you have. There is some debate over whether Javascript is truly an object oriented programming language or not (see here: http://javascript.crockford.com/javascript.html to learn why we tend to underestimate this language.) Either way, the prototype property is meant for working with javascript objects. Since I don't really know much about Object Oriented programming myself (which I plan to soon change!), I can't honestly give you a full run down on what it means/does. I'm just going to tell you the gist and give you the link so you can read for yourself.
Basically the idea is by using someObject.prototype.someMethodOrValue = something, you are in fact assigning that method or value to all instances of this object.
I have a hunch that this little feature may be at the heart of what makes JS object oriented. But I think I'll have to get back to you on that once I actually KNOW something about it. In the meantime, read about it for yourself.
Ta ta for now!