oop

How large should be Data Transfer Objects?

As I understand, Data Transfer Objects are used for different purposes, so let's bound the scope with the view layer in Java (JSF) -based web-applications (i.e. there are usually some entity-objects mapped on a DB, which can be also used in a Business-Logic layer, and some transfer objects used in a presentation layer). So, I have some...

why wasn't the idea of nested functions, implemented in older c++ standard?

was the idea of nested functions considered to be useless during the time of developing older c++ standard, because its usage is basically covered by another concept like object-oriented programming; or it wasn't implemented just as a matter of simplification? ...

Global Static Class with Objects

Ok, so I know you can't have objects in a static class but i need a class that i can hold objects that are accessible from different classes. I am making a dll that will provide extended functionality to another program so i can't just inherit or pass classes around either. if need be i can just maybe make the properties of each object i...

Object Oriented databases

Hello, This is the first time i am working with the object oriented databases.I was associated with the RDBMS for past few years. But now.. coming to this world of object oriented databaseS, I am kind of concerned about the aftermaths of the creation or design of the db. My concern is the population or Migration of this object oriente...

OO PHP Class method renamed to variables?

Hello fellow PHP geeks, I'm sort of in a weird situation... One of which I've never come into before (It's maybe due to my break from PHP to .Net). Using the framework CodeIgniter. Well here's the situation... I've got a User class which acts as the user object containing username/password/email etc... (shown below): <?php if ( ! def...

Fun with sessions

I've a problem that annoy me very much. It's because I'm trying to make a PHP login script. But when I log in correctly, it'll not let me in. If I comment out some lines (I'll mark them), the script works, but that's the code I was planning to use to check in on every page, so people don't can come in if they don't should have access. ...

Methods With Same Name as Constructor - Why?

Why is the following allowed: public class Foo { public Foo() { ... } public void Foo() { ... } } Is there ever a valid reason for naming a method the same as the class? ...

What's wrong with overridable method calls in constructors?

I have a Wicket page class that sets the page title depending on the result of an abstract method. public abstract class BasicPage extends WebPage { public BasicPage() { this.previousPage = previousPage; add(new Label("title", getTitle())); } protected abstract String getTitle();...

Modeling question about categorization. To subtype or not to?

I need some advice on how to model this simple categorization (?) example: I have a product. A product can be of different types, such as ProductType 1, ProductType 2, and ProductType 3. All products have a part number and a name. Where they differ, is the way their prices are calculated. Products in type 1's price are dependent on how...

javascript inheritance - from abstract idea to actual code

Hi, i know how to inherit in c++, vb(6-shame on me), and php I saw many examples and tutorials about it regarding javascript. but no simple explanation about it. What i need is an starting point that will leave me with the need to learn "just" the syntax and usage. hope i am clear enough. thanks ...

What are some quick patterns for good architecture in WPF?

I was once saved considerable pain by being advised to use DTO's in WinForms by a fellow stackoverflow member. Currently I'm on a WPF project where I would like to make at least most of the best choices, be they standard object-oriented principles or WPF-specific. We already use MVVM. What are the obvious, and maybe not so obvious, thing...

MVC/HMVC and Object Oriented programming

I've been reading and learning about Object-Oriented programming (Head First Object-Oriented Analysis and Design and Code Complete: A Practical Handbook of Software Construction – thanks to suggestions found on StackOverflow). I've also been learning how to use a couple PHP MVC frameworks (specifically Codeigniter and Kohana). Some of ...

PHP subclass can't access public variable set by parent

Hello, I'm very new to PHP and OOP in general. I'm using codeigniter for a framework, and am currently attempting to build a class 'BuildLinks' that will redirect the user to the correct link based on what URL they landed on. The controller passes the right variables to the class, while the function build_afflink() selects what class ...

OOP: when should i create a base class and when should i not?

I have a large class with lots of methods (25, interrelated of course). I'm not sure I should split it up and create a derivative and base class instead. I don't see any opportunity coming in the future for another class inheriting from the base. So what are the driving factors for breaking a large class down into smaller parts? ...

In R, how can one make a method of an S4 object that directly adjusts the values inside the slots of that object?

Is there a way to allow a method of an S4 object to directly adjust the values inside the slots of that object without copying the entire object into memory and having to re-write it to the parent environment at the end of the method? Right now I have an object that has slots where it keeps track of its own state. I call a method that ...

Designing SQL database to represent OO class hierarchy

I'm in the process of converting a class hierarchy to be stored in an SQL database. Original pseudo code: abstract class Note { int id; string message; }; class TimeNote : public Note { time_t time; }; class TimeRangeNote : public Note { time_t begin; time_t end; }; class EventNote : public Note { int event_id; }; ...

Php inheritance superclass variables

Hi! I try to load an entity with some details and there is a resellerId in the entity. Now I inherit a subclass from it, and try to access the resellerId but it's not there. How to pass the attributes to the subclasses? I really need it loaded. Thanks! edit: class Crm_Entity extends Crm_Abstract { protected $_mapper = 'Crm_Mapp...

Shall I specify setter or not?

Here is an initial specification for a simple Address class. This is a simplification as it ignores complications such as apartments in the same building potentially having the same ‘number’, e.g. 29a, 29b. class Address { private: int number; string name; string postcode; public: //getters implemented ...

How to convert this code so it now uses the Dependency Injection pattern?

Ok, So I have the following situation. I originally had some code like this: public class MainBoard { private BoardType1 bt1; private BoardType2 bt2; private BoardType3 bt3; ... private readonly Size boardSize; public MainBoard(Size boardSize) { this.boardSize = boardSize; bt1 = new BoardType1(b...

Is there some literature on this type of programming?

In college I took on a class on modern physics, in which we learned about special relativity. I was completely blown away by how different frames of reference could actually observe physical properties of an object to be different and neither be incorrect. Over time, this concept has slowly been changing the way I program, to the point...