oop

what is the difference between loose coupling and tight coupling in obect oriented paradigm?

Hi, can any one describe the exact difference between loose coupling and tight coupling in Object oriented paradigm?? I am too much confused on this. Thanks, Jim. ...

Class inheriting from several Interfaces having same method signature

Say, I have three interfaces: public interface I1 { void XYZ(); } public interface I2 { void XYZ(); } public interface I3 { void XYZ(); } A class inheriting from these three interfaces: class ABC: I1,I2, I3 { // method definitions } Questions: If I implement like this: class ABC: I1,I2, I3 { public voi...

Is there a way define a global variable which is accesible from a class method?

Here is the situation I create a instance of a class $newobj = new classname1; Then I have another class writtern below and I want to this class to access the object above class newclass { public function test() { echo $newobj->display(); } } It is not allowed, is there a way define a variable globally through a clas...

package private static member class vs. package private class

I was writing two implementations of a Linked List for an assignment, a Doubly Linked List and a Circular Doubly Linked List. Now as the class representing a Link within the Linked List is the same in both implementations, I want to use it in both. Now I wonder which approach would be better: Implement the Link class as a package-priva...

What are the tiers of N-tier structure and their functions for WEB Development in PHP?

Can anyone can tell me the N-tier Structure and their tiers used in Web Programming? Primarily, in 3 tier structure one is presentation layer, another is business logic layer and last is database access layer. But for N-tier or 4 tier structure what are the layers and what sort of functions do they hold on them? Please explain me with...

Possible to add an EventListener to a function for Actionscript 3?

I'm trying to setup something like Aspect Oriented Programming in Actionscript 3, basically the only thing I need to be able to do is something like this: SomeClass.getMethod("methodName").addEventListener(afterMethodExecuted, function() { //run code }); This way I can run code after (or before) any method in any class has run, al...

Improve this generic abstract class

I have the following abstract class design, I was wondering if anyone can suggest any improvements in terms of stronger enforcement of our requirements or simplifying implementing of the ControllerBase. //Dependency Provider base public abstract class ControllerBase<TContract, TType> where TType : TContract, class { public static TC...

PHP: Using a method as a callback

I was trying to use array_walk_recursive for something, and wanted to use one of the class' methods as the call back, so trying: array_walk_recursive($TAINTED, "$this->encode()"); and variations thereof all failed. I eventually settled for: array_walk_recursive($TAINTED, 'className::encode'); which works, but I've read on here th...

what is the difference between Data Abstraction Layer & Data Acess Layer?

I am actually stuck in 3-tier structure? I surfed the internet and found two terminology "Data Abstraction Layer" & "Data Access Layer". What are the differences among them? ...

beginning oop php question: do constructors take the place of getter?

I'm working through this tutorial: http://www.killerphp.com/tutorials/object-oriented-php/php-objects-page-3.php At first he has you create a setter and getter method in the class: <?php class person{ var $name; function set_name($new_name){ $this->name=$new_name; } function get_name(){ return $...

ideas for simple objects for day to day web-dev use?

Dang-I know this is a subjective question so will probably get booted off/locked, but I'll try anyway, because I don't know where else to ask (feel free to point me to a better place to ask this!) I'm just wrapping my head around oop with PHP, but I'm still not using frameworks or anything. I'd like to create several small simple objec...

filter by value in object of array

hi i want to know how to filter the value in object of array... i just display the below is one data of my object array Object ( [_fields:private] => Array ( [a] => c7b920f57e553df2bb68272f61570210 [index_date] => 2010/05/11 12:00:58 [b] => i am zahir [c] => google.com [d] => 23c4a1f90fb577a006bdef4c718f5cc2 ) ) Object ( [_fiel...

How do I create efficient instance variable mutators in Matlab?

Previously, I implemented mutators as follows, however it ran spectacularly slowly on a recursive OO algorithm I'm working on, and I suspected it may have been because I was duplicating objects on every function call... is this correct? %% Example Only obj2 = tripleAllPoints(obj1) obj.pts = obj.pts * 3; obj2 = obj1 end I then ...

Using $this when not in object context

I'm creating a function to show blog's. So I made a show blog function but it keeps giving "Using $this when not in object context" error Class Blog{ public function getLatestBlogsBig($cat = null){ $sqlString = "SELECT blog_id FROM jab_blog"; if($cat != null) $sqlString .= " WHERE blog_cat = " . $cat; ...

actionscript-3: refactor interface inheritance to get rid of ambiguous reference error

hi! imagine there are two interfaces arranged via composite pattern, one of them has a dispose method among other methods: interface IComponent extends ILeaf { ... function dispose() : void; } interface ILeaf { ... } some implementations have some more things in common (say an id) so there are two more interfaces: inter...

C++ (g++) Compile Error, Expected "="/etc. Before 'MyWindow" (my class name)

Hi all, I have a very strange problem and the following code wont compile: #ifndef MYWINDOW_HPP_INCLUDED #define MYWINDOW_HPP_INCLUDED class MyWindow{ private: WNDCLASSEX window_class; HWND window_handle; HDC device_context_handle; HGLRC open_gl_render_context; MSG message; BOOL quit...

How to know when it is time to use a Framework to develop a Website?

I have been developing websites in n-tier structure and so far my requirements are fulfilled. But as powerful frameworks like Zend Framework, symphony are getting popular, I wonder how to know if it is time to shift to a framework? I am in a kind of dilemma? Can anyone suggest me the right option ! ...

What is the business case for a dependency injection (DI) framework?

At my company we want to start using a dependency injection (DI) framework for managing our dependencies. I have some difficulty with explaining the business value of such a framework. Currently I have come up with these reasons. Less source code, delete all the builder patterns in the code. Increase in flexibility. Easier to switch de...

Why is multiple inheritance not supported in most of programming language?

Why is multiple inheritance not supported in most of programming language? I could really use this feature to develop different layout of application? ...

Using PHP interfaces in Codeigniter

I am trying to find out how can I used PHP interfaces in my MVC design. I want to make sure that the design enforces an interface so that any new module would follow that. For example: <?php interface BaseAPI { public function postMessage($msg); } class ServiceAPI implements BaseAPI { public function postMessage($msg) { ret...