2
\$\begingroup\$

Can I ask a question on a very specific aspect of design? Like, I would like to know whether

Is this the right way to set defaults? I want the defaults set regardless of whether an object is created via a public no-args or a builder

    public Measurer() {
        this.timesRun = Defaults.TIMES_RUN; // nested static class with static final fields
        this.loggingType = Defaults.LOGGING_TYPE;
    } 
// ...
    public static class Builder {
        private int timesRun = Defaults.TIMES_RUN;
        private LoggingType loggingType = Defaults.LOGGING_TYPE;

Would such a question be on topic?

\$\endgroup\$
0

1 Answer 1

3
\$\begingroup\$

First if you posted the example question I'd suggest people to close the question for the following close reason.

Missing Review Context: Code Review requires concrete code from a project, with enough code and / or context for reviewers to understand how that code is used. Pseudocode, stub code, hypothetical code, obfuscated code, and generic best practices are outside the scope of this site.

Your example question would be a text book "generic best practices" question. A question where an asker asks for best practices in a generic sense. Now best practices is a bit of a misnomer, as pretty much no practices are always best. Take Testivus On Test Coverage who explains different 'best practices' for three different students.

The problem is bidirectional:

  • Askers get advice for the question asked, but because life is complicated your actual code may not be an example which should follow best practices.

    The asker then sees the difference between the question asked (X) and the situation at hand (Y) and becomes frustrated at the site and answerers for providing 'crap' advice.

  • Answerers answer with the goal of helping the asker. When answerers see the advice we give lands we experience positive emotions. Where when the advice doesn't land we can experience negative emotions, like disappointment in ourselves where we gave advice in a manner which didn't land.

Overall we can see the problem for both groups of people is an XY question. Now you may be right and narrowed down the problem to the perfect 7 lines of code to show all edge cases in your specific code. But we have to accept on every such question we're all rolling dice. Taking a gamble.

To remove the gamble is really easy. If we get you to provide more code we can increase the chance of the gamble for success. The solution is fairly easy on answerer's end (posting a comment), and the solution on the askers end is fairly easy (copy more code).

As such with the aim of maximising positive interactions between users. Questions like the example are disallowed.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for you response. I think if I posted the entire app one more time, it would make for a lot of duplication \$\endgroup\$
    – Sergey
    Jun 17, 2023 at 0:45
  • \$\begingroup\$ @Sergey sounds like you're in a bit of a difficult situation. You can't post the code as is again, as the question would be a duplicate. However, if you incorporate the feedback from the answers then you can post a follow up question. If you decide to post a follow up question I'd highly recommend incorporating lots of feedback as a sign of good faith, and to reduce unwanted advice. Additionally if you want feedback about a specific part of your code a bounty can be started to encourage the wanted feedback. \$\endgroup\$
    – Peilonrayz Mod
    Jun 17, 2023 at 0:50
  • \$\begingroup\$ What should I name it? Would "Performance testing app in Java (release 2.0)" be enough? \$\endgroup\$
    – Sergey
    Jun 17, 2023 at 21:36
  • \$\begingroup\$ @Sergey Personally I would have no problem with the title. You could follow the recommendations for follow up questions. If you don't include a recommendation in the first question and don't say anything, the person who reviewed your previous question may not want to review your new question. Otherwise, in my experience people just post a question with new code. If you get any grief and need a hand feel free to poke me here. \$\endgroup\$
    – Peilonrayz Mod
    Jun 17, 2023 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .