oop

Is JavaScript object-oriented?

There have been some questions about whether or not JavaScript is an object-oriented language. Even a statement, "just because a language has objects doesn't make it OO." Is JavaScript an object-oriented language? ...

Should you avoid object inheritence when persisting to an RDBMS solution

While looking at this question: Why all the Active Record hate? I found myself thinking of a general theme that ActiveRecord pattern is good when you have little or no inheritence in your objects, and DataMapper, while more complex, works much better if you do. Given that its never possible to perfectly match objects to relational datab...

IoC, Where do you put the container?

I'm using castle windsor for a pet-project I'm working on. I'm starting to notice that I need to call the IoC container in different places in my code to create new objects. This dependency on the container makes my code harder to maintain. There are two solutions I've used to solve this problem I tried to create abstract factories as ...

Defining objects when using Jaxer

I've been playing with Jaxer and while the concept is very cool I cannot figure out how to define objects that are available on both the client and the server. None of the examples I can find define objects at all. I'd like to be able to define an object and specify which methods will be available on the server, which will be available ...

How much business logic should Value objects contain?

One mentor I respect suggests that a simple bean is a waste of time - that value objects 'MUST' contain some business logic to be useful. Another says such code is difficult to maintain and that all business logic must be externalized. I realize this question is subjective. Asking anyway - want to know answers from more perspectives....

Auto-implemented getters and setters vs. public fields

I see a lot of example code for C# classes that does this: public class Point { public int x { get; set; } public int y { get; set; } } Or, in older code, the same with an explicit private backing value and without the new auto-implemented properties: public class Point { private int _x; private int _y; public in...

What are some good web resources for learning Object-Oriented Programming?

I've started programming more in OO style than ever (Python). Any good web resources I could read? I need help constructing and modelling objects, relations, interfaces etc. . Not only dry theory (I've read that), but something easy to grasp (examples would be nice), do you know any site or a good book? ...

How to use one object's method to update another object's attribute?

I have three (C++) classes: Player, Hand, and Card. Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand. Hand Player::getHand() { return hand; } Hand has a method, addCard(Card c), that adds a card to the hand. I want to do this: player1.getHand().addCard(c); but it ...

Python-passing variable between classes

I'm trying to create a character generation wizard for a game. In one class I calculate the attributes of the character. In a different class, I'm displaying to the user which specialties are available based on the attributes of the character. However, I can't remember how to pass variables between different classes. Here is an example ...

PHP: array_map on object?

I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes. How can I achieve something similar to array_map or array_walk with objects? ...

Considering object encapsulation, should getters return an immutable property?

When a getter returns a property, such as returning a List of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main parent object knowing? For example if a Contact object, has a getDetails getter, which returns a List of ContactDe...

data access object pattern implementation

Hi all, I would like to implement a data access object pattern in C++, but preferably without using multiple inheritance and/or boost (which my client does not like). Do you have any suggestions? ...

Class Naming Conventions / Layout

Does anyone have a good article or good advice for class naming for n-tier web applications? I'm used to the layout that LLBLGen gives when it generates objects based on a database structure, which might generate the following class files for a given "User" table in the database: /EntityClasses/UserEntity.vb /CollectionClasses/UserColl...

Best method for storing this pointer for use in WndProc

I'm interested to know the best / common way of storing a this pointer for use in the WndProc. I know of several approaches, but each as I understand it have their own drawbacks. My questions are: What different ways are there of producing this kind of code: CWindow::WndProc(UINT msg, WPARAM wParam, LPARAM) { this->DoSomething(); } ...

Question about object-orientation

Hi all, I had this questions since the time I learnt about object-oriented programming. Now, I have got a wonderful forum I thought of asking this. Lets say we are implementing an employee management application using EJB. Now, there are 2 ways of doing this. Normally, we create entities (POJOs) which represent an employee. Then we ...

Whats the best book/site/tutorial for learning object oriented php?

Im pretty familiar with procedural side of php, but I would like to learn the OO side of things. Can you guys suggest some (short) reads that would get me on my way? Would prefer online articles, to paper. ...

How to prevent multiple classes for the same business object?

A lot of the time I will have a Business object that has a property for a user index or a set of indexes for some data. When I display this object in a form or some other view I need the users full name or some of the other properties of the data. Usually I create another class myObjectView or something similar. What is the best way to h...

When to use a Class in VBA?

When is it appropriate to use a class in Visual Basic for Applications (VBA)? I'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion? ...

How do you copy a PHP object into a different object type

New class is a subclass of the original object It needs to be php4 compatible ...

Which Design Pattern is best for Iterative development?

Is there such a thing as having the most prefered design pattern for building applications in TDD or the iterative mode? ...