We have discussion with our team about next:
What correct name should have variable which will be alias for "this" in anonymous function. Simple example:
var SomeConstructor = function() {
this.someProperty = 'bingo';
this.someMethod = function() {
var myObjectAlias = this;
$('a').click(function() {
...
Assume you divide up your systems in Value objects and Services objects (as suggested in "Growing Object-Oriented Software, Guided by Tests". Misko Hevery calls these "newables" and "injectables".
What happens when one of your value objects suddenly needs to access a service to implement it's methods?
Let's say you have a nice simple ...
With 2 web servers, will a singleton class have 2 instances?
...
Can you give advice if this is right or wrong?
public class DAL
{
Members member;
public DAL(){ }
public DAL(Members mmber)
{
member = mmber;
}
}
...
I have a number of "section items" (Lesson, Info) which inherit from the common type SectionItem. The various types of SectionItems share some but not all properties.
I have found the best way to pass parameters to each kind of object is to pack them all in a Dictionary<string, object> and then let the base class SectionItem unpack the...
Hi, I am a C# developer and these days I am trying to learn Haskell from the online book Real World Haskell. From what I have learnt so far, I am quite impressed with the language. However coming from OO side of the world, I always start with thinking in terms of interfaces, classes and type hierarchies. Because of lack of OO in Haskell,...
I want to create a FIFA soccer solution in OOP (using C# in my case).
For now, I need to represent: Teams, Groups (we have H groups), and Games.
What I did is creating those classes:
Team - which contains several properties like teamName, score, wins etc...
Game - which contains TeamA,TeamB (Both Team objects) and 2 properties TeamAS...
Possible Duplicate:
Whats with the love of dynamic Languages
I'm coming from a c#/java background i.e. strongly typed, OOP language.
I'm very much interested in Python, but I need to learn a little more about the advantages of a dynamic language.
What power does it really give me? (in web applications).
Can someone outline...
What is the difference in processing speed for executing a process using XML manipulation or using object-oriented representation? In general, is it faster to maximize or minimize the reliance on XML for a process. Let it be assumed that the code is highly optimized in either circumstance.
A simple example of what I am asking is which...
Why I need to load the class definition like :
Class.forName("ClassName");
What is the need and advantage of this .Typically which is used to load driver class in JDBC.
...
How can I access static php variable with custom class name. In class c1 method hi() I need to access static variable of its child class. PHP < 5.3
class c1{
function hi(){
$cn=get_class($this);
echo $cn::$b; //need echo 5 here, but error
}
}
class c2 extends c1{
static public $b=5;
}
$c2=new c2();
$c2->hi();
...
I have parent class c1 with function hi(). class c2 extends c1 and contains singleton access through method i(). In class c2 I want to make method with the same name as in c1, which I can call in static scope, but in this method I whan to use singleton instance and call method with the same name from parent class.
class c1{
function h...
Looking for some reference material where i can get some OO designing problems and solution to practice and improve designing skills.
Thanks for your interest.
EDIT: I have read:
- Refactoring by Martin Fowler
- Headfirst Design Patterns (It had problem-solution approach but very limited to a pattern in context).
and have fare idea abo...
Consider the following hypothetical people management system. Suppose each Person object belong to a number of Group objects and each Group contains a number of Person objects. We could represent it by adding a list to each Person and each Group object, but then we have to keep this in sync when we create, delete or modify an object. On ...
Hi,
The question is a bit hypothetical. Let's say I have an application that draws a tree. My structure controller implements the ITree interface that describes a normal tree with methods like: getChildren(), getParent() ... Some parts of the app only needs to know that the structure implements ITree, so it can look for it's children or ...
Hi,
Generally we are using interface concept for RMI implementation also in Event listening ,we are using interfaces .Why cant we use abstract classes in both theses cases.
...
Currently I'm writing a unit test for a component that does datetime specific validation. I have created IDateTimeProvider interface, that serves as a DateTime.UtcNow wraper and business objects use interface rather than DateTime directly. It seems that DateTime is a bit overloaded and should be split into a value and a thing that gets t...
Hello
I'm using the PHP singleton from Wikipedia. The problem is the singleton has a method that loads and runs other PHP scripts via require once and when these script are run and implement the Class method get_shared_instance a new singleton is initiated. Why is this? And what is the work around?
the singleton (in a basic form):
cla...
I've seen something like this:
echo ($hello->somethingA->somethingB);
What does this mean?
I will try to make my question more clear:
When we have $domain->something; (we are accessing something PROPERTY of $domain OBJECT. precise?
When we have $domain->something->run(); we are telling our something PROPERTY of $DOMAIN OBJECT to ...
Hello,
I'm wondering; lets say you start an object in a new class; at the beginning of your app.
If you later pass that object into another class; as a variable and add/modfiy something on it. Will it be updated in the original object and its home class?
Or does it become a 'new' object, a different object in a new class? And will it ...