New answers tagged

2 votes

Designing class for fixed-size data structure backed by ArrayList

Is this a sound design? Why or why not? That depends largely on your goal for the Chunk class. Based on what you've described, we want the capacity to be invariant. But based on the current ...
user avatar
1 vote
Accepted

Designing class for fixed-size data structure backed by ArrayList

Three thoughts immediately came to mind: Checking the capacity before adding an element should execute very, very fast. Chunk should be more concerned about enforcing its own constraints rather than ...
user avatar
0 votes

Is it bad practice to have too many direct subclasses?

The bad practice here is using subclassing in the first place. My opinion is that 99% of problems you encounter in object-oriented design are better solved with two different mechanisms than ...
user avatar
  • 2,409
5 votes
Accepted

Is it bad practice to have too many direct subclasses?

I don't think the number of descendants (in itself) is necessarily a problem. But I question whether inheritance is likely an ideal way to implement this behavior anyway. By putting the undo/redo at ...
user avatar
  • 43.9k
1 vote
Accepted

Handling resource not found

are there any HTTP standards that advise what should I do? No, HTTP has very little to say in this case. Basically, you will have to decide whether this false positive meets your requirements for ...
user avatar
  • 11.7k
4 votes

Designing APIs that don't expose database primary keys

The fundamental problem with exposing the simple, surrogate keys which tend to be the database's Primary Keys is that it leaks your implementation outside of your database. If you have an API that [...
user avatar
  • 11.6k
1 vote

Having a front end grid component fetches its metadata from the backend, is this a "bad" strong coupling?

If your frontend is generated on the backend side and is returned as HTML then stick with that. If your're frontend is Single Page Application and you're using AJAX calls then expose your view model ...
user avatar
  • 61
1 vote

Having a front end grid component fetches its metadata from the backend, is this a "bad" strong coupling?

The simplest and most maintainable way to have a front-end is for the "resource" to generate its view. No "endpoints", front-end interpretation necessary. Just output the HTML. Job ...
user avatar
0 votes

REST API partially incorrect request handling

This might not be the kind of answer you expect. Or anyone reading this might expect, but to me, the question was made to the wrong audience. Whether A without C or A with a wrong C reference is ...
user avatar
  • 11.7k
0 votes

What HTTP response to return for a patch request with partially correct and partially wrong

This is details about the solution which I used in my case, because that is what product owner wants, also corroborated by @flater's answer. this is how my response would look like if there is at ...
user avatar
2 votes

What HTTP response to return for a patch request with partially correct and partially wrong

The registered reference for the PATCH method is RFC 5789. The description of the method includes this constraint: The server MUST apply the entire set of changes atomically and never provide (e.g., ...
user avatar
2 votes

What HTTP response to return for a patch request with partially correct and partially wrong

What the server should do depends on what the intended behavior is according to the business requirements. That is not something that a stranger on the internet can conclusively answer for your ...
user avatar
  • 37.5k
0 votes

REST API partially incorrect request handling

You should create A, and should return 200, with additional message, stating that C could not be created. so again C creation can be tried with A's id sent.
user avatar
1 vote

API Design. Should i use one update route or multiple for each business logic functionality

Should i use one update route or multiple for each business logic functionality A good heuristic to use for anything "REST" - think about how it would work as a website. Let's suppose we ...
user avatar
1 vote

API Design. Should i use one update route or multiple for each business logic functionality

You should have a single UpsertCar(Car c) command which adds or changes the car to whatever data is sent. That's your basic functionality. Now say you want to add a business process SellCar(carId, ...
user avatar
  • 64.6k

Top 50 recent answers are included