oop

Draw UML diagram from php code

Possible Duplicate: PHP UML Generator Please, can you advise me a programm for generate UML diagram ...

Python class variables or class variables in general

From Dive into Python: Class attributes are available both through direct reference to the class and through any instance of the class. Class attributes can be used as class-level constants, but they are not really constants. You can also change them. So I type this into idle: IDLE 2.6.5 >>> class c: counter=0 >>> c ...

Struct vs namespace for C++ component based design

We have a component based C++ design, where each component is comprised of a public outer class that is used to group component interfaces. Each interface is defined as a nested class as shown below. struct ComponentContainer { class InterfaceClass_1 : public ComponentInterface { public: virtual ~InterfaceClass_1 (...

How should I model my code to maximize code re-use in this specific situation?

Updated: See end of question for how I implemented the solution. Sorry for the poorly-worded question, but I wasn't sure how best to ask it. I'm not sure how to design a solution that can be re-used where most of the code is the exact same each time it is implemented, but part of the implementation will change every time, but follow si...

Problem using abstract factory..

Hi, I am using an abstract factory to create user interface components such as dialogs. The abstract factory used is returned from a currently selected generic "INode" which is the base class for several different types of node. So for instance, if I want to add a new node of the same type as the selected node, the scenario goes someth...

Naming practice for objects of a class in Python

I have this weird problem as to how to name objects of a class. For example, consider the class: >>> class DoSomething: pass What should I call the object of this class? do_something or what? Since I came out of the learning stage, I used to use x, y or z or whatever came to my mind. But now since I am learning to write prop...

Two similar classes, which should do the work?

I've 2 classes. One is a linq-to-sql class and the other is a seriazable data-dump class. Examples: Class TableNotes Id UserId NoteText ... functionality [Serializable] Class NoteDump NoteText ... functionality They both would share a common set of functionality. I decide it is best for me not to duplicate this functionality and th...

Accessing Static Variable from child->child class php

I have the following setup: <?php class core { static $var1; } class parent extends core { function getStatic() { return parent::$var1; } } class child extends parent { function getStatic() { // I want to access core static var, how can i do it? //return parent::$var1; } } ?> I need to be able...

Inner Class. What is its purpose?

Can someone tell me what the purpose of having inner classes? I can think of a few but may be they are not good reasons for using inner classes. My reasoning is that inner class is helpful when you want to use a class that no other classes can use. What else? ...

Why is class variable accessible at the instance without the __class__ prefix?

See example below. Using the _class_ prefix with the class instance 'object' gives the expected result. Why is the class variable even available at the class instance 'c()' without the _class_ prefix? In what situation is it used? >>> class c: x=0 >>> c.x 0 >>> c().x 0 >>> c().__class__.x 0 >>> c.x += 1 >>> c.x 1 >>> c().x += ...

Calling Constructor from another Constructor

I want to do something like this public class Class1 { public Class1() { } public Class1(int a) { } } public class Class2 :Class1 { public Class2(int a) { } public Class2(): base(2) { this(2); // new Class2(2); } } I k...

Abstract class can't be instantiated but can have constructor - little confusing, please explain

Possible Duplicates: Why do abstract classes in Java have constructors? abstract class constructors? We know abstract class can't be instantiated but on the other hand it can have constructor. Please explain why abstract class can have a constructor ? How compiler handles this situation? ...

Builder pattern vs. config object

The builder pattern is popular to create immutable objects, but there is some programming overhead to create a builder. So I wonder why not to use simply a config object. The usage of a builder would look like this: Product p = Product.name("Vodka").alcohol(0.38).size(0.7).price(17.99).build(); It is obvious that this is very readabl...

Why is separation of user and profile data considered good?

Hello. I've been reading this question and felt that I don't quite agree with the statement Separation of user and profile data is a nice touch. As I see it, profile data, such as, e.g. country or whatever belongs in the user object, while separating such data into profile leads to creating a new object (and table) with 1-to-1 relation...

Object oriented tip needed

I've a situation described below Model class (M) which contains a hashmap (h) as a private field ( getter & setter exposed ). A new class (A) with access to (M) needs to modify (M)'s hashmap (h) which of the following could be a better way of achieving this a. use (h)'s getter. i.e (M).getMap().put(a,b) everytime I want to popu...

Change object behaviour...but just some lines!?

Hello there freaks & geeks. Here comes my question again, thanks for helping!. Lets suppose i have an object Foo, which method foo() does about 100 lines. foo() { ... qwert yuiop asdfg zxcvb nmhjk ... } If a developer wants to add some code to foo(), it can be easily done with inheritance, composing or a Decorator Pattern. But...

Is it possible to assign an interface to an object at runtime?

After reflecting upon all the great answers I received to my previous question about modeling my code to maximize code re-use, I started wondering if it would be possible to assign the interface to an object at runtime instead of when it is coded. Take, for example, a simplified portion of code from my previous question: public class O...

How can I better represent user permissions?

In my system I have a single class with a load of (20?) final booleans defining the permissions this user type has. What is a better way to do this? I'm sure there's lots of examples about this but I don't know the keywords. ...

Question about abstract factories and injection.

Hi, This is similar to one of my other questions, but different enough I think to warrant a new question. Basically I am writing a user interface, and my user interface has nodes that can be selected. When a node is selected, the user interface ends up with an abstract node base class "INode". From this I get a factory by doing node->...

How to pass a class into another class to a codebehind?

How to pass a class into another class to a codebehind? When I debug and check the myCategoryObj in the Default.aspx page, I can see the object is in the debug. What am I doing wrong? I know I could create the object in the Default.aspx but I should not have to I should be able to call the Business Logic Layer and ask for an object ...