Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6158655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:59:38+00:00 2026-05-23T20:59:38+00:00

I was wondering how people with more experience and more complex projects get along

  • 0

I was wondering how people with more experience and more complex projects get along with this “uglyness” in the REST Communication. Imagine the following Problem:

We’ll need a fair amount of functionalities for one specific resource within our REST Infrastructure, in my case that’s about 50+ functions that result in different querys and different responses. I tried to think of a meaningful resource-tree and assigned these to methods that will do “stuff”. Afterwards, the Server Resource Class looks like this:

@Path("/thisResource")    
public class SomeResource {

    @GET/POST/PUT/DELETE
    @Path("meaningfulPath")
    public Response resourceFunction1 ( ...lots of Params) {

        ... logic ....

    }

//
// lots of functions ...
//

    @GET/POST/PUT/DELETE
    @Path("meaningfulPath")
    public Response resourceFunctionN ( ...lots of Params) {

    ... logic ....
    }
}

To construct the urls my client will call, I made a little function to prevent Typos and to take better use of Constants

so my Client looks like this:

public class Client() {
    public returnType function1 () {
        client.resource = ResourceClass.build(Constants.Resouce, "meaningfulPath");
        ...
        return response.getEntity(returnType);
    }

}

Now the questions that bothers me is how could I link the client function and the server function better?

The only connection between these two blocks of code is the URL that will be called by the client and mapped by the server, and if even this URL is generated somewhere else, this leads to a lot of confusion.

When one of my colleagues needs to get into this code, he has a hard time figuring out which of the 50+ client functions leads to wich server function. Also it is hard to determine if there are obsolete functions in the code, etc. I guess most of you know about the problems of unclean code better than I do.

How do you deal with this? How would you keep this code clean, maintainable and georgeous?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:59:39+00:00Added an answer on May 23, 2026 at 8:59 pm

    Normally, this would be addressed by EJB or similar technologies.

    Or at least by “real” web services, which would provide at least WSDL and schemas (with kind of mapping to Java interfaces, or “ports”).

    But REST communication is very loosely typed and loosely structured.

    The only thing I can think of now, is: define a project (let’s call it “Definitions”) which would be referenced (hence known) by client and server. In this project you could define a class with a lot of public static final String, such as:

    public static final String SOME_METHOD_NAME = "/someMethodName";
    public static final String SOME_OTHER_METHOD_NAME = "/someOtherMethodName";
    

    Note: a static final String can very well be referenced by an annotation (in that case it is considered to be constant by the compiler). So use the “constants” to annotate your @Path, such as:

    @Path(Definitions.SOME_METHOD_NAME)
    

    Same for the client:

    ResourceClass.build(Constants.Resouce, Definitions.SOME_METHOD_NAME);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is more of a preference but I was wondering what people think would
I was discussing this at work, and was wondering where people start their designs?
This is more out of personal curiosity/interest than a specific problem I'm trying to
I was wondering what kind of tools people use to make their coding experience
Just wondering why people like case sensitivity in a programming language? I'm not trying
Just wondering what people think is the best practice when implementing an IValueConverter which
I was wondering what people thought of using properties as object initializers in C#.
I'm wondering if people can suggest the best tutorial that will walk me through
I was wondering what people thought about the decision to support Entity Framework over
I was wondering what people's opinions are of a RESTful PUT operation that returns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.