Skip to main content

All Questions

1vote
2answers
127views

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 ...
Govinda Sakhare's user avatar
3votes
4answers
1kviews

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: ...
Bunabyte's user avatar
3votes
9answers
4kviews

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 ...
Mercury's user avatar
-1votes
2answers
1kviews

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 ...
Wiktor's user avatar
0votes
1answer
69views

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 (...
Abhijeet Shukla's user avatar
0votes
1answer
118views

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 ...
torez233's user avatar
3votes
4answers
780views

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 = ...; ...
Martin Tarjányi's user avatar
-2votes
1answer
1kviews

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 ...
Sunuba's user avatar
-1votes
1answer
955views

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 ...
user8297969's user avatar
2votes
5answers
1kviews

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), ...
James's user avatar
1vote
2answers
122views

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, ...
Wiktor's user avatar
4votes
2answers
147views

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; ...
Govinda Sakhare's user avatar
1vote
2answers
1kviews

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 ...
MaLa's user avatar
  • 310
0votes
1answer
348views

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 ...
dka72's user avatar
-1votes
1answer
752views

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 ...
cruxion effux's user avatar

153050per page
close