If you are using OOP, you are familiar with initializing class members in the head of the source:
/** * Pseudocode */ class Foo { int i = 0; Array bar = new Array(); }
However, if you are using Javascript’s prototypying, assigning objects to class (prototype) members will result in static instance variables.
Example:
teaching javascript the concept of interfaces
Posted by: Thorsten Suckow-Homberg
There’s an easy way to simulate Interfaces in Javascript, this post shows you how it is done.
(Beware, I’m going to mix OO terms in this posts a little bit for the sake of Javascript, but readers familiar with OO concepts will understand what I mean.)
At first we will extend Javascript’s native Object with a method called __implements, which is responsible for comparing class-methods with method-stubs (declared as strings) in an “interface” (quoted, because it is not an Continue Reading →
MAY
fighting the spill
Posted by: Thorsten Suckow-Homberg
More than a year ago I was digging deep in the sources of the Java-like GNU Classpath, trying to find a way to adopt the MVC Pattern they are using. Despite all the hassle with translating and substituting objects, methods and functionality (have you ever taken a look at the ...
Continue Reading →MAY
there is no spill! there is no spill!
Posted by: Thorsten Suckow-Homberg
I bet most of you know those days where hacking your software goes just fine until you expect a minor feature to cause huge problems. It happened to me on saturday when I wrote the layout manager for my javascript empowered table widget. The architecture will be similar to JTable found in the Java/GNU Classpath API – their idea of the separation between the data model and the view/controller is easy to understand, yet powerful.
Since working with ...
MAR
