oop

Resume abandoned downloads with php ftp?

Is there any way to resume a broken download via an ftp connction established with php? Can php resume a broken download? ...

Creating a public function in object oriented programming (flash)?

I'm new to object oriented programming and flash. As far as I know, global variables and functions are evil things. We have to use objects, right? So far everything is going pretty well, apart from when I want to eg. create a log function which will write a debug message to a textfield object. The problem is that I need to be able to u...

Thinking OO with TDD - Where to start?

I'm trying to improve my TDD/OO skills and each time I try and use TDD to influence design I come up against a wall of where to start. Here is my use case/story: Identify a subset of clients that are due for a review. Start a review for them and send out a couple of letters. Now my muscle memory has already opened up a query windo...

A simple explanation of common design patterns for non-native English speakers

I am often facing design patterns, and I find most articles explaining them a bit hard to understand, especially since I don't speak English fluently. I would very much appreciate if someone could explain simply and in basic English the following design patterns: Builder, Prototype, Bridge, Composite, Decorator, Facade, Flyweight, Proxy ...

Any source of good object-oriented design practises?

Is there any website where people share and discuss good examples of object-oriented design? Ideally such website should be populated with posts of the following structure: Concise description of the problem, including definitions, links, etc. Several attempts of OO design, diagrams, pseudocode listings (voted up/down by users) Comme...

Which design option is better to use in coding a framework?

I'm coding up a framework (in Java, but question is generic) in which I will provide a set of interfaces for clients to implement. The functions in the framework are going to rely on how the implementation classes will be constructued, that is, thay depend on those implementations to provide other instances of interfaces. For example I ...

python classes that refer to each other

I have two classes that refer to each other, but obviously the compiler complains. Is there any way around this? EDIT Actually my code is slightly different than what Hank Gay uses. So python can definitely deal with some kinds of circular references, but it tosses an error in the following situation. Below is what I've got and I ge...

Object Oriented Programming, extending properties

Ok this is not just a PHP question, but I have this problem in PHP so I will post the example in PHP. Example: I have three classes, say, data_abstract, person, and student. Now, I have one array of data related to each of those objects. class person extends data_abstract { protected $data; //name, gender, etc } class student ex...

Books to refer for learning OOP through C++

I am looking for a book which can teach OOP concepts using c++ . Could you guys please suggest me some books. ...

Am I stupid for not using custom packages in Flex 3 (flash)?

When I create a new class file in Flex 3 it warns me that I should not use the default package. I personally never used packages before, but think that packages won't make things any more easier since I just want to be able to use all my classes everywhere without importing all kinds of packages which I would have to remember the names ...

When to call base.method() and what code should go in a base.method()?

In the following sample, the writer of the derived class will be expected to call base.Add(). If it happens 1st, the base can do one sort of code. If it happens last, the base can do another kind of logic (see sample). I doesn't seem possible to have it both ways. And easy fix would be do stop calling the base method at all because the...

Correct Structure to check for Errors using NSError

I'm coding up various routines and I'm trying my best to keep it neat and refactored. Methods I'm creating are starting to look similar to this code: -(IBAction)buttonPress:(id)sender { // Create Document Shopping List with this document [self doSomething:&error]; if(error) { [NSApp presentError:&error]; re...

Why does PHP require an explicit reference to "$this" to call member functions?

That's pretty much it. Scoping in most OO programming languages resolves symbols fine without an explicit reference to the current instance (i.e. '$this' in PHP). Why does PHP require me to precede every call to a member function in the same class with $this? ...

Singleton with Arguments in Java

I was reading the Singleton article on Wikipedia and I came across this example: public class Singleton { // Private constructor prevents instantiation from other classes private Singleton() {} /** * SingletonHolder is loaded on the first execution of Singleton.getInstance() * or the first access to SingletonHold...

In terms of OO design, can two-d and the three-d point classes be derived from single base class?

I`m currently working out the design for simple graphic editor, who support trivial operations for two-dimensional and three-d shapes. The point is, I want to render prototype of these shapes, as MsPaint does. And at the moment it is rendering I need to store somewhere pixels from the canvas which get covered by prototype, just in case w...

Is the function of interfaces primarily for using functions without knowing how a class is built?

As I understand interfaces they are contracts, I interpret it as the contract word, ie must have what is specified in the interface (ex open, close, read, write for an interface handling files). But what im having a hard time grasping is why you would need to have an interface that tells you what the class must be able to do at all, wou...

difference in C# and PHP OOP

Hello All, I have a general OOP question. If I have the following classes in C# class Parent { public string val = "Parent"; public void getValue() { Console.WriteLine(this.val); } } class Child:Parent { public string val = "Child"; } Child child = new Child(); child.getValue(); The code outputs 'Pare...

PHP Array of Objects Internal Navigation Pattern

I have an array of objects, and want the objects to be able to reference their 'neighbors' (the next and previous objects in the array). Is there an existing pattern to do that? Perhaps the array should be wrapped in an object (since the object can be iterated just as well as the array). That's fine too, I'm just looking for an existing...

PHP Object Extension Question

So I have an item class as follows: class Item { private $db; private $data = array( 'AltItem1' => null, 'AltItem2' => null, 'BaseUOM' => null, 'Category1' => null, 'Category2' => null, 'Category3' => null, 'Category4' => null, 'Iden' => null, 'IsHCS' => null, 'ItemDesc' => nul...

friendly code to transition from page controller to front controller

I am in the early stages of creating a small-medium sized web application by myself. I read "PHP Objects, Patterns, and Practice," and I decided to use page controllers because quick production is a high priority. Page controllers were also appealing because I am unfamiliar with PHP frameworks and creating an elaborate front controller ...