I have two models than inherited from the same abstract base class.
I would expect to be able to get all instances from classes that are children of the base class with something like AbstractClass.objects.all()
Of course I could join queries on all children but that's awful and it stops working if I add new children class.
Is this p...
In my C# winforms application I need to draw blocks. These blocks are so called process blocks. All the blocks together are a process. There are different kinds of process blocks. At this moment I have three kinds of process blocks: A, B, C. When I draw a process block it looks like this:
A
B
B
C
A
Every block has it's own backgrou...
Hi, I have an object that holds lots of ids that are accessed statically. I want to split that up into another object which holds only those ids without the need of making modifications to the already existen code base. Take for example:
class _CarType(object):
DIESEL_CAR_ENGINE = 0
GAS_CAR_ENGINE = 1 # lots of these ids
class ...
Hi guys, I'm learning Java (2nd year IT student) and I'm having a little problem. With inheritance to be precise. Here's the code:
class Bazowa
{
public Bazowa(int i)
{
System.out.println("konstruktor bazowy 1");
}
public Bazowa(int j, int k)
{
System.out.println("konstruktor bazowy 2...
Hi all,
Can any one explain with simple example of Command Pattern. I refer in internet but i got confused.
Thanks,
Ravi
...
HttpServerUtility contains a public function called UrlEncode. It is not a shared function. HttpServerUtility does not have any public constructors.
Doing this fails:
Dim encodeMe As String = "a string to be encoded!"
HttpServerUtility.UrlEncode(encodeMe) 'Bombs out
This works, and is how Microsoft says to do it:
Dim instance As...
This question was asked already here, but rather than answering the specific question, descriptions of how the decorator pattern works were given instead. I'd like to ask it again because the answer is not immediately evident to me just by reading how the decorator pattern works (I've read the wikipedia article and the section in the bo...
Sometimes we design more than one algorithm to get the same results. For instance, I have written a class which stores my data in trees, and another class that stores roughly the same data in, say, linked lists.
I will publish an interface (abstract class) called ThingStore, and I'll subclass it to TreeThingStore and ListThingStore, eac...
I have been using an Object-Oriented MVC architecture for a web project, and all the models are OO Perl. But I have noticed a couple on the team are reverting to procedural techniques and are essentially using "objects" as dumping grounds for related functions. Their functions basically read/write directly to/from the database.
What's t...
I can't use simply get_class_vars() because I need it to work with PHP version earlier than 5.0.3 (see http://pl.php.net/get_class_vars Changelog)
Alternatively: How can I check if property is public?
...
What is the general way of handling complex results from functions with an object? A simple method might return true or false, and that would be all I need to know. A more complex method might return true or false, but there might be more information I would want to get out of the class, such as why it failed ( there might be several rea...
What is the proper way to handle polymorphic business objects in a WCF/SOAP world?
It seems to me that SOA and OOP are at odds with each other - to expose a clean WSDL you need concrete objects, typically not even utilizing inheritance. On the other hand, presumably in the underlying system, you'll want to follow proper OO design.
Wha...
I'm just getting into using prototypal JavaScript and I'm having trouble figuring out how to preserve a this reference to the main object from inside a prototype function when the scope changes. Let me illustrate what I mean (I'm using jQuery here):
MyClass = function() {
this.element = $('#element');
this.myValue = 'something';
...
Why do we use Interface?
Is it only for Standardization?
...
Hi Guys,
Im trying to get a value from an array used in the Joomla Plugin Hot Propertys. The array is stored in $this->properties inside that is group of arrays (sorted by number) and inside each one of them is a key called typeid.
Basically i just need to get the typeid from one of those arrays (for example array 0)
Ive tried $this-...
I want to create a class that can only be inherited, for that i know it should be made abstract. But now the problem is that i want to use functions of that class without making them static. How can i do that.
public abstract Class A
{
A()
{}
public void display()
{}
}
public Class B:A
{
base.A() // this is accessible
this.displ...
By broadening my horizons with javascript together with my python experience I put some thought.
What's the purpose of type if the vision of an entity to an external client is via its interface ?
In static typed languages, the type has a very strong, central importance. Type and interface are strictly associated. For example, in java w...
I am working on a simple problem to represent a few types that have a hierarchical structure. There is a data row that contains some data, and the data could vary from type type of row to another. A simple row might only have a title and date, while an extended row may contain a title, description, date and an image. I am not new to Java...
Is there a practical way to get the sender of a message in Smalltalk without manually passing self as a Parameter?
To be more concrete: I want to add a class specific prefix to an ID that gets passed to my class, so if ClassA sends (on class side)
ClassB doSomethingWith: 'myId'.
ClassB should internally treat 'myId' as 'ClassB-myId' ...
If I'm writing a class, when do I make a method private, versus protected? In other words, how I can know in advance that a client programmer would never ever need to override a method? In a case where it's something that has external considerations, like a database connection?
...