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?
Showing posts with label terms. Show all posts
Showing posts with label terms. Show all posts
Terms: Static Members
Posted by
sarahbee
on Monday, July 27, 2009
Labels:
definition,
javascript,
object-oriented,
static member,
terms
/
Comments: (1)
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!
Sarah Learns a New Term - Namespaces
Posted by
sarahbee
on Thursday, July 23, 2009
Labels:
definition,
namespaces,
php,
terms
/
Comments: (0)
Working on implementing SWFUpload or a similar type uploader. On reading the documentation, I see:
Think about this: You are writing the next big Facebook - your php code is getting to around 10,000 lines, and you are using multiple third party plugins. Suddenly you come across a predicament - that nifty third party User Widget has conflicting class names with that other nifty third party thing-a-majig. Namespacing avoids this by allowing you to 'classify' your code (how punny). Assigning a namespace to a php file (you can even assign more than one per file) ensures that the widget USER class does not get overwritten by the thing-a-majig USER class.
For an explanation that actually makes sense, see here:
http://www.sitepoint.com/blogs/2009/07/13/php-53-namespaces-basics/
The main features that SWFUpload provides are:
- The ability to select multiple files in the file browser dialog.
- AJAX-style uploading without a page refresh.
- Upload progress events.
- Namespaced classes compatible with other JavaScript libraries (i.e., jQuery, Prototype, etc.).
- Flash 9 and Flash 10 support. (Flash 8 support dropped in version 2.2.0)
Think about this: You are writing the next big Facebook - your php code is getting to around 10,000 lines, and you are using multiple third party plugins. Suddenly you come across a predicament - that nifty third party User Widget has conflicting class names with that other nifty third party thing-a-majig. Namespacing avoids this by allowing you to 'classify' your code (how punny). Assigning a namespace to a php file (you can even assign more than one per file) ensures that the widget USER class does not get overwritten by the thing-a-majig USER class.
For an explanation that actually makes sense, see here:
http://www.sitepoint.com/blogs/2009/07/13/php-53-namespaces-basics/