oop

NHibernate MVVM Session Best Practice

What is the best place to store the NHibernate session if we only need one? In the main windows view model? In the app? In the DataAccess Class? ...

PHP extend a class method that is called from another class which extends it and calls the method with parent::method

I am trying to extend a class and override one of its methods. lets call that class A. My class, class B, is overiding a protected method. Class C extends class A and Class D extends class C. Inside of Class D, the method I am trying to overwrite is also extended here and that calls parent::mymethodimoverriding. That method does not exis...

Application Design: Single vs. Multiple Hits to the DB

I'm building a service that performs a set of configured activities based on the type of request that it receives. Each activity involves going to the database and retrieving/updating some kind of information. The logic for each activity can be generalized and re-used across different request types. The activities may need to particip...

Why Directly Accesing property is not recommended in OOPs PHP?

If I have a class "person" with a property $name and its getter(get_name()) and setter(set_name()) methods, then after instantiating the objects and setting the property i.e. $paddy = new person(); $paddy->set_name("Padyster Dave"); echo "Paddy's full name: ".$paddy->name; //WHY THIS IS NOT RECOMMENDED... In the above code $paddy->n...

Learning to think in the Object Oriented Way

Hi Everyone.... I am a programmer trying to learn to code in the object oriented paradigm... I mainly work with PHP and i thought of learning the zend framework... So, felt I need to learn to code in OO PHP.... The problem is, having done code using functions for quite a long time, i just can't get my head to think in the OO way.... ...

What are minimum requirement for a novice to learn OOP?

What are minimum requirement for a novice to learn OOP? ...

Is Multiple Inheritance allowed at class level in PHP?

Is Multiple Inheritance allowed at class level in PHP? ...

How to count JavaScript array objects?

When I have a JavaScript array like this: var member = { "mother": { "name" : "Mary", "age" : "48" }, "father": { "name" : "Bill", "age" : "50" }, "brother": { "name" : "Alex", "age" : "28" } } How to count objects in this array?!I mean how to get a counting resul...

Accessing current class through $this-> from a function called statically. [PHP]

This feels a bit messy, but I'd like to be able to call a member function statically, yet have the rest of the class behave normally... Example: <?php class Email { private $username = 'user'; private $password = 'password'; private $from = '[email protected]'; public $to; public function SendMsg($to, $body) ...

What Could be the example scenarios to declare any class or any method as "final"?

What Could be the example scenarios to declare any class or any method as "final"? When do we need to do this? Please give me some example to understand the practical use of "final"... please elaborate your answer.... please guide me as I am a beginner in OOP ...

What is the difference between Multiple Inheritance and Polymorphism?

What is the difference between Multiple Inheritance and Polymorphism? In a Book I red a line saying there is no support for multiple inheritances at class level. This means you can't extend more than one class at a time. Which is contradicting the concept of Polymorphism, described in the same book as polymorphism is the process of...

How to design a class for managing file path ?

Hi All In my app, I generate some xml file for instance : "/xml/product/123.xml" where 123 is the product's id and 123.xml contains informations about this product. I also have "/xml/customer/123.xml" where 123.xml contains informations about the client ... 123 How can I manage these file paths : I create the file path directly in th...

interact with an interface?

from what i've read it seems that one can interact with an interface? eg. lets say that i've got an interface with an empty method "eat()" then 2 subclasses are implementing this interface. can my controller interact with only the interface and use it's eat() method? have a look at the picture in this link strategy ...

PHP OOP: Avoid Singleton/Static Methods in Domain Model Pattern

I understand the importance of Dependency Injection and its role in Unit testing, which is why the following issue is giving me pause: One area where I struggle not to use the Singleton is the Identity Map/Unit of Work pattern (Which keeps tabs on Domain Object state). //Not actual code, but it should demonstrate the point class M...

What does "program to interfaces, not implementations" mean?

One stumbles upon this phrase when reading about design patterns. But I don't understand it, could someone explain this for me? ...

Magic methods + Reflection API = can't investigate class properties. Why?

If I use magic methods. While using reflection API, I can't investigate class properties.. Why is it so? EDIT What is Reflection API? pls do not refer me php.net i didnt understood that.. guide me in your words plsss ...

PHP OOP Design Patterns: Should I Create two seperate classes for registration and form validation?

So here's my problem: I have two types of registration, registration A and registration B, each will have some of the same fields and some different fields. I was going to create abstract class registration and both A and B would have their own classes that extend from registration. My question is, should I create a seperate Validatio...

Could someone critique my PHP register/validation classes?

http://pastie.org/931617 is a link to the source code. If there is a better way to do this, let me know. One thing I'm unsure about, is the way I handle child/parent constructs in the validation classes towards the bottom. Thanks. Ok, I took your advice using an associative array. Now, I just toss the $_POST variable to my construct...

Good programming style when handling multiple objects

I've been programming a software version of a board game. Thus far I have written the classes which will correspond to physical objects on the game board. I'm well into writing the program logic, however I've found that many of the logic classes require access to the same objects. At first I was passing the appropriate objects to method...

Is there a common method for implementing pagination through PHP data objects?

I am going to be implementing a small custom CMS for a website. I was wondering if there are any more popular methods for implementing pagination using OOP. Thanks! ...