I have an application which supports multiple types and versions of some devices. It can connect to these devices and retrieve various information.
Depending on the type of the device, I have (among other things) a class which can contain various properties. Some properties are common to all devices, some are unique to a particular devi...
I'm building a website, and installed Magento in the /shop/ subdirectory. I'd like to integrate the top categories into the menu of my non-Magento site, so you can navigate directly into the category. For this I need the category names and url's.
Magento's categories are:
Templates
Color
Theme
General
Other products
I first needed...
I thought it was about time to have a look at OO databases and decided to use db4o for my next little project - a small library.
Consider the following objects: Book, Category.
A Book can be in 0-n categories and a Category can be applied to 0-m Books.
My first thought is to have a joining object such as BookCatecory but after a bit o...
I am using classes and static methods to 'scope' functions in a namespace, similar to C#. However, every time I add a new method to a class, at first it is not found. I have to restart the MATLAB environment (2007a) for the new methods to be recognised.
Surely there is an 'update' or 'refresh' type command that I can use so that I do no...
I have been working on keeping things object oriented for my project. Currently, I'm using a .DLL which supplies all of the app's classes to the WinForms project acting as the presentation layer.
My .DLL will, for example, return a SortableBindingList(Of T) to code in a form. The SortableBindingList(Of T) comes from here. Let's assume a...
I am designing a utility to backup applications.
The backup functionality will contain both common tasks to do (common code) and some unique steps. Am I on the right track by using an interface for the unique behaviour and an abstract base class for the common behaviour in common by all the children? Is there any downside to this approa...
I understand that Perl's OO model is rather primitive; it is, in most respects, essentially a namespace hack.
Nevertheless, I wonder if it is possible to create something like an "interface?" My goal is to have a base class from which others are extended whose principal purpose is to make mandatory the implementation of certain method...
So in java, say you have a non-static method 'bar()' in an class 'Foo'.
class Foo
{
private int m_answer;
public Foo()
{
m_answer = -1;
}
public void bar(int newAnswer)
{
m_answer = newAnswer;
}
}
Say then that you call this method like so:
Foo myFoo = new Foo();
myFoo.bar(42);
Now the...
I have a class "Shape" which is a supertype of many other "shapes" in my app.
I have lots of empty methods on the Shape class which are declared as virtual / overridable, so there is not really any default bahaviour. Of course, some sub-shapes implement these methods.
I am really just using it so that I can treat all my shapes as Shape...
var A=function(){
};
$.extend(A.prototype, {
init:function(){
alert('A init');
}
});
var B=function(){
};
$.extend(B.prototype,A.prototype,{
init:function(){
alert('B init');
}
});
var p=new A();
p.init();
var x=new B();
x.init();
is the above the best way to create class and inheritance in jQuery? In B's init how do I invok...
I am using multiple asynchronous air.URLLoader objects, and would like the events fired to be aware of the urlloader's "myId".
The objects i am downloading have ids per se, so i'd like to know in my event listener callback function from which download id the progress/finished/error event came.
code:
# loader
addonLoader = new air.URLLo...
I'm a relative newbie to thinking in OOP terms, and haven't yet found my ‘gut instinct’ as to the right way to do it. As an exercise I'm trying to figure out where you'd create the line between different types of objects, using the drinks on my desk as an example.
Assuming I create an object Drink, that has attributes like volume and te...
Is there a case where you wrote something in such a language (e.g. C#, Java), and missed duck typing? (See this question for arguments against duck typing)
...
Here's the situation: I've got a class that is doing too much. It's mainly for accessing configuration information, but it also has the database connection. It's implemented as a singleton, so this also makes unit testing it difficult as most code is pretty tightly coupled to it. This is even more problematic as it creates an import-...
This question is regarding object oriented design. It may fit into community wiki.
Usually , when one design a set of classes which communicate with each other through interfaces , he ask himself , what Interfaces should I make? How to abstract various sub-components in the system in order to achieve the design goals.
If we put aside p...
I'm building an application and as time goes on, I have more and more objects to initialize at startup. Moveover, some of the newer objects depend on others so I'm getting some kind of spaggetti initialization where objects are created then passed to other constructors. I'm suspecting that I'm getting it wrong.
For example I have a WinF...
I am writing a number of small, simple applications which share a common structure and need to do some of the same things in the same ways (e.g. logging, database connection setup, environment setup) and I'm looking for some advice in structuring the reusable components. The code is written in a strongly and statically typed language (e....
This works:
>> Oblock: [FirstName: ""
[ LastName: ""
[ BirthDate: ""]
== [FirstName: ""
LastName: ""
BirthDate: ""
]
>> Person: Make Object! OBlock
>> Person
>> probe Person
make object! [
FirstName: ""
LastName: ""
BirthDate: ""
]
>> Person/FirstName
== ""
>> Person/FirstName: "John"
== "John"
But this doesn...
Hi All! I ever developed several projects based on python framework Django. And it greatly improved my production. But when the project was released and there are more and more visitors the db becomes the bottleneck of the performance.
I try to address the issue, and find that it's ORM(django) to make it become so slow. Why? Because Dja...
What is the difference between a class with protected constructors and a class marked as MustInherit? (I'm programming in VB.Net but it probably equally applies to c#).
The reason I ask is because I have an abstract class that I want to convert the constructors to shared/static methods. (To add some constraints).
I can't do this becaus...