How to associate variables to an object and return them?
<p>I have 3 classes: Service, Client and Mess (which I should somehow refactor).</p>

<pre><code>Class Service {

    void servicemethod(int a, int b, int c)
    {
        //does something with params a, b and c
    }
}
</code></pre>

<p>I have the client class which calls two methods from the same Mess</p>

<pre><code> Class Client {

    main()
    {
        Mess.setABC(x)
        Mess.callintermediatemethod(int x)
    }
}
</code></pre>

<p>The Mess class does nothing but reads params a, b and c, which are values associated with key "x" in a file, and calls <code>Service.servicemethod(a, b, c)</code>:</p>

<pre><code>Class Mess {

    static void setABC(int x)
    {
        //sets static params a, b and c with values read from json file that has x as its key
    }

    void callIntermediatemethod(x)
    {
        Service.servicemethod(a, b, c);
        //here x parameter is not even necessary since it already knows what A, B and C are.
    }
}
</code></pre>

<p>Clearly, the Mess class does two things. Sets static variables after reading x and calls service method with the values stored, taking a dummy parameter. This clearly is bad design. But if I decide to do away with mess, how do I set the parameters a, b, c given the variable x? Should I associate them with an object? Decorate them? Use a builder pattern or a dependency injection? How to clean up Mess and make Client class directly call the service method without having to pass through Mess?</p>