Questions tagged [class-design]

Refers to structural definition of class unit in object-oriented languages.

1125 questions
0
votes
5 answers

Javascript data structures

I would like to know if it is possible to do something like this: if (mb == null || typeof (mb) != "object") { var mb = new Object(); } mb = { tests: { onAnimals: { test: function() { return ""; …
Joshlo
  • 734
  • 3
  • 9
  • 25
0
votes
4 answers

Class implementations in interface dll?

my problem: Inside an application, all interfaces are declared inside an own dll(project "interfaces", for example). Inside project interfaces, there are many class implementations, too. Now I need one of this implemented classes inside another…
Inno
  • 2,567
  • 5
  • 32
  • 44
0
votes
3 answers

Should I place a built in Class (such as Date) as a separate class in my UML

I'm creating a UML Class Diagram for an inventory system as part of a class assignment. I used members such as String and Date in a few of my Classes. My group members are saying that I should include a Date class because it is an object. My…
Julian
  • 1,853
  • 5
  • 27
  • 48
0
votes
2 answers

EF Modelling Help: User with multiple Roles and Locations at a Company (Model First)

I am kind of stuck in an easy modelling / design process. How would you design the following model? I'm working with Entity Framework 5 / Model First. I have Users working in Companies. Each User can have multiple Roles in a Company. Each User can…
Trevor
  • 51
  • 3
0
votes
4 answers

Custom Actionscript 3.0 Events: Build separate Classes for different purposes or use one for all?

I'm using custom Events in Actionscript 3.0 for the first time and I'm unsure about how to best design them. I need a couple of Events. Some of them need to transport different kinds of data and some don't. Now I don't know whether I should use a…
0
votes
1 answer

C# - A class-design problem - Loading property List

Suppose I have a class like the following: public class Stage { public int ID {get; set;} public strint Code {get; set;} public string Name {get; set;} private List _machines; public List Machines { …
user366312
  • 16,949
  • 65
  • 235
  • 452
0
votes
2 answers

Policies Array Class-Design wrapper

i want to write an wrapper for different Array Classes with different Policies. For example: typedef ArrayType Array; // one global assignment I want to use the class like a blitz++ Array for example: Array
PT.
  • 65
  • 5
0
votes
1 answer

C#: How can I pass a class to a function in separate dll

I tried to code my own serialization dll. The code itself works as expected. Now I want to put the entire code into a dll file. My problem is the following: how do I tell the dll WHICH class it should serialize? Example: public class serialize { …
0
votes
1 answer

Hierarchy classes dependency

I want some advice about class designs. Let's say that I have 3 classes, "class A", "class B" and "class C". Each class has different namespaces. "A" has an instance of "B", and "B" has an instance of "C". Each class have a "struct Setting" and each…
Andrew KeepCoding
  • 7,040
  • 2
  • 14
  • 21
0
votes
1 answer

Designing a Packet-Family

In Cisco's UCCX CTI Protocol there are Requests, Confirmations & Events. (Link for further information to this protocol - cisco account neeeded - Link) All of them basically exist of some fixed fields and some floating (optional) fields. What would…
Reini
  • 1,233
  • 3
  • 19
  • 34
0
votes
3 answers

Object/Class Design Question

I have a class as follows :- interface IFilterCondition { List ApplyFilter(List namesToFilter); } class FilterName : IFilterCondition { public NameFilterEnum NameFilterEnum{ get; set; } public List ExcludeList { get;…
Joshscorp
  • 1,832
  • 4
  • 22
  • 42
0
votes
2 answers

Writing classes - good practice

First thing is that I didn't really want to post this one on stack code exchange, because this is really small amount of code written in about 5 mins. I want to ask you if the class (my first in c++) I written is acceptable. I didn't really se a lot…
user2252786
  • 1,627
  • 5
  • 21
  • 32
0
votes
1 answer

Is it possible to use a parent table Id instead of child table Id, when child table should put it's Id into another table

I have this Generalization relation ship between some classes in my class diagram. FirstClass as a base class that has Name attribute, SecondClass as a derived class that the FirstClass is it's base class and has some other attributes and finally…
Vahid Ghadiri
  • 3,966
  • 7
  • 36
  • 45
0
votes
5 answers

Designing a class with **Exceptions**

When I design a class I often have trouble deciding if I should throw an exception or have 2 func with the 2nd returning an err value. In the case of 2 functions how should I name the exception and non exception method? For example if I wrote a…
user34537
0
votes
1 answer

What is the correct way of getting all records from a database using Python and OOP?

What would be the correct way of getting all the records from a table in a database? My idea would be: import MySQLdb Class User: def __init__(self, id): self.db = MySQLdb.connect(host="localhost",…
Samuel Taylor
  • 1,181
  • 2
  • 14
  • 25