30

This answer I wrote to my own question "How do I create a singleton service in Angular 2?" is pretty popular and still gets upvotes. I just saw another upvote and thought I'd update the answer with the current recommended best practices in Angular 6.

Is there any problem with doing that?

Should I leave the newest information at the top where I put it or keep the updates in my answer in chronological order?

4
  • 2
    Related but not duplicate: How should one maintain/support old answers? and Is it good practice to edit one's own old posts?
    – Samuel Liew Mod
    Commented Aug 27, 2018 at 1:35
  • 6
    Nope, no problem with updating it. It is pretty much up to you on how to do it. Leave or provide the relevant information, discard the rest at your discretion; it will always live on in the revision history. There are many ways to providing this type of information, so mostly just making sure it is in the most visible place is important. Does that mean a different answer, a different question, an entirely different question and answer canonical post? Whatever you think makes the most sense. Not really any problem to contributing content like yours though, so just make sure it gets visibility
    – Travis J
    Commented Aug 27, 2018 at 5:46
  • 4
    But the question explicitly states it's about Angular 2.
    – user202729
    Commented Aug 28, 2018 at 5:47
  • 1
    The same question can be raised about answers given by others. I often see questions that are 8 or more years old and have an ACCEPTED answer that is 8 years old (obviously) which is COMPLETELY outdated these days and won't help current and future readers at all. I think it is a serious problem of stackoverflow that such answers keep being the accepted answer and usually keep having 100's of upvotes, while a much much more relevant and uptodate answer that was added many years later only gets a few upvotes because the question is old and not looked at as much as when it was very recent.
    – Carlo Wood
    Commented Aug 28, 2018 at 15:37

3 Answers 3

34

At the end of the day, my primary criterion is: What will be most helpful to future readers?

I do one of three things:

  1. Just edit and don't call attention to the fact it's an edit (people can look at the revision history if they want).

  2. Add the new information at the beginning with a heading saying it's an update ("Update August 2018", "Current Answer", or similar), and add a heading above the original ("Original Answer April 2012")

  3. List them both as alternatives (e.g., not "new" and "old" but different choices you can make).

...or sometimes a bit of a combination.

Which I choose depends on several things:

  • Whether it's a small change / improvement or a wholescale replacement.
  • Whether the way you do X completely changed from "A" to "B", and people will still tend to be familiar with the old "A" way and/or I want to reference the "A" way when describing "B".
  • Whether the old way is still valid, it's just the new way is better or just a new alternative you have.
  • Whether there are comments addressing the original answer's content that will become nonsensical if it's completely removed (and those comments are valuable — I'm a heretic, I believe comments can be valuable — and not readily folded into the answer itself).
  • If I suspect the old answer may be referenced or even quoted off-site with a link.

A couple of my examples are here and here. That first one is an example of a combination (the first part used to be "Updated Answer April 2018" but I just updated it again earlier today and it was a minor edit, so I just updated that bit).

6
  • 3
    Personally I avoid a heading saying it's an update (for the new part). But I do add a heading saying it's an old answer (for the old part).
    – Cœur
    Commented Aug 27, 2018 at 8:11
  • 17
    Also, sometimes I just post a new answer to the same question and link them: "see here for old way to do / see here for new way to do".
    – Cœur
    Commented Aug 27, 2018 at 8:12
  • @Cœur - Those both make good sense as well. Commented Aug 27, 2018 at 8:18
  • Headings to say that you edited something is redundant and breaks the reading flow. See meta.stackoverflow.com/a/316832/792066
    – Braiam
    Commented Aug 28, 2018 at 22:46
  • @Braiam - And other times, they're called for. See above. Commented Aug 29, 2018 at 6:02
  • Instead of the headings with update information, it's probably better to use headings calling out the platform and version instead. That's the information that matters to readers. Commented Aug 29, 2018 at 16:01
5

There's some good meta discussion about answers specific to a version of a tool, and the consensus was that they can and are very valuable to a reasonable section of users who are required to use those versions still in the workplace. Many people are still on specific older versions of Angular due to major architectural differences between some versions. It's very rare that an answer is truly outdated if it's merely version specific, because there's plenty of cases where people are stuck with those older versions. The only case where an answer is truly outdated is where it became known to be insecure or a generally bad practice, which is a different issue than it being an answer specific to an older version.

It's good to take into consideration the context of the question, and whether that question is version specific.

Don't make destructive edits to good answers that are still good answers for a specific version.

If anything, edit to clarify what version the answer applies to.

If the question is generic enough that it might be found by users of a newer version, and you want to add to your answer a solution specific to a newer version, you could consider doing so with a section for the newer version.

However, I feel like in this case the title "Angular 2" in the question is going to wave off anyone using a newer version. They are less likely to wade through the answers that might be version 2 specific in the hopes that someone essentially provided an off-topic answer for version 6.

https://meta.stackexchange.com/a/11706/143774

-2

Short and simple answers are usually better

Since it is your own answer that you are talking about (1), I recommend keeping it as up-to-date and to-the-point as possible. This makes it easy for current visitors to understand what you are saying and quickly find a solution. Long answers with lots of "Update" sections are more difficult to understand.

Your current answer has three sections, two of which are apparently deprecated. I would just keep your top label (Angular 6), delete the two obsolete sections, and (optionally) add a short note at the bottom saying that this is a rewrite of an older post. Users who are interested can check the revision history.

1. We are not as free to liberally edit other people's answers in the way I suggest above. I usually just add a new answer if the current answer needs a major revision.

6
  • 2
    That's dangerous advice, as it presents new content alongside a quality indicator (up-/downvotes) referring to different, now invisible content. In other words: You are hijacking user votes, and use them to decorate content, those users never voted on. Without them noticing. You should make answers as short and simple as possible. But no shorter or simpler. Commented Aug 29, 2018 at 15:57
  • 1
    I disagree. I want the best answer at the top. Long historical answers with mostly obsolete content are not the best answers. User votes indicate a good answer in the past, but when the API changes and the answer becomes wrong, those votes misguide new visitors unless the answer is corrected. History is useful in a history textbook, but prominently displaying the history in a technical reference has little value.
    – Suragch
    Commented Aug 30, 2018 at 0:30
  • 1
    I'm all in favor of making it easy to find useful answers quickly. I'm just opposed to your suggestions on how to get there. The question is asking "How do I do X in Angular 2". You are recommending to delete everything, that answers that question, and just keep the information, on how to do it using a later version. That itself already disqualifies the post as an answer. Keeping historic context isn't just relevant for history textbooks. With this specific question, the OP has done the Right Thing in preserving historic context in their answer. Commented Aug 30, 2018 at 8:33
  • 1
    @IInspectable, Ok, I missed that the question was specifically asking about Angular 2. That being the case, I agree with you.
    – Suragch
    Commented Aug 30, 2018 at 8:47
  • This is really, really bad for those who are still stuck using an old version. Like deleting answers about cars because you now bike to work. Commented Aug 30, 2018 at 14:26
  • It was confusing because they came out with an entirely new version between 1 and 2 with different language, tools, libraries, and design practices. Then they renamed version 1 as 'AngularJS' and started updating versions quickly so now they are on version 17. For a while though you had to specify 'Angular 2' to differentiate between Angular and AngularJS, but 'Angular 2' could reference just their new system in general and be relevant if you were using a later version, but if you said 'Angular' it could refer to what later was renamed 'AngularJS' Commented Nov 9, 2023 at 16:29

You must log in to answer this question.

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