2

There's a highly upvoted question about discerning maintainable code from unmaintainable code: How would you know if you've written readable and easily maintainable code?. It's a community wiki, and it seems that some effort has gone into trying to improve it: How would you clean up a question asking if you've written readable and easily maintainable code?.

But my first reaction to this question is that it seems like a poster child of the "Too Broad" close reason. Literally entire books and volumes and fields of study have been devoted to this topic. It's also an ever changing target as languages evolve, and some practices that are good in one language are horrible in another just due to the limitations and differences. It also makes a remarkably poor dupe target for any question that asks about a specific issue, as it offers no helpful advice for a particular case even when it's appropriate to provide a more specific answer.

I'm hesitant to flag it since it seems like it's been discussed before and high reputation users are aware of it. So before I go flagging it or asking for closure, I'm posing the question of whether my evaluation is correct. Is this question Too Broad? Why or why not?

  • "Literally entire books and volumes and fields of study have been devoted to this topic" - but the top most voted, accepted answer does not seem to need a book , it is rather short. – Doc Brown Nov 30 '17 at 6:26
  • ... however, I agree that espcially one member of the community here tends to (ab)use this unspecific question as a target for questions which require a more specific advice, but that is not a problem caused by that question. – Doc Brown Nov 30 '17 at 6:30
  • @DocBrown And yet other answers argue it's a fundamentally impossible task while writing code the first time. Is one popular answer, which itself is rather flippant and can be counterproductive depending on your peers, enough to salvage the entire question? – jpmc26 Nov 30 '17 at 6:39
1

I am against closing it.

First, I think it is debatable if it is too broad. Literally, the question is not "How to write readable/maintainable code", that would be clearly too broad, since that is what books like "Code Complete" or "Clean Code" are about. But for the question "How do I know I did so" the simple, focussed answer "do quality assurance by a second pair of eyes" is spot on.

One might argue about the usefulness of such a question and this answer. Of course, for many specific issues this general answer is not useful. But I think often people just need to be told "there is no scientific metrics or secret algorithm for what you are asking, you just need to let a second developer review your code". And for those questions, it is good to have a dupe target. Snowman wrote something along the same lines in his answer to that other meta question mentioned by you. I think his arguments why the question is useful as a canonical reference are still valid, even if people think it is off-topic or too broad.

I agree that sometimes using the question as a dupe target is abused, but that is IMHO an issue with the community member who does this, and not a reason to close this question.

1

It is somewhat well known that a Supreme Court Justice (Potter Stewart) wrote, "I know pornography when I see it." What is less well known is that the preceding comment was something like, "Pornography is something that would be offensive to un homme moyen sensual (a man of average sensuality) I am such a man. Therefore,..."

It's hard to define "maintainability" definitively, but the local version of the above litmus test works: How would the "average" programmer (e.g. a user, or yourself six months later) feel about the program? That is a fairly narrow answer, meaning that the question is probably not "too broad."

  • +1 for the reference to that memorable judgment! I would emphasise that maintainable code is code that is structured in a way that conforms to shared understandings and expectations about how a solution of that nature would be structured. Unlike with pornography, where all members of a particular society have some prior exposure to it and to other people's views on it, there is often no widely shared understanding of how a particular piece of software ought to be structured. So the developer is often forced to ask simply and subjectively, "could I maintain this in future?". – Steve Jan 7 '18 at 12:46

You must log in to answer this question.

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