oop

What are some techniques for understanding object interaction

When starting a new application what are some ways to decide what objects you will need, what they should do, and how they should interact with each other? Is this a job for a white board, or is it easier to just start coding and move stuff around as needed? ...

Is a general class necessary for a site PHP site?

I have a CORE class that pertains only to my specific site, ie, it performs site specific functions. I have a database class (for mysql), and other classes like access, validator, upload, template etc etc... I know that php classes can only extend one class each, so almost all of my classes extend the database class. I was looking over ...

Help in designing a tree structure - Tension between functional and OOP

Hi, I've been learning f# in the previous days, writing a small project which, at last, works (with the help of SO, of course). I'm trying to learn to be as idiomatic as possible, which basically means that I try to not mutate my data structures. This is costing me a lot of effort :-) In my search for idiomatic functional programming,...

When to use static modifier in PHP

Doing some code reviews lately I came across a number of classes that have significant number of static methods in them... and I can't seem to grasp why? Hence my question: What are the best practices regarding using static methods in PHP? When would one want to use them and when would one shouldn't use them? What are specific differe...

Object-oriented HTML without server side code. Possible?

Is it possible to reuse HTML tags across multiple files, headers and footers for example? Placing them in separate files adds an extra HTTP request, that I'd like to avoid. I don't want to replicate minor changes in headers and footers across every html file every time a change request comes along. ...

What tool can I use to generate a PHP class usage report for my application?

I have a fairly large object-oriented php 5 project, and as part of a change impact analysis, I'd like to compile a report on the usage of each existing class throughout the project. It would help me immensely if I could find an existing tool that will analyze all the files in my project and generate some sort of report that lists, for...

Which namespace does a factory class belong?

I have a factory class, DocumentLoaderFactory, which simply returns an instance that implements an interface, IDocumentLoader. All implementation resides under the following namespace Skim.Ssms.AddIn.ActiveFileExplorer.Loader But what I am wondering is, which namespace does DocumentLoaderFactory belong? I have placed the factory c...

Design: Accessing child collections whilst avoiding the parents!

Note: WinForms C# Early Learning Level! I would like some assistance with the best way to implement a situation in a C# object environment. I cannot post code because it doesn't exist yet, however I can give you an alternative real-life comparison. In simple terms (because thats how I work) I have a Book class. I have a collection (<L...

Abstract class in Java

What is an "abstract class" in Java? ...

What is an interface in Java?

Just as a counterpoint to this question: what is an interface in Java? ...

Is there any constraint to specify the access specifier of members of a class when we have specified access specifier of the class?

Hi Suppose that we have a class named class1. The class1 has several properties and methods and we have decided to specify the access specifier of class1 as internal. Now, can we set the access specifier of class1 methods as public? ...

What is the exact need of virtual function is C#?

I understand that it provides a default implementation that the derived classes can override. But is that the exact purpose? ...

Object Oriented Javascript - How To Define A Class Within A Class? from a C# example

Hi there, I know there are a lot of OO javascript questions on SO and I a have been reading a lot of resources.... BUT it is still far my most long winded learning curve so far! I am not classically trained sorry, hence I will have to just show you guys in c# an example of what I want to acheive. I hope you can help! public class Eng...

AOP... Should I unlearn OOP ?

I have skimmed the online documentation, read the wiki entry, the posts and the blogs, but I'm still puzzled. What is, in a nutshell, Aspect Oriented Programming ? Is it simply better then Object Oriented Programming ? Should I unlearn OOP ? If not, how do I know when to use one or the other ? What are the main differences between the ...

Synchronize Data in Oracle with PHP

Hi Folks, the following "problem" : 2 Oracle Databases , Servers identified by their Names. If one attribute of the Server from Table X is different to Server in Table Y -> Update Table X. What is the best solution ? Fetch all Servers from both Databases and compare change them in an array ? Get first Server from Table X , get Serve...

What pattern(s) am I supposed to use for this situation?

For several applications I made for my current client I have shared user accounts. This means that each account in one application should exist in the other applications. Each application has it's own set of settings. The number of applications and the settings themselves will be the parts that really change over time so I want to separa...

Internal C# "database" for keeping track of data

I'm working on a C# project that requires me to keep track of various class objects that I have defined...for instance, class1, class2, etc. Each of these classes has an id that is defined as a Guid. My current method for tracking all of these objects that I create is to store them into a Hashtable. Below is a sample of what I'm doing...

JavaScript OOP call function from other function

function MyClass(projectName) { this.projectName = projectName; } MyClass.prototype.createHttpRequestObject = function() { /* do something */ } MyClass.prototype.submit = function(message, script, line) { httpRequest = this.createHttpRequestObject(); } The error 'this.createHttpRequestObject is not a function' goes from line '...

How to return a copy of an object instead of a reference in actionscript 3?

Imagine I have an object called "image", now I want to create multiply copies of this image to display it multiple times and with different properties. When I do image2 = image;, only the reference is copied and I thus still change the properties of the first object. So, how to return a copy of an object instead of a reference in action...

Newbie php class inheritance question

I had a problem recently with a php project that I finally realised was down to the way I had structured my classes. If I tried to include more than one class in a page and both classes shared the same parent class, the script failed. I've now resolved the issue but was wondering if someone could explain to me exactly why what I was doin...