oop

Separating jquery and creating classes / namespaces? (OOP)

Hi, I recently came across DUI (diggs user interface) which implements jquery and gives you the ability to create classes, with jquery etc. I can't seem to find any reviews.. i saw one comment to say it wasn't up to much. I was wondering what everyone else is using with regards to separation of concerns with jquery Do you use some ki...

How do you manage database connections and transactions across inserts in an Object Oriented way, using VB.net or C#?

I'm to the point now in my programming development that I'm trying to take advantage of Object Oriented Design instead of the basic behind the button procedural stuff I have been doing. In a current project I'm taking repeated, copy and paste sql server insert code and migrating it to classes with properties, methods, etc... One is...

Static method hides instance method ! Anybody, please throw light!

Edit: I have asked question to understand why C# designers chose it to behave in particular fashion? Similar question has been asked, but this is little different. Should following code give warning? class Foo { public void Do() { /*...*/ } /*...*/ } class Bar : Foo { public static void Do() { /*...*/ } /*...*/ } It gives: "warning...

"public static" or "static public"?

A minor point about function declaration keywords in PHP: If you've got a class method that's static, should the static keyword come before or after the visibility keyword (public, protected, private)? Assuming all your methods, static or otherwise, have a visibility keyword, then you'd want the visibility keyword to remain in the same ...

How do I design a sub class with features not available in the base class?

For example suppose I have a class Vehicle and I wish for a subclass ConvertibleVehicle which has extra methods such as foldRoof(), turboMode(), foldFrontSeats() etc. I wish to instantiate as follows Vehicle convertible = new ConvertibleVehicle() so I still have access to common method such as openDoor(), startEngine() etc. How do ...

[PHP OOP] Review some code?

Hi Guys, Had a bit of spare time to learn some OOP in PHP this evening and hit a brick wall. I am creating a little book library app to keep track of my book collection and thought I would use OOP for practice. I have a main php file called library.php that contains 2 main classes so far. class database (connects to mysql, database ...

implementation of composition and aggregation in C#?

Hi, How do I/(what is the best way to) implement composition and aggregation in C#? Thanks 123Developer ...

Make "private" members behave like "strict private"

What about a feature in an upcoming Delphi version enabling that? Maybe it could be a compiler switch promoting all privates to strict privates. ... or it could be a feature of the new non-legacy compiler font-end Nick Hodges was talking about. => private does always behave like strict private. EDIT: The reason why I want this is bec...

Looking for example program written in different languages

As a way to understand the differences between OOP and Procedural languages I was looking for a sample program written in C and C++ or C# or Java. I just want to see the different approaches to the same problem to help me get a sense of the real differences. Does anyone know where I can find a tutorial like this? ...

Interface vs Abstract Class (general OO)

Hi, I have had recently two telephone interviews where I've been asked about the differences between an Interface and an Abstract class. I have explained every aspect of them I could think of, but it seems they are waiting for me to mention something specific, and I dont know what it is. From my experience I think the following is tru...

OO: Why should constructors on abstract classes be protected, not public?

C# code: Resharper suggests changing the accessibility of a public constructor in an abstract class to protected, but it does not state the rationale behind this. Can you shed some light? ...

Act on base or subclass without RTTI or base class modification.

I asked a similar question yesterday that was specific to a technology, but now I find myself wondering about the topic in the broad sense. For simplicity's sake, we have two classes, A and B, where B is derived from A. B truly "is a" A, and all of the routines defined in A have the same meaning in B. Let's say we want to display a ...

Matlab subclassing question

Question about subclassing in matlab, under the new class system. I've got class A with some protected properties: classdef Table < Base properties (SetAccess = protected, GetAccess = public) PropA = []; end %properties I'd like to make a subclass with some specialized features, and further restrict access to PropA. (i.e. make g...

What reasons would there be for nesting classes

I have been googling around looking for a advantages that one might gain in nesting classes. There are plenty of examples as to how to do this but none that I can find as to the reasons for declaring a class within another. I even consulted my newly arrived “Code Complete” but there was no mention there either. I can see the disadvantag...

Assigning new object values from another object

I have an ObjectA whose property values will always be assigned to another object's (ObjectB) properites. What I have been doing is to have a service class instantiate the receiveing ObjectB and then assign the values to the new object from ObjectA. Should I instead be sending the entire objectA directly to Object B in a setter parameter...

Amazon Interview Question: Design an OO parking lot

Design an OO parking lot. What classes and functions will it have. It should say, full, empty and also be able to find spot for Valet parking. The lot has 3 different types of parking: regular, handicapped and compact. Thanks! ...

Representing the board in a boardgame

I'm trying to write a nice representation of a boardgame's board and the movement of players around it. The board is a grid of tiles, players can move up, down, left or right. Several sets of contiguous tiles are grouped together into named regions. There are walls which block movement between some tiles. That's basically it. I thin...

What is a driver class? (Java)

Hi, I was reading through a Java textbook, and it mentions something called a "driver class". What is it, and how is it different from a normal class? ...

Dynamic binding implementations in OO languages

What are the two ways that are used to implement dynamic binding in OO languages. Like how is dynamic binding implemented for a pure OOL like Smalltalk versus mixed OOL such as C++? ...

In SimpleXML, how can I add an existing SimpleXMLElement as a child element?

I have a SimpleXMLElement object $child, and a SimpleXMLElement object $parent. How can I add $child as a child of $parent? Is there any way of doing this without converting to DOM and back? The addChild() method only seems to allow me to create a new, empty element, but that doesn't help when the element I want to add $child also has...