Questions tagged [class-design]
Refers to structural definition of class unit in object-oriented languages.
class-design
1,122
questions
2
votes
1
answer
1k
views
Attendance management system uml class diagram
I'm trying to develop an attendance management system in vb.net with only 1 primary user which will be the professor. I try putting it in a class diagram but I'm not entirely sure if it's right.
...
0
votes
2
answers
69
views
Using C#, is it possible to create a class that utilizes an object within its definition?
I am creating a Blazor WebAssembly app, and I have two classes (shown below). In WorkDay I want to calculate how much I will pay in taxes by using PayRate from the Job class. How can I get this to ...
0
votes
1
answer
464
views
Service Class with Multiple Repositories
class AccountClosureService(
private val accountClosureRepository: AccountClosureRepository,
private val userApplicationRepository: UserApplicationRepository,
){
// CRUD METHODS
}
interface ...
1
vote
0
answers
81
views
Class design: How to implement RAII ressource management for Log-Listener class
EDIT: Alright, the question does not seem to be suitable for the platform as there is no real technical background here. No problem (really, no sarcasm), I will look somewhere else for advice. Thanks ...
0
votes
2
answers
91
views
How can we improve the OO design between two interfaces
In the below sample code, how can we get rid of if-else ladder of concrete classes viz. NoProcesssorFoundError & UnknownError. I could extract an interface between Event1 and Event2 and pass their ...
2
votes
1
answer
172
views
UML classes diagram the question of relations and visibility of fields
I have a few questions regarding my design after having reviewed a number of information sources.
I decided to link the User and UserSettings classes with a composition relation (since user settings ...
1
vote
1
answer
106
views
Why Class Diagram methods are defined in the same class?
In class diagram representation, the fields and the class related methods are shown on the diagram. However, when converting the diagram to a class, I see that these methods are shown like an ...
2
votes
2
answers
86
views
UML how to indicate one class sending request to same class
There are 2 classes in the scenario under consideration, User and ConnectionRequest.
The structures of the 2 classes are given below:
User:
fullName: String
username: String
email: String
password: ...
-1
votes
1
answer
60
views
Does combining composition with association still follow the rules of OOP?
When it comes to class diagrams, can an association or aggregation exist between two objects that are in composition with one base object?
Example:
Class Car has a composition relation with class ...
1
vote
2
answers
66
views
Is there a use case for having a class A contain an instance of class B, and B an instance of A?
This rings the "circular dependency" bell in my head. But I was wondering if there are known accepted use cases for this.
Just to illustrate with some Python:
class A:
pass
class B:
...
-1
votes
2
answers
297
views
How can I do temperature conversion in a class with only one field?
Temperature is measured mainly in three units: in degrees Celsius,
degrees Fahrenheit and in kelvins. It’s easy to convert any of them to
the two others:
Kelvin to Celsius: C = K - 273.15
Celsius ...
2
votes
1
answer
55
views
Associate a user with an abstract class implementation based on their role
Let's suppose that we have a User class that is necessarily associated with a Role, which can be DogLover or CatLover.
We have another abstract class called Animal, which has two implementations, Dog ...
0
votes
2
answers
178
views
Builder Design Pattern - How to make field only accessible to one of its subtype
I have created a builder for client types A and B.
Client TypeA has two fields fieldA and fieldB (see below), while client TypeB has two additional fields. How can I make sure field C and D are only ...
3
votes
1
answer
62
views
How do I show classes of two different variants with two possible values in a class diagram?
I have an entity Question (abstract) in my project. It can be asked in English or Russian. In addition, it can be asked by a student or a non-student. So,I'm looking for the perfect way to show it in ...
1
vote
1
answer
50
views
What is more suitable: polymorphism or hard binding? [closed]
I am designing a business logic architecture, but I am hesitating between two options. Which is the most suitable / recommendable?
The first case gives flexibility, but according to this logic, the ...