All Questions
60 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 ...
1
vote
2
answers
187
views
Java OOP Philosophy/Design: Mutable classes
I do know that the best practice these days is to model immutable classes in Java. An ex: below
// It makes sense to model this in an immmutable fashion
class 2DPoint {
private int x;
private int ...
0
votes
1
answer
256
views
How can I split tightly coupled code in an OOP language?
So I've a class that is some kind of wrapper of a state machine for a multipart upload and it's database writes/reads. Everytime something is uploaded via REST basically the following happens
...
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
3
answers
354
views
Exposing multiple classes from the representive package for one entity
I have a simple app for storing the movies, that exposes REST API. I am using spring-boot. I am using this simple app as an example, however, the question is more about general good practice.
I am ...
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;
...
9
votes
2
answers
2k
views
Does OOP overemphasize the importance of noun and thus put action/verb in the less importance position ? [closed]
Steve yegge wrote an article called "Execution in the Kingdom of Nouns" back in 2006, 14 years later I still find the points he made valid. For example, "Action is what gives life its ...
2
votes
1
answer
911
views
Efficient way to store "item" objects in a simple game
I am developing a simple text-based game. In this game, the user is able to collect items and store them in an inventory.
My question is: how should I organize the internal structure of my game so ...
0
votes
1
answer
510
views
Extension of classes - Where to put behaviour - How much direct-access is allowed
At this point i would exclude the inheritance....
So the question is about more like extend into a seperate class or into the class which should be extended, both play in the composition-league.
So ...
1
vote
1
answer
476
views
Design Chess - Object Oriented Design
I am trying to design online chess game(figuring out required classes). Need some suggestion on choosing better option to validate the move. So, lets say, I have below class
Option 1 :
My ...
-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 ...
5
votes
1
answer
899
views
Factory/Strategy Pattern for objects that require different pieces of data
I'm facing some difficulty with designing a factory and/or strategy pattern for building out EmailTemplates. IMO this seems like the design pattern to go with, but I feel like the path I'm going down ...
1
vote
1
answer
396
views
Designing low fault software rest API calls to achieve data synchronization between two different systems
I have been looking for a better design approach and will be providing my problem statement here with a similar example. As I don't have logic already in place but have the solution in mind which I ...
3
votes
2
answers
1k
views
Field variable VS method variable
hey i have a difficult question.
class DatabaseHelper
{
Database db;
String defaultShema;
public DatabaseHelper(Database db, String defaultSheme)
{
this.db = db;
this....