Refers to structural definition of class unit in object-oriented languages.
Questions tagged [class-design]
1125 questions
8
votes
2 answers
Who should be responsible for selecting the appropriate derived class?
I recently wrote a class library that includes some objects that model certain types of files. For example, there is an abstract Document class, with derived classes PdfDocument (concrete) and OfficeDocument (abstract, with concrete derived classes…

Andrew Keller
- 3,198
- 5
- 36
- 51
7
votes
4 answers
Database model to object oriented design?
How would I design classes say in c# to represents a database model?
Given the following tables and fields for a database,
Table: Employee
Pk EmpID
Lname
Fname
Adress
Fk DeptID
Table: Department
Pk DeptID
DeptName
Location
Ok so now…

SupermansTshirt
- 71
- 1
- 2
7
votes
6 answers
What first model or database?
My question is about what should be go first in software developing: database model or domain model? Or these notion are parallels?
Thanks.

Alexandr
- 1,452
- 2
- 20
- 42
7
votes
2 answers
.NET ORMs, immutable value objects, structs, default constructors, and readonly properties
I am just getting started with .NET ORMs, to the point where I haven't even decided between Entity Framework and NHibernate. But in both cases, I'm running into a problem in that they seem to want me to compromise the integrity of my domain model in…

Domenic
- 110,262
- 41
- 219
- 271
7
votes
13 answers
Is there a rule of thumb for when to code a static method vs an instance method?
I'm learning Java (and OOP) and although it might irrelevant for where I'm at right now, I was wondering if SO could share some common pitfalls or good design practices.

asdfqwer
- 492
- 2
- 5
- 14
7
votes
6 answers
Why can static classes can have only static members?
As the title suggests I would like to understand why static classes can have only static members. I hope it is same in all the programming languages. So the explanation would be the same for all the languages, I believe.

NLV
- 21,141
- 40
- 118
- 183
7
votes
3 answers
In what cases superclass shouldn't be abstract?
In this thread I found some interesting moment, If class uses only as superclass there isn't rule to make it abstract. Why so?
Thanks

Stan Kurilin
- 15,614
- 21
- 81
- 132
7
votes
4 answers
correct use of classes?
I am college student (computer science) and have just started a C# programming class.
For our assignments I have been using a class called "Display" where I put any console output that could be used several times throughout a project. For example, a…

subcan
- 2,021
- 2
- 18
- 21
7
votes
5 answers
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…

Chase Florell
- 46,378
- 57
- 186
- 376
7
votes
4 answers
Need advice on proper class design
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…

jottr
- 3,256
- 3
- 29
- 35
7
votes
2 answers
Python - "object layout"
can somebody describe the following exception? What is the "object layout" and how it is defined? Thanks
Traceback (most recent call last):
File "test_gui.py", line 5, in
suite = AlgorithmEngine('gui_suite')
File…

honzas
- 1,761
- 4
- 16
- 26
7
votes
4 answers
In .NET, Why Can I Access Private Members of a Class Instance within the Class?
While cleaning some code today written by someone else, I changed the access modifier from Public to Private on a class variable/member/field. I expected a long list of compiler errors that I use to "refactor/rework/review" the code that used this…

AMissico
- 21,470
- 7
- 78
- 106
7
votes
5 answers
Serializing Name/Value Pairs in a Custom Object via Web Service
This is a very complicated question concerning how to serialize data via a web service call, when the data is not-strongly typed. I'll try to lay it out as best possible.
Sample Storage Object:
[Serializable]
public class StorageObject {
public…

Matthew M.
- 3,422
- 4
- 32
- 36
7
votes
6 answers
What is a good design pattern in C# for classes that need to reference other classes?
I am working on a business problem in C#.NET. I have two classes, named C and W that will be instantiated independently at different times.
An object of class C needs to contain references to 0 ... n objects of class W, i.e. a C object can contain…

Kevin P.
- 1,414
- 1
- 18
- 24
7
votes
1 answer
UML class diagram: how to model relations about calling a method or starting an activity or service
I'm creating my first Android app. I have avoided to label associations with user or system interactions (e.g. I have labeled starts instead startsWhenClick; I have labeled starts instead startsWhenDetection). However, after reading this, I'm…

chelder
- 3,819
- 6
- 56
- 90