Possible Duplicates:
Anyone else find naming classes and methods one of the most difficult part in programming?
Whats the best approach to naming classes?
Finding appropriate abstraction names can sometime be time-consuming, especially if your mother tongue is not english. I was wondering if there exists somewhere some sort...
Hi,
I am creating a software project in which most business objects are stored in files (in a legacy format). The objects will only be instantiated from an inputstream.
I do this today with making the constructor private and instantiating in a static function as follows:
public class BusinessObject {
private BusinessObject() {}
...
I have created a monster, or at least a lot of MATLAB handle classes that point to each other. For instance, an experiment (handle) is a set of tracks (handles) which contain runs (handle) and reorientations (handle). Then the tracks point pack to the experiment that contains them, the runs and reorientations point back to the track th...
I recently came across the situation where I wanted a set of classes to be passed into a method (so that method took an interface as a parameter).
However, the classes under the interface each had a different number of methods, so the interface itself was blank.
What, if anything, does this say about the design of my application? I was...
Can someone point out the main differences between the two?
It seems that, at least conceptually, the two are very closely related. If I were to hazard a guess, I would say that the publish/subscribe method is a subset of the mediator pattern (since the mediator need not necessarily be used in the publish/subscribe manner, but the latt...
Hi,
I have a question re object-oriented design - I have two classes, a Map (in effect an x,y grid) and Items placed on the map. The Map holds all the items and their locations and controls the program flow. The Items have some intelligence and determine if the wish to move around on the map.
For instance the map code may look like:
...
As we know we can instantiate an object without new keyword by using classloader/object cloning/object serialization. When I am using these techniques to create an object, is the constructor called or not?
...
We cant instantiate an abstract class.Then what is the necessity of having constructors in abstract class.Please give me some examples?
...
If I say
class A{
}
then it implicitly inherits Object class.So I am having the class as below:
class A{
protected Object clone(){
} /// Here i am not overridning
//All the other methods (toString/wait/notify/notifyAll/getClass)
}
Now Why cant I access the clone() method in Class B which is in the same packag...
Is there a way to specify an object's attribute's type in PHP ?
for example, I'd have something like :
class foo{
public bar $megacool;//this is a 'bar' object
public bar2 $megasupercool;//this is a 'bar2' object
}
class bar{...}
class bar2{...}
If not, do you know if it will be possible in one of PHP's future version, one day ?
...
Hi,
Does php function parameters pass as ponter to object or as copy of object?
Its very clear in C++ but in php5 I don't know.
Example:
<?php
$dom=new MyDocumentHTMLDom();
myFun($dom);
?>
parameter $dom pass as pointer or as copy?
Thanks
...
I have a class whose sole purpose is to decide, based on a setting, whether to call A) a business layer using a WCF service first or B) the business layer directly.
What is the naming convention for a class the is just a redirector. I was thinking either using "Wrapper" or "Controller" in the class name.
...
You have a static function:
public static function foo()
In the same class you have a static variable:
public static $uaa
How do you refer to $uaa from foo()?
...
I have been into C# and always feel confusion between what should be selected between interfaces and abstract classes. Can some one please help resolve this query ?
Thanks ,
...
I'm starting a new project that will require use an external REST API that basically returns JSON and XML files. It's similar to the StackExchange API and I see every wrapper that has be done for that API has a different approach; for instance, stackoverflow-java-sdk uses the Adapter Pattern.
So, in order to make sure every new API feat...
I have extracted following difference between inheritance and composition. I wanted to know what does delay of creation of back end object mean? Please find below difference.
Composition allows you to delay the creation of back-end objects until (and unless) they are needed, as well as changing the back-end objects dynamically through...
I was going through an article on event bubbling in asp.net and came to know that although it is possible to subscribe to the click event of a user control's button from the containing page, "doing so would break some of the object oriented rules of encapsulation". A better idea is to publish an event in the user control to allow any int...
Let's say I have something like this:
abstract class Parent
{
protected function foobar($data)
{
//do something with data
return $result;
}
}
class Child extends Parent
{
public function foobar()
{
$data = ...;
return parent::foobar($data);
}
}
As you can see, foobar is generi...
Hey,
I have two separate objects, a main and a "child". Its physically not a real child object, because I add the whole parent through the constructor to the child.
Like this:
class core
{
public function __get($class)
{
$this->load($class);
}
public function load($class, $file = null, $lib = true)
{
...
Very often I face the same problem with Flex: When I create a skin for spark component or create new spark component based on another spark component I have inherited properties that I don't need. For example, when I create a custom skin for spark.components.Panel I don't need RectangularDropShadow. At the moment to get rid of it I remov...