15

Many times I am programming something and wondering if what I'm doing is or not a good practice (it doesn't mean that I'm asking for code reviews as some people say, in fact I don't include code).

So I would like to know if those questions are considered opinion-based and get closed or not.

For example: In order to fill the properties of an object, is a good practice to pass it as parameter to the function which fills it, or should I create a new object inside the function and just fill and return it? What's the best practice?

7
  • It really depends on the question. Sometimes there is a good practice, sometimes there is not.
    – Maroun
    Jun 10, 2015 at 9:44
  • 1
    "Is it a good practice", "Is it a good idea" and the like are most times "What's the best" in thread-bare disguise, including the vagueness and flame-bait factor (those are "primarily opinion", "too broad" or "unclear", depending on particulars), instead of a clumsy way of asking whether something does what you think it does, which might work after thorough editing. Jun 10, 2015 at 9:48
  • 13
    "Good practice" questions are drastically off-topic, they will get closed. You cannot get an answer to a question like this, both approaches are equally valid and whether one is "better" than another entirely depends on the specific usage. The only way you can ask it is to show that specific usage in a snippet and ask whether cloning the object is required. With some luck you'll get an answer that expounds on it. Albeit that it is fairly uncommon these days to have that kind of luck, you have enough rep to put a bounty on the question. Jun 10, 2015 at 9:50
  • These questions are often answered by Yes or No, which is really worthless. The OP should be creating prototypes to evaluate each, deciding upon one or the other based on how they interact with this or that practice. My opinion is not necessarily right for anyone else. Hah! Who am I kidding? But the problem is that I'm not always around to tell you how to live your life. You have to manage most of it. I'll be around every once in awhile to say you're being a dumbass. You just can't rely on me. There's so many people out there I have to inform of their failures. sighs
    – user1228
    Jun 10, 2015 at 15:28
  • this has been very useful kind of questions although opinion based. this is my personal opinion but it should be allowed and questions/answers should be delete/down voted without more than one comment or some interaction or edit suggestions... being Q/A site is good but sharing information should be important part of it so opinion or rather idea based question/answers should be welcomed. otherwise it would be rendered FAQ over the time.
    – Saurabh
    Apr 22, 2017 at 1:09
  • Also worst part is I can down-vote any question without having background about tags mentioned on question. why is that?say for example im from java background and I can still go n downvote R based question which is unfair to person asking question
    – Saurabh
    Apr 22, 2017 at 1:11
  • Your "For example:" Section is "useless" if you don't mention the Prog-Lang... :idea:
    – chivracq
    Dec 17, 2022 at 8:03

2 Answers 2

16

From Rosinante's epic answer:

While you may be an exemplary, clear-thinking, individual, who uses the term 'best practice' in a constructive manner, you have been preceded by a giant procession of zombies who use it as the antithesis of thought. Instead of understanding the important specifics of their situation and looking for an appropriate solution, all they want is to spot a herd in the distance and go trotting off after it. Thus, the term 'best practice' has been rendered an extremely strong signal of a empty resonant cavity in the place where a brain should be, and questions that mention the phrase get closed.

As you see, if you actually succeed in not being too vague ("unclear what you are asking") and in restricting the scope appropriately ("too broad"), your question still runs afoul of bike-shedding and flame-wars, and is thus "primarily opinion-based".

Sometimes, you might have a clumsily asked on-topic question whether something does what you think it does (or how it falls short and/or needs to be corrected) hidden in there, but it's your task to discover it and bring it to the surface. Most likely, that question is still hiding in your subconscious, needing lots more thought to coalesce.

0
9

Since I've been quoted, I want to clarify. The point of my cited answer was to explain why some people, including me, are prone to close questions that are conspicuously labelled 'best practice' questions, not necessarily to state that nothing like such a question could ever be appropriate.

  1. Best not to use the term 'best practice' or even 'good practice', particularly in the title. You want to ask something specific? Tell us what.
  2. If you have alternatives clear in your mind, asking for the tradeoffs between those alternatives makes a better question than 'what's the best way to approach X?'
  3. If it's essentially a code review question, well, now there's a code review site.

Even so, this place isn't a forum for shared experiences, so if your question boils down to asking other people for theirs, it might get closed.

1
  • point you mentioned makes sense but here is another perspective. "best practice..." is language choice of words and decision of closing such questions is based on opinion eg "it will lead to misuse of site". In this way any post on design patterns may possibly get eliminated. with simple questions jumped upon for answers. relatively difficult questions which may require brain storming get eliminated, even putting fear in users mind "its gonna be deleted", Leading to SO becoming more of FAQ than technical fertile place of information.. please let me know your thoughts. i apologies if i was rude
    – Saurabh
    Apr 22, 2017 at 1:27

You must log in to answer this question.

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