All Questions
117 questions
1
vote
2
answers
127
views
How do I reduce number of FieldValidator derivations?
I am trying to write RSQL Parser which checks if the RSQL is logically correct.
while the RSQL Java library checks whether the RSQL expression is grammatically correct, it doesn't check if the ...
3
votes
4
answers
1k
views
Representing vectors as arrays of points vs. as data structures
I'm writing a program in Java where I need to represent the position, scale, and other 3-dimensional properties of objects in a world using vectors.
I can use either of these two approaches:
...
3
votes
9
answers
4k
views
Is it an anti-pattern to use interface for entity?
I read an article about that using an interface for an entity is an anti-pattern for these reasons:
Your interface signature is identical to your class.
There’s only one implementation of your ...
-1
votes
2
answers
1k
views
Dealing with multiple application instances
I'm developing an application (Java & JavaFX) that writes/reads data (a file). The problem is I don't want to restrict user to run only one instance (of my app) at a time, as I really can't think ...
0
votes
1
answer
69
views
Design a non replayable endpoint for a service
I am trying something out in Springboot and stuck with a weird issue where I want to send some data from my frontend (react app) to backend (SpringBoot) and make that request non replay able by users (...
0
votes
1
answer
118
views
Interface design for container that holds different instances derived from a common type
I'm currently designing an interface for a container that is supposed to store references of different instances that derived from a common supertype. An analogy of it would be as following:
Suppose ...
3
votes
4
answers
780
views
Is it a bad practice to have an interface method to tell whether it can handle an object?
interface Resolver {
boolean canResolve(SomeInput input);
SomeOutput resolve(SomeInput input);
}
public static void main(String[] args) {
List<Resolver> resolvers = ...;
...
-2
votes
1
answer
1k
views
How to implement state machine to card games such as poker or russian poker?
These are my class designs:
I also have Controllers where I can create table, create users add users to table, deal hands simulate user bets using PostMan (Above classes are game engine classes, I ...
-1
votes
1
answer
955
views
How to combine data from multiple sources into the same object?
I've been running into a common pattern when requesting data from multiple sources:
Have a list of objects from one source (e.g. a list of Cars) with an id property and a few other properties ...
2
votes
5
answers
1k
views
How can I write an enum for date periods where not all periods have a static number of months?
I have an enum that works very well to represents date periods and the number of months in those date periods:
public enum StandardDatePeriod {
ONE_MONTH(1),
SIX_MONTH(6),
ONE_YEAR(12),
...
1
vote
2
answers
122
views
Designing UI module for an application
I have an UI module that will expose only one class - UserInterface. The class will be responsible for collecting user input and providing output (command line UI style). From logical way of thinking, ...
4
votes
2
answers
147
views
How do I trigger conditional post processing action without violating SRP?
I have a User Model as below, this Model class is in the shared library.
class User {
private long userId;
private String email;
private String userType;
private long departmentId;
...
1
vote
2
answers
1k
views
Abstract factory pattern for creating complex shapes
At the moment my code looks like this. I have simplified the UML so it does not contain unnecessary information. I have used abstract factory design pattern.
My job is to create shapes. The problem ...
0
votes
1
answer
348
views
API Split for creating object with inheritance and behaviors
I have a web service which is exposed to UI owned by our team. This web service is responsible for creation of objects and saving it in the DB (NoSQL Database). The object being created has multiple ...
-1
votes
1
answer
752
views
Exposing java service as static method or seam dependency
Our legacy application provide a static method public static boolean persist(Data data) for service/class callers for data persistence.
I do see unit testing issue for callers. Is this also an ...