oop

naming a method - using set() when *not* setting a property?

Is setX() method name appropriate for only for setting class property X? For instance, I have a class where the output is a string of an html table. Before you can you can call getTable, you have to call setTable(), which just looks at a other properties and decides how to construct the table. It doesn't actually directly set any class ...

How should I lay-out my PHP login class?

So, there is going to be one login form; however 1 of 3 types of members will be signing in member_type_a, member_type_b, member_type_c all of whom have some of the same properties, and some whom may have specific methods and/or properties to them. I want the class to be saved to a session variable for use with member area pages. Any s...

What is Polymorphism?

Possible Duplicate: Try to describe polymorphism as easy as you can What is polymorphism? ...

Multiple inheritance in OOP

I'm confused about an OOP feature, multiple inheritance. Does OOP allow Multiple Inheritance? Is Multiple Inheritance a feature of OOP? If Multiple Inheritance is a feature then why don't languages like C#, VB.NET, java etc. support multiple inheritance? But those languages are considered as strongly supported OOP language. Can anyone a...

Formal name of Magento’s Class Override Design Pattern?

Magento is a newish (past 5 years) PHP based Ecommerce system with an architecture that's similar to the Java Spring framework (or so I've been told) One of the features of the Framework is certain classes are not directly instantiated. Rather than do something like $model = new Mage_Foo_Model_Name(); you pass an identifier into a s...

Write a network simulator for fun

I want to write my own network simulator, for fun and for personal challenge. I hope to learn both new programming techniques, and a little bit more about networking. Previous object-oriented attempts ended very quickly, but I've recently downloaded and played with Microsoft's Axum (a new version was released today) and their Concurrency...

Where should I put contextual data related to an Object that is not really a property of the object?

I have a Car class. It has three properties: id, color and model. In a particular query I want to return all the cars and their properties, and I also want to return a true/false field called "searcherKnowsOwner" which is a field I calculate in my database query based on whether or not the individual conducting the search knows the own...

Book Store Model

I am developing a solution. I want to model following structure Collection 1 Category 1 Sub Category 1.1 Book 1 Book 2 Book 3 Sub Category 1.2 Book 1 Category 2 Sub Category 2.1 Book 2 Sub Category 2.2...

library classes or model classes?

i have looked into design patterns and mvc and understand the basics of it. but i don't understand if these classes that these patterns are constituted of are library classes or model classes. i'm using codeigniter and don't know if i should put the classes in models folder or libraries folder. the classes could be: observers and ob...

Is there a way to find out how many times a class has been instantiated in php?

I'm currently using this method: class Foo { private static $num_instances = 0; function __construct() { self::$num_instances++; } } which seems to work, but I'm wondering if there's a built in way.... ...

Some basic UML questions

What does it mean when you have something as the following picture? Each Customer has none, one or more Orders while each Order has only one Customer? And in relationship to the following one: What does the black diamond mean in this context? How is that black diamond called? Thanks ...

Java: why does extending need an empty constructor?

I have classes SearchToUser and getFilesToWord. GetFilesToWord must inherit SearchToUser fields. Extending works if an empty construction in SearchToUser-class, otherwise: cannot find symbol symbol : constructor SearchToUser() location: class SearchToUser public class GetFilesToWord extends SearchToUser{ ^ 1 error make: *** [all...

Synonym for "Many-to-Many" relationship (relational databases)

What's a synonym for a "many-to-many" relationship? I've finished writing an object-relational mapper but I'm still stumped as to what to name the function that adds that relation. addParent() and addChild() seemed quite logical for the many-to-one/one-to-many and addSuperclass() for one-to-one inheritance, but addManyToMany() would sou...

add methods in subclasses within the super class constructor

I want to add methods (more specifically: method aliases) automatically to Python subclasses. If the subclass defines a method named 'get' I want to add a method alias 'GET' to the dictionary of the subclass. To not repeat myself I'd like to define this modifation routine in the base class. But if I check in the base class __init__ met...

Programming issue while applying text to the third party control.

Hello I have used some third party controls in my windows application. There is a snippet which is being used in our code which re-initializes all the .text property of all the controls on the form. Everything works fine except for a control. This control is similar to the Windows Panel except for it has a dropdown appearance. This...

Passing parameter to base class constructor or using instance variable?

All classes derived from a certain base class have to define an attribute called "path". In the sense of duck typing I could rely upon definition in the subclasses: class Base: pass # no "path" variable here def Sub(Base): def __init__(self): self.path = "something/" Another possiblity would be to use the base class c...

C#: why have all static methods/variables in a non-static class?

I have come across a class which is non-static, but all the methods and variables are static. Eg: public class Class1 { private static string String1 = "one"; private static string String2 = "two"; public static void PrintStrings(string str1, string str2) { ... All the variables are static across all instances...

Javascript pushing object into array

Hey, I currently am having trouble trying to get this to work. Here's a sample code of what I am trying. A lot has been taken out, but this should still contain the problem. I have an object, user, and an array, player. I am trying to make an array with the players in it, here: function user(name, level, job, apparel) { this.name = nam...

jQuery paradigm?

It seems to me that jQuery doesn't seem to be written as an OOP framework, it seems too short, and not verbose enough for that. Am I right in thinking this and if it isn't written as OOP, then what methodology/paradigm are they using? ...

Interview question: difference between object and object-oriented languages.

My friend was asked the following question: what's the difference between object language and object-oriented language? It's a little unintelligible question. What does term «object language» correspond to? Does that mean «pure» object-oriented language, like the Wikipedia article says: Languages called "pure" OO languages, because ...