oop

How to apply multiple events to the same function

I'm not the best at this jquery stuff. But I'm trying to seperate the action from the function so I can apply multiple events that cause the same function. Unfortunately this isn't working. Anyone know why? Updated Function, but still errors $(document).ready(function() { var $info_items = jQuery('.checkbox.has_info, .has_info'); $in...

Interfaces and abstract classes in object oriented programming

Possible Duplicate: Interface vs Abstract Class (general OO) Hi guys, I decided to dig deep into OOP and have been taking on Design patterns practicing with PHP. I just had a question I would like views on. Interfaces and Abstract classes, which has more advantages? It might be vague but any light shed would be helpful. I can...

is it possible to define a interface Singleton in PHP?

I want to define a Singleton base type from which the user will derive his classes, so this is what I thought: interface SingletonInterface { public static function getInstance(); } abstract class SingletonAbstract implements SingletonInterface { abstract protected function __construct(); final private function __clone() {...

object definition in oops

how will you define an object? ...

Add a project to a site step-by-step

I have web-site and I need to create that step-by-step adds: Selecting Country, city, etc more information about project Photos Message/etc How is correct to do these steps? Get paraemtrs like step/1/ and get info from DB on every step, use $_SESSION(Save step num, info from prev.) or.. ? in each step i need to get information from p...

PHP/JS Form Class - Array vs OO

I have recently begun working on a PHP/JS Form Class that will also include a SQL Form builder (eg. building simple forms from sql and auto inserts/updates). I have tried several classes (zend_form, clonefish, PHP Form Builder Class, phorms etc) but as yet haven't come across a complete solution that is simple, customizable and complet...

Does Python support something like literal objects?

In Scala I could define an abstract class and implement it with an object: abstrac class Base { def doSomething(x: Int): Int } object MySingletonAndLiteralObject extends Base { override def doSomething(x: Int) = x*x } My concrete example in Python: class Book(Resource): path = "/book/{id}" def get(request): ...

Object-Oriented Callbacks for C++?

Hi! Is there some library that allows me to easily and conveniently create Object-Oriented callbacks in c++? the language Eiffel for example has the concept of "agents" which more or less work like this: class Foo{ public: Bar* bar; Foo(){ bar = new Bar(); bar->publisher.extend(agent say(?,"Hi from Foo!", ?));...

What is stack based class?

Possible Duplicate: How to prevent an object being created on the heap? Hi, I heard a concept called as stack based class. I.e. we can’t create instance of the class using new. I am hearing this for the first time. One way to implement this by private overloading of ‘new ’ operator. If anybody know details about the stack...

How to create an instance of a class in another class

I might be missing something here, I'm not sure. A Google search didn't really help either. What I'm wanting to do is call the databaseServer class and use its methods within my userControl class. Here is my lib_class.php file: <?php include('definitions.php'); class databaseServer { var $con; var $db; var $close; va...

Working with class attributes directly

I heard it is not really good idea to work with class attributes directly, instead using setters and getters. Can somebody tell me why? ...

How to deal with cross-cutting concerns in a OO Application? Use Singleton? Dependency Injection? What?

Let's say that I'm currently designing an application where I will need to use a global timing system (it's a cross-cutting concern). I'll need to access data from that global timing system from basically anywhere in my app and it's not like I can see that "this part of the application will need it while the other won't". My question i...

Object Oriented Programming beyond just methods?

I have a very limited understanding of OOP. I've been programming in .Net for a year or so, but I'm completely self taught so some of the uses of the finer points of OOP are lost on me. Encapsulation, inheritance, abstraction, etc. I know what they mean (superficially), but what are their uses? I've only ever used OOP for putting reus...

Is every method returning `this` a monad?

Is every method on a class which returs this a monad? ...

Sometimes I don't get why we go so far as to make every single field as private and then create protected or publich getters for them.

I don't think I am a total noob in OOP, but do you sometimes feel we go a little too far in privatizing the fields? Do you have a good rule of thumb as to when a field absolutely must be private, and when is it (maybe) okay to mark it protected, or public? Sometimes it's the obvious thing that gets me. Discuss ...

Help me name my class

Okay, first, here's my rather poor diagram... It's worth noting the "Name Me" class may be listening to more than one RequestNotifier It's safe to assume all Work Items that are put on the Work Queue are taken off the work queue by something else not shown and are processed exactly the same. The only difference between the work items...

A Better C# Poker Framework Design?

I'm writing a poker framework in C# and I don't like the design I currently have. My goal is to have a game engine that can play a multiple AI against each other in batch mode very quickly, play multiple AI vs. multiple humans (probably via a Silverlight client). I'd like to keep efficiency high but maintain game support flexibility-- e....

Is there a difference in use or not the "this" keyword to reference a method inside the same class?

Possible Duplicate: When do you use the this keyword? If I have the following example: public class MyClass { private void MyMethod1() { ... } private void MyMethod2() { this.MyMethod1(); ... } } In the "MyMethod2" is there a difference in use "this.MyMethod1()" or just "MyMethod1()"? Performance, security, g...

PHP, Actionscript Object Oriented Programming Design Pattern....

Hi guys... I was wondering how to do the PHP OOP design pattern for real life application. I wish someone can share their learning experience with me. I am particular interested in PHP and actionscript. Most of the books I could find in the book store are only basic PHP (or AS3) programming. I appreciate any help. Thanks! Please do no...

Why is smalltalk not a functional programming language?

With the renewed interest in functional programming languages, I've seen some similitudes between Smalltalk and FPL, namely closures ( BlockClosures in Smalltalk ) Yet, Smalltalk is not a FPL? What would be needed to consider it as such? ...