Questions for oop


5005

best name for object for collection of semantically-related inputs?

I'm writing an HTML form generation library. There's a top-level Form class, and at the bottom there are classes for each type of HTML form input object (Select, Textfield, Radio, etc.). There's a ...
1413

Translating a Perl reference to OO PHP?

So I tripped across another oddity in translating the old developers Perl script into
9131

How would you design a docking library for WPF?

I want to implement a docking library in wpf with behavior similar to Adobe Photoshops CS3.
4624

Conception of inheritance in object-oriented languages

I was discussing multiple inheritance vs. single inheritance with a friend of mine, and discovered that plainly, my conception of Object-Oriented design is completely different than his. I am mostl...
8187

AS3 - Returning a property of a class rather than the class itself

In ActionScript 3, there are some classes that will represent a value rather than the class itself. It's hard to explain properly what I mean, so take this example:
8339

Inexplicable NameError with command-line Python

I am working my way through the excellent 'Python The Hard Way' and copied the following code into a file called mystuff.py:
8315

What is a good design for an interface with optional components?

Suppose I have an interface that supports a few potential operations:
7733

Abstract Design Pattern implementation

I started learning design patterns a while ago (only covered facade and abstract so far, but am enjoying it). I'm looking to apply the Abstract pattern to a problem I have. The problem is: Support...
9220

How Does Knowing Ref and Val types Help

I have been reading up on Reference and value types. I get the idea. But how does this help me while coding? I don't have any good examples to understand those times where knowing this stuff hel...
5832

Where should properties reside when modeling OOP? Small example included

I'm looking to learn how to use interfaces and base classes effectively. I'm not exactly sure where to put common properties? Do only behaviors belong in an interface? If properties such as: Color ...
8287

More than 1 facade class in 'facade design pattern'?

Is it acceptable to make more than 1 facade class (not instance) in a facade design pattern?
6109

Object Oriented MySQL Statements, PHP

So far i have got the code below which works lovely when trying an update, delete or select statement. However I run into problems when I try to use an insert. If someone could point me in the corr...
5636

Thou shalt not inherit from std::vector

Ok, this is really difficult to confess, but I do have a strong temptation at the moment to inherit from std::vector.
5884

this. vs base. for inherited protected non-virtual methods?

Whithin my sub-class, should I refer to an inherited protected non-virtual method as this.Method() or base.Method()?
673

Late static binding

I've got a little problem. Here it is:
5794

Calling constructor from another constructor?

I created three classes: Shape (base class) , Rectangle and Square. I tried to call Shape's constructor from Rectangle's and Square's constructors, but the compiler shows errors.
4175

How to write main() in an OOP way?

When I first started programming, I wrote everything in main. But as I learned, I tried to do as little as possible in my main() methods.
6533

How important is it to indicate if a class implements an interface in Perl?

I've been discussing a code style issue with a friend. We have a series of packages that implement an interface by returning a specific type of value via a named subroutine. For example:
6408

Ambiguity between Static and Instance Code

I have two items in my class: One is a public property, and the other is a static method that takes a parameter.
4953

Annoying duplication in derived classes

In every form we derive from FormBaseControl, we have the following code. I'm sure there is a better way to type the controller object than this, but at the moment we have it included in every pag...
3451

object - How top most base class got Method.

Yesterday i gone through some article about EventAggregator, there some shot of code written like this,
2402
4792

Interface inheritance: what do you think of this:

When reviewing our codebase, I found an inheritance structure that resembles the following pattern:
9981

What is the best way to get config variables into a class in php 5?

This is for my DB class. I am new to OO, been a procedural lad for some time, so I'm still a bit murky.
2815

DataSource pattern versus setting Properties while Configuring Objects

I often get confused with when to use DataSource Pattern and when to use the Properties for providing configuration information to objects.
5250

JavaScript access elements from custom object

This must be a very stupid question, but I just can't get it to work.
2794

How to Establish Inheritance Between Objects in JavaScript?

I have the following code that creates two objects (ProfileManager and EmployerManager) where the object EmployerManager is supposed to inherit from the object ProfileManager.
7061

Object Oriented design for PHP application

For our school project, we are tasked to define a design document describing the architecture of a PHP application.
9929

Any PHP function that will strip properties of an object that are null?

I am returning a json_encode() of an array of objects pulled from an ORM. It includes lots of properties with a null value. What is the neatest way to remove these properties that are null? I gu...
3602

Efficient way to define a class with multiple, optionally-empty slots in S4 of R?

I am building a package to handle data that arrives with up to 4 different types. Each of these types is a legitimate class in the form of a matrix, data.frame or tree. Depending on the way the dat...
9632

this keyword in Java and in PHP

Today I started work on a small Java app. I have some experience with PHP OOP and mostly the principle is one and the same. Though I thought, that it should apply both ways.
8118

Can I overload operators for my own classes in Delphi?

I faced a little trouble - I do not know if I can define my own operators for my classes.
2565

Should I use integer ID or pointers for my opaque objects?

I'm writing an abstraction layer on top of some graphics API (DirectX9 and DirectX11) and I would like your opinion.
5321

PHP Setup Object-oriented classes correctly?

I've been told I have to create a config.php file that will hold all of the classes.
1268

PHP equivalent of friend or internal

Is there some equivalent of "friend" or "internal" in php? If not, is there any pattern to follow to achieve this behavior?
6299

Default implementations of Abstract methods

I am dealing with a large codebase that has a lot of classes and a lot of abstract methods on these classes. I am interested in peoples opinions about what I should do in the following situation....
4404

Interface defined inside a class

How to indicate that an interface is a part of class? Let's take this case as an example.
8788

Simple Objects in PHP question

I know you can create an array like this:
7905

Are interfaces redundant with multiple inheritance?

This is not yet another question about the difference between abstract classes and interfaces, so please think twice before voting to close it.
3204

Multiple class inheritance?

Based on the figure below, I wrote my code.
5895

Producing an abstract collection from an abstract collection

This issue has been bugging me for a while. Abstractly speaking, regardless of language, there are often situations when you want to have a method like this:
1695

Variable with same class name?

What are the reasons behind that we can not declare and define a variable(property) inside a class with the same name of the class itself? For example this code is not right(at least in MS VC++):
5521

Where is the best location for this function? C++

Is it alright to have a function that is not a part of any specific class when using an object-oriented approach. In my case, I would like to have a check_collision() function that takes two SDL_Re...
2586

Why is using a class as a struct bad practice in Java?

We recently had a code review . One of my classes was used so that I could return/pass more than one type of data from/to methods . The only methods that the class had were getters/setters . One of...
3024

Unexpected results when converting a namespaced object to an array

I'm having unexpected results when converting a namespaced object to an array.
6341

How to properly structure functions?

let's say we have a class with some methods in it, of which at least one is of rather complex nature:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.