Skip to main content

All Questions

Tagged with
-1 votes
2 answers
160 views

Designing class for fixed-size data structure backed by ArrayList

Say we want to write a Java class that represents a fixed-size list. Let's call it Chunk.java (as in, it represents a chunk of data to be processed or sent somewhere). My implementation of this class ...
Fiery Phoenix'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
2 votes
0 answers
481 views

Third-party API wrapper in Java: how to design

Suppose, there's a site that provides an API, such as this: Users post questions, answers on that site You can make GET and POST calls There are two types of authentication: weak (only gives read ...
parsecer's user avatar
  • 129
2 votes
2 answers
972 views

Java loose coupling data passing between components

Let's say I have two components talking to each other. The first one calls a "get results" function from the second one. How should I return the results? For example, SomeObject getResults(String ...
Cap Barracudas's user avatar
6 votes
4 answers
1k views

Evolving an interface that is not supposed to be implemented by the client

I'm about to write a Java library. Basically, this library provides something like this to its user: interface Foo { void doA(); boolean aWorked(); void doB(int value); } The user is not ...
Daniel Jour's user avatar
0 votes
1 answer
188 views

Use global variables or methods in an API's frontend

I am currently designing a graphics library in Java and now it's come to making the frontend I am curious why I have never seen libraries using global variables for their settings/properties - in-fact ...
user avatar
3 votes
3 answers
4k views

Designing an API on top with Java RMI and Rest APIs

I'm working on the backend of a java web application. We have a document repository (Fedora Commons specifically) where we house xml files. I want to abstract the API of the repository internally so ...
user1303881's user avatar
5 votes
2 answers
295 views

API design involving standard and custom settings

Suppose a class allows some kind of configuration that has some well-known default values but also has the option of defining a custom value. For example, suppose you want to let users configure a ...
Deckard's user avatar
  • 3,437
69 votes
4 answers
9k views

Why were Java collections implemented with "optional methods" in the interface?

During my first implementation extending the Java collection framework, I was quite surprised to see that the collection interface contains methods declared as optional. The implementer is expected ...
glenviewjeff's user avatar
  • 1,405
5 votes
2 answers
1k views

What are the best patterns/designs for stateful API development?

I am about to implement a API for my TCP/IP server written in Java. Right now I have a temporary method that takes a String, executes a command based on the String and returns a String basically like ...
Svante's user avatar
  • 153
17 votes
6 answers
7k views

Are Java's public fields just a tragic historical design flaw at this point? [closed]

It seems to be Java orthodoxy at this point that one should basically never use public fields for object state. (I don't necessarily agree, but that's not relevant to my question.) Given that, would ...
Avi Flax's user avatar
  • 297