1,124 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
61
views
When should I implement a swap() function for my class? [duplicate]
Suppose I'm writing a class intended not just for my private use, but for others to use as well (e.g. it's exposed in a library I'm writing or modifying). Let's suppose also that it's not a singleton.
...
0
votes
1
answer
64
views
Trying to write an S4 data class which has lists of lists in the slots. How is this nesting in slots meant to be done?
I am trying to create a simple S4 class that allows the storage of all necessary parameters to generate a semi-deteministic data synthetic set for another set of functions to act on.
Ultimately, two ...
1
vote
0
answers
107
views
What should I break: Substitution capability or the Liskov Substitution Principle?
Suppose I have the following class:
template<typename T>
struct A { T* ptr; };
and a bunch of functions which take this class as a parameter, e.g.:
template <typename T>
int one_two_three(...
2
votes
1
answer
4k
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
81
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
897
views
Service Class with Multiple Repositories
class AccountClosureService(
private val accountClosureRepository: AccountClosureRepository,
private val userApplicationRepository: UserApplicationRepository,
){
// CRUD METHODS
}
interface ...
1
vote
0
answers
101
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
106
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
455
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
140
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
113
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
94
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
138
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
396
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
69
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 ...