Skip to main content

All Questions

1 vote
5 answers
933 views

DTO vs POJO (Entity) on POST request

If I have for example a User POJO like the following @AllArgsConstructor public class User { @Id private final String id; private String username; private String password; private Date createdDate;...
iqueqiorio's user avatar
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 ...
dka72's user avatar
  • 101
0 votes
1 answer
94 views

Problems with software layers in complex query methods

I designed a rest api software with 2 simple layers: Controller and Service. The controller handles the coming http request and redirect to a service method. In the beginning of development every was ...
josev.junior's user avatar
-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 ...
cruxion effux's user avatar
0 votes
2 answers
181 views

How to write the following snippet in more cleaner way?

When the caller gives me a call, I need to evaluate n number of criteria which currently I'm doing like if (a & b & c & d & e) Day by day the conditions are growing and it's ...
Tom Taylor's user avatar
1 vote
1 answer
841 views

Have generic methods that transfer DTO's from different packages, but contain same fields

I have 3 services Service A, B, C which put and get data to/from Service D +============================================+ | Service A | Service B | Service C | +==============================...
Alex P.'s user avatar
  • 121
1 vote
2 answers
163 views

Is passing an ErrorMessage to be populated inside the receiving method an anti-pattern?

I come from a Java background, and my colleague is from .NET. We are working on a Java project and I saw him create a method like this: public Object myMethod(Object[] param1, ErrorMessage ...
lemuel's user avatar
  • 131
6 votes
6 answers
5k views

Should constructors ever be used only for side-effects?

Summary: Why is it wrong to design a constructor only for its side effects, and then to use the constructor without ever assigning its return value to a variable? I'm working on a project that ...
Brian H.'s user avatar
  • 179
1 vote
2 answers
1k views

Polymorphic constants in Java

I am designing some polymorphic code to perform mathematical operations. The idea is to abstract out the underlying representation of the data, as different use cases require different representations....
Reinstate Monica's user avatar
4 votes
1 answer
3k views

Designing a flexible API with support for Callbacks

I am writing a Java library that needs to make http GET && POST requests. There will be two types of users of this library: Those with understanding of callbacks and know how to use them. ...
Joel Min's user avatar
  • 143