Prototype-based programming is a style of object-oriented programming in which behavior reuse is performed via a process of cloning existing objects that serve as prototypes.

learn more… | top users | synonyms

8
votes
1answer
117 views

Proper prototypal programming with Node.JS

Practicing Prototypal Code I'm focusing on practicing a very prototypal structure with my code (non library oriented) to begin learning to reuse large portions of my application infrastructures where ...
4
votes
3answers
123 views

Extending Object.prototype in JavaScript

I find the default Javascript extremely poor on useful functions. There are some nice libraries, but somehow I always need something I can't find. Currently, I'd need a method removing all matching ...
0
votes
1answer
55 views

Class-Definition Comparison

Whenever I needed something similar like a "Class" in JavaScript, I wrote it like this: ...
2
votes
0answers
52 views

Implement.js JavaScript module pattern

I have been playing with a new JavaScript module pattern to see what I can come up with. I think it's quite powerful and wanted to know if it is something people would find useful? I'm looking for ...
0
votes
1answer
110 views
3
votes
1answer
47 views

Lunr backed client side search module

I created a client side search module. Could anyone please provide review pointers on it? ...
1
vote
2answers
64 views

How to write factory classes or functions in JavaScript? [closed]

I find that in Javascript there are many methods of creating an object so what would be the appropriate approach for constructing an object and why. ...
2
votes
1answer
71 views

Quick sort implementation in JavaScript in prototype style

I have implemented quickly the quick sort algorithm in JavaScript using prototype based style. The code is rather short (http://jsfiddle.net/b8mfY/): ...
5
votes
1answer
145 views

Prototype inheritance with Knockout observables

I'm trying to write a JavaScript library to allow inheritance with knockout. The fundamental problem when implementing inheritance in Knockout is that each Knockout observable is its own instance, ...
4
votes
1answer
80 views

Graceful JavaScript fallback for external web service failure

I use the src.sencha.io service to resize images on the fly according to device width, saving lots of bandwidth on mobiles etc. Sometimes the service fails randomly with a 503 error, so a fallback is ...
2
votes
1answer
70 views

Prototype OO-style of my THREE.JS application

For several months I'm working with JavaScript and THREE.JS library. Firstly I dislike the prototype-based programming because I have to work a lot of with ...
-3
votes
1answer
44 views

Wanted reference to parent in body of child's method [closed]

After watching this video, I started meddling with prototypal and classical inheritance examples in JavaScript. ...
2
votes
1answer
50 views

Extending prototype of given instance from factory method

I created a rubber ball by extending instance of b2Body prototype of Box2D.js. I get the instance from factory method b2World#CreateBody. ...
2
votes
1answer
144 views

Is my JavaScript OOP style correct?

I have done the following code for testing a web-service. Is my style correct for using OOP in JavaScript? ...
0
votes
1answer
83 views

Coding convention when using differential inheritance

Ever since reading Crockford's "Good Parts" and Johansen's TDD book, I have wanted to use more of the differential inheritance pattern in my coding at work (as in avoiding ...
2
votes
1answer
232 views

Understanding OO JavaScript with a simple scenario

Coming from a Java kind of OOP, I miss a lot of things in JavaScript. I am working on a Node.Js project, and I would like to use an OO approach. Looking around and asking in StackOverflow I came up ...
9
votes
1answer
774 views

Should I put default values of attributes on the prototype to save space?

Suppose I've got a JavaScript function that I'm treating like a class - that is, I want to make many instances of it: ...
7
votes
0answers
183 views

Lua OOP and classically-styled prototypal inheritance

I want to do some object-oriented programming in Lua, and I decided on something like this: ...
3
votes
1answer
251 views

Improve Syntax & Structure

I'm building a small web application and it's starting to get a bit complex. I have reached to a point where I have to run some tests and load some libraries. I made it so I can use it in this way : ...
5
votes
1answer
243 views

Javascript inheritance

I have a simple class inheritance in JS: ...
3
votes
1answer
147 views

Implementation of Javascript Classes and Inheritance

I've created a simple Javascript library to be able to create "classes" and extend them defining instance and static methods and variables. It consists in a simple function Class with two methods: ...
1
vote
1answer
152 views

“metaconstructors” for inheritance in js?

Edit - decl smokes dojo.declare - http://jsperf.com/dojo-declare-vs-decl The code has been updated a bit. ...
3
votes
1answer
293 views

“Class” design in javascript

I'm a systems programmer teaching myself javascript. Prototypal inheritance is completely new to me, so I could use some best practices advice here. I made a simple game (breakout) for my first ...