Relative Content

Tag Archive for encapsulation

Is it ‘safe’ to expect myClasses to agree not to only call package Scope methods from other Package scope methods?

The questions says it all, but a quick overview of the situation. I’m creating a Model which contains classes (all inherriting myObject) which have a large amount of interconnection. I want the controller to be able to create any of these objects any time, without modifying the Model. Only an explicit cal to the model to “AddToModel” would ‘install’ the object into the model (including updating all the connected objects). myObjects will use a factory pattern, if a user tries to create something already represented in the Model the already-instanced object in the model will be returned instead of constructing a new one.

Go with an object-oriented perspective [duplicate]

If there’s a chance that you will reuse this code, then I would
probably make the effort to go with an object-oriented perspective.
Using the global namespace can be dangerous — you run the risk of
hard to find bugs due to variable names that get reused. Typically I
start by using an object-oriented approach for anything more than a
simple callback so that I don’t have to do the re-write thing. Any
time that you have a group of related functions in javascript, I
think, it’s a candidate for an object-oriented approach.

Go with an object-oriented perspective [duplicate]

If there’s a chance that you will reuse this code, then I would
probably make the effort to go with an object-oriented perspective.
Using the global namespace can be dangerous — you run the risk of
hard to find bugs due to variable names that get reused. Typically I
start by using an object-oriented approach for anything more than a
simple callback so that I don’t have to do the re-write thing. Any
time that you have a group of related functions in javascript, I
think, it’s a candidate for an object-oriented approach.

Go with an object-oriented perspective [duplicate]

If there’s a chance that you will reuse this code, then I would
probably make the effort to go with an object-oriented perspective.
Using the global namespace can be dangerous — you run the risk of
hard to find bugs due to variable names that get reused. Typically I
start by using an object-oriented approach for anything more than a
simple callback so that I don’t have to do the re-write thing. Any
time that you have a group of related functions in javascript, I
think, it’s a candidate for an object-oriented approach.