class-design

Design pattern for class interaction

I'm having some trouble deciding how two classes should interact and the problem I'm having seems like it would come up a lot so I was wondering if anyone knows of a design pattern (or any kind of solution) that addresses my issue. Basically I have two classes. Class A deals with displaying information to the user and Class B deals with...

creating an object/class and using it in jquery

Hi sorry if the name of my question is not correct. i am trying to create an image rotator, but i would like to be able to re-use it more than once in a page, so i am trying to create it as an object/class. I have about 5 or 6 images on a page. i would like to have each image as a rotator, displaying a new image every 2 seconds or so...

Java Class Design - Graphs

Hey there, I'm fairly new to Java, and I need some help figuring out a good class hierarchy and overall design for an assignment we've been given (i'm studying CS). The assignment is graph-theory related, so we were asked to create interfaces for 2 types of graphs, simple graphs and multi-graphs (which are allowed to have parallel edge...

Need advice on proper class design

Hi all, I am supposed to write a simple Cinema Booking System, which allows a customer to make reservations for movies. The Cinema consists or different theatres, with different amount of seats, price and movie showtimes. The user should be able to input his name and other credentials and then make reservations for 1 or more movies a...

Creating a base class based in List<T>

I have a need to create a couple of classes that will serve as base classes for some data functionality I want to implement. The first, we'll call SessionObjectDataItem looks like this ... public class ObjectSessionDataItem { public int ID { get; set; } public bool IsDirty { get; set; } public bool IsNew { get; set; } public...

python circular imports once again (aka what's wrong with this design)

Let's consider python (3.x) scripts: main.py: from test.team import team from test.user import user if __name__ == '__main__': u = user() t = team() u.setTeam(t) t.setLeader(u) test/user.py: from test.team import team class user: def setTeam(self, t): if issubclass(t, team.__class__): self.t...

Is there any visual tool for design and generate code of PHP classes?

I know that general, language agnostic design can be done with any of UML tools but is there anything made just for PHP (or with PHP as one of optional choices)? For now I use NClass, it's nice and easy to use but it is designed for C# so I have to use syntax of this language (types for method's arguments, etc.). I googled the web but I...

How to change the access modifier of a user control

I have a user control created in xaml, lets name it "View". In the View.xaml.cs I changed the access modifier for the class View to internal: internal partial class View : ViewBase { ... } After changing the access modifier the compiler states the error: Partial declarations of 'A.B.View' have conflicting accessibility modifier...

Right place to initialize an object in ASP.NET MVC

I am new to the MVC way of programming so please bear with my basic question ! I have a Status class with a default constructor (in an ASP.NET MVC application). public Status() { this.DatePosted = DateTime.Now; } I noticed Fluent NHibernate calls this constructor each time it fetched a list of existing Status objects from the dat...

How would you implement attribute lists?

When speaking about attribute lists I mean a generic list which stores additional information for a class. The simplest case: A class has a std::map<std::string, std::string>. The first string names the attribute (like "Color"), the second string describes the value (like "Yellow"). In this example another class which uses these attribu...

The point of an Interface

Possible Duplicate: How will I know when to create an interface? I'm wondering about the point of using an Interface. Do you use Interfaces? If so, when do you decide to use them and when do you decide NOT to use them? I've currently got interfaces defined for my service layers and my repository layers, but I'm wondering i...

implementation of relations between classes in oop php

I am new in PHP with classes. I am coding an network ip-mac-user logging system integrated with dhcp. I have users, subnets, units. I created classes for each and created parameters and functions to fill the parameters and some mysql codes about what they do. but there are relationships among these classes. where can I put these relation...

class interaction design

Lets say i have something like this coded class Normal_Mode; class Fast_Mode; class File_Control; //handles all operations with reading/writing in file class Main_Control { private: some_class *root; //all other classes need access to root pointer since there is all the data(binary tree) File_Control *c_file_control; Fast_Mode *c_fa...

Doubt with the implementation of interfaces

Hello All, Firstly, this is just an Object Oriented Programming question and does not apply to any Language in particular. This is quite embarassing for me. This incident happened @ work and I was too shy to clarify this with my colleagues as it would indicate a poor understanding of Object Oriented Programming on my part. So here is t...

Tables Relationship in Python/Grok (MeGrok)

Hi! How are you doing today? I'm writing because I have a database problem. I am trying to migrate a Grok/Zope application from ZopeDB to MySql, and I don't know exactly how to specify one of the relationships between tables... I am using “megrok.rdb” and “sqlalchemy”. I have four classes involved: A record with some information (l...

Class variable wich is object of this class

The title can be confusing, but I'm wondering is it possible to create program like this one: class family_tree { private: string name, surname; family_tree father(); //fragile point! public: family_tree(); family_tree(string n, string sur"); void print(); }; What standard is saying about such declaration? What th...

Methods in Object-Oriented Design

Q1. In my university studies of object-oriented modelling and design they recommend thinking about what an object can do for its method, and what its responsibilities are for its attributes. All attempts at clarification have resulted in further confusion. This tends to generate a class diagram with actors who have all the actions, and ...

C++ circular reference problem

Hello, I have 2 classes: DataObject and DataElement. DataObject holds pointers to (only) DataElements, and a DataElement contains pointers to several types, among which a DataObject. This used to be no problem, since I only use pointers to DataObjects in DataElement, so a forward declaration of DataObject in the header of DataElement i...

Designing a database connection class in VS 2005

I am working on designing a SQL Server database connection class in VB.net 2005. The idea behind doing this will be so a developer can can call the class, pass it a stored procedure name along with the parameters, and get return values back (if any). My question is, how would I design the class so the stored proc parameters are dynamic?...

How can I write a variable of a user-defined type into a stream

I dont mean a variable in a class but a default value for the class as a whole. struct Scalar { unsigned int value; void toThePowerOf(int power); // etc. } I'd like to be able to do something like Scaler foo; foo.value = 2; foo.toThePowerOf(2); std::cout << foo << std::endl; // Outputs 4! Is that possible in C++? ...