oop

What OOP pattern to use when only adding new methods, not data?

Hello eveyone... In my app, I have deal with several different "parameters", which derive from IParameter interface, and also ParamBase abstract base class. I currently have two different parameter types, call them FooParameter and BarParameter, which both derive from ParamBase. Obviously, I can treat them both as IParameters when I ne...

basic JSON pulling data help..

New to json data and struggling i guess the answer is real easy but been bugging me for the last hour.. Sample data { "data": { "userid": "17", "dates": { "timestame": "1275528578", }, "username": "harino54", } } Ok I can pull userid or username easy enoug...

Is there any disadvantage of writing a long constructor?

Does it affect the time in loading the application? or any other issues in doing so? ...

Python - Converting CSV to Objects - Code Design

Hi, I have a small script we're using to read in a CSV file containing employees, and perform some basic manipulations on that data. We read in the data (import_gd_dump), and create an Employees object, containing a list of Employee objects (maybe I should think of a better naming convention...lol). We then call clean_all_phone_numbers...

What will be the OOP approach? (or YOUR approach?)

I'm having difficulties with some general OOP & Java approach. There are various ways to let classes/objects communicate with each other. To give a simple example: I need object A to perform action X. Object A needs P, Q and R to perform this action X. Will then Object A retrieve P, Q and R by itself (within action X), or must these ...

Difference between abstract class and interface

Possible Duplicate: Interface vs Base class A class implementing an interface has to implement all the methods of the interface, but if that class is implementing an abstract class is it necessary to implement all abstract methods? If not, can we create the object of that class which is implementing the Abstract class??? ...

Fatal error: Function name must be a string in.. PHP error

Hi I have a class called User and a method called insertUser(). function insertUser($first_name, $last_name, $user_name, $password, $email_address, $group_house_id) { $first_name = mysql_real_escape_string($first_name); $last_name = mysql_real_escape_string($last_name); $user_name = mysql_real_escape_string($user_name); ...

How do you keep yourself and your co-workers from creating huge classes

Stackoverflow users, How do you keep yourself from creating large classes with large bodied methods. When deadlines are tight, you end up trying to hack things together and it ends up being a mess which would need to be refactored. For me, the one way was to start with test driven development and that lends itself to good class design a...

What are the most practical Object-oriented software modeling methods in real world projects?

I want to develope and big project but I really don't know what is the best way to model my project. do I even need to model my project? What are the most practical OOP software modeling methods in real world projects? what are the bests one and most useful ones? please guide on this. ...

PHP5: restrict access to function to certain classes

Is there a way in PHP5 to only allow a certain class or set of classes to call a particular function? For example, let's say I have three classes ("Foo", "Bar", and "Baz"), all with similarly-named methods, and I want Bar to be able to call Foo::foo() but deny Baz the ability to make that call: class Foo { static function foo() { pr...

Any way to _not_ call superclass constructor in Java?

If I have a class: class A { public A() { } } and another class B extends A { public B() { } } is there any way to get B.B() not to call A.A()? ...

Generating objects for a grid of nodes in Obj-C

Hi there, For a program I am developing I have to create a grid of nodes. For instance a grid of 10x10 = 100 nodes. A node can contain several variables. I am having problems visualizing this in a Object Oriented way. My idea is that I let the program automatically create an object for every node, as I have made a class "Node". My quest...

Passing object element to class not as a string (like constant) in php ?

How can I dynamically pass "items" to class function? For example here it is a piece of some class and its function where I declare an element of object (items) as $b: //.......... public function __add2SomeObj($b) { $namespc = $this -> __someObj(); // __someObj() returns object $namespc -> cats = $b; ...

jquery event function call with oop?

var objs = new Array(); function Foo(a) { this.a = a $("#test").append($("<button></button>").html("click").click(this.bar)); } Foo.prototype.bar = function () { alert(this.a); } $(document).ready(function () { for (var i = 0; i < 5; i++) { objs.push(new Foo(i)); } }); is it possible to make it so that ...

situation where interface is better than abstract class

Please tell me situation where interface is better than abstract class in Java ...

String, StringBuffer, and StringBuilder

Please tell me a real time situation to compare String, StringBuffer, and StringBuilder? ...

Dynamic Binding in Java

Hello Everyone, I am used to doing dynamic Binding in PHP this way function ($className) { $obj = new $className(); . . . } here $className is a String parameter and based on name of the class an object of that class is created. So when I need to add more functionality I just add another class and everything get sorted out automa...

Design Patterns and Prinicples

I have recently experienced and understood the importance of "Design Patterns and Principles" implemented in our project. I was just wondering if you all would share the importance of Design patterns and principles, of how using them in your source code the project was enhanced, so that we can learn out of your vast programming experienc...

final interface in java?

Can an interface be declared as final in Java? ...

OOP PHP and MySQL

Hi I'm new to OOP with PHP. I'm wondering how OO comes into play when selecting data from a table. i.e. i have a users table and a user profile page. So I have a User class. Do I select the user data from the table then create a new object of class User and define the properties? Thanks for anyone that can clear this up for me! Regards...