oop

Why is the clone() method protected in java.lang.Object?

What is the specific reason that clone() is defined as protected in java.lang.Object? ...

Python inheritance and calling parent class constructor (newbie question...)

This is what I'm trying to do in Python: class BaseClass: def __init__(self): print 'The base class constructor ran!' self.__test = 42 class ChildClass(BaseClass): def __init__(self): print 'The child class constructor ran!' BaseClass.__init__(self) def doSomething(self): print 'Test is: ', self.__test test = ChildClass() tes...

PHP Class won't return to a String

Hi, I'm fairly new to PHP so I have a small problem as I'm learning: I built a Class called DataStrip.php <?php final class DataStrip { public function DataStrip() { // constructor } public function stripVars($vars) { return $vars; } } ?> and then I'm trying to pass the public function stripVars a value: <?php inc...

Best Practices/Software for Object-Oriented Analysis

I read this book: Head First Object-Oriented Analysis and Design Now i am looking forward to find a Software that make it easy to collect all my Ideas etc (specific Software for OOA). At the moment i am using my Whiteboard to collect/design Ideas etc. Afterwards i am taking pictures of it and add text to our Wiki/Trac. ...

Does Delphi's static keyword have any point in native-only code?

My understanding is that the static keyword was introduced for compatibility with .NET (along with strict) class TExample class procedure First; class procedure Second; static; The differences between procedures First and Second are :- First can be overridden in a descendant class First passes an implicit self parameter referenc...

What is the difference between package, module and class in object oriented Perl?

What is the difference between package, module and class in object oriented Perl? ...

What are the schools of OOP ?

Are there philosophical differences between Smalltalk OOP and Simula OOP ? This is a question related to Java & C# vs C++ indirectly. As I understand, C++ is based on Simula but Java and C# are more or less from the Smalltalk family. ...

When to use this in javascript OO?

In Javascript OO, when should I use the this keyword? Also, if I want to call a method of a class from another method of the same class, should I use this or just the name of the function? E.g is this correct? function Foo() { this.bar= function() { alert('bar'); } this.baz= function() { this.bar(); //should ...

OO game design question

Hi SO, I am programming a simple game in Java but I am trying to do it 'right' with a nice clean design and no hacks. I have two classes GamePanel that receives clicks and keypresses and Model which contains all the Entities and is responsible for their updates. The Model needs to know where the user's mouse is but I can't decide on...

Which should inherit which?

This is one of the boring academic OOP questions, but it is not a homework. I got the question from a newbie programmer about one of those stupid textbooks examples about OOP. Imagine that you are designing a Square class and a Cube class, which should inherit which? I see a relationship, but what it is, I can not really see! Could yo...

wxPython sizer wxGridSizer's parent class method is strangely inaccessible

Hello, I am having an issue with wxPython toolkit. I am using a wx.GridSizer object to place a grid displaying some status info. I need to update this grid, and so I came up with a few different ways of doing it. The one I prefer is to simply refresh/update the text that needs the updating, so I could try detaching the wxStaticText o...

When should we create a static class?

How can we distinguish to create a class which is static? ...

Business Layer, Data Access Layer. Is there any resource to learn how to make relation between Business layer classes with Data Access layer classes?

Business Layer, Data Access Layer. Is there any resource to learn how to make relation between Business layer classes with Data Access layer classes? ...

OO or procedural

I have an Access db I use for my checkbook (with a good amount of fairly simple VBA behind it) and I'd like to rewrite it as a stand-alone program with a SQL backend. I'm thinking of using either C++, Java, or Python. I had assumed, before I started, that I would write it OO because I thought that I would think "in OO terms" (due to a ...

Can you suggest any extended examples on object-oriented software design?

I am looking for instructional materials on object-oriented software design that are framed as extended examples. In other words, over the course of several lessons or chapters, the author would develop a moderately large piece of software and explain the design approach step by step. Ideally, the material would address not only the desi...

An elegant way to implement shared classes that load heavy resources (in Java)

Hello, I have several classes which work as wrappers over some heavy libs, such as parsers, taggers, and other resources. All these libs have one thing in common: they have a load/init method which takes a serialized model (a large file) as input, and return a class that can be used to do concrete things such as parsing text. To illus...

To split or not to split a class (in Java)

I have a sentence which is analyzed in different phases. First, I get some attributes (say, X, Y, Z): public class AnalyzedSentence { private String X; private String Y; private String Z; public AnalyzedSentence(String sentence) { extractX(); extractY(); extractZ(); } // getters, setters...

On using Enum based Singleton to cache large objects (Java)

Is there any better way to cache up some very large objects, that can only be created once, and therefore need to be cached ? Currently, I have the following: public enum LargeObjectCache { INSTANCE; private Map<String, LargeObject> map = new HashMap<...>(); public LargeObject get(String s) { if (!map.contains...

OO program and SQL database

When programming an OO program using a SQL database back-end, do objects' attributes correspond with the rows in the tables? Or more than that? I don't quite understand how objects' attributes relate to data in tables. Thanks for your help. ...

OO and SQL

In trying to understand the correlation between program objects and data in tables (here:http://stackoverflow.com/questions/1149877/oo-program-and-sql-database), which I still don't really understand, a strong difference of opinion was revealed over whether it's ok to use a SQL db to store data for an OO program. For a new programmer...