1

I'm working on a project constructing an online collaboration tool. Looking at Wikipedia, I noticed that user-generated itterations of a page can easily be compared to each other; the comparison highlights the differences.

Conceptually, what would I need to implement to do pretty much exactly the same?

Kriem
  • 8,666
  • 16
  • 72
  • 120
  • 1
    Why can't you just use any of the already existing wiki engines for your collaboration tool? – lothar May 09 '09 at 18:09
  • The complexity of our tool goes a little further than that. Question is, depite that, are these engines any good? I don't want to create the millionth wiki. – Kriem May 09 '09 at 18:12
  • 1
    Oh yes, there are *plenty* of good wiki engines. Don't reinvent the wheel. If you do, you might want to look at the edit viewer on SO, it sounds similar to what you are describing. – Zifre May 09 '09 at 22:00
  • The SO edit view is almost exactly what I want to accomplish. That's based on a wiki engine? – Kriem May 09 '09 at 22:04
  • 1
    @Kriem: yes, SO is a wiki. IIRC, it is custom built. – Zifre May 09 '09 at 22:36
  • @Zifre (and lothar?): Good to know! Care to make it a real answer below? – Kriem May 09 '09 at 22:43

2 Answers2

1

Composited from the good advice:

The easiest way is to just use any of the already existing wiki engines. There are plenty of good wiki engines. Don't reinvent the wheel.

For example, StackOverflow itself is a custom built wiki. Look at the edit viewer on Stack Overflow to see how well its functionality meets the one described in the question.

Kriem
  • 8,666
  • 16
  • 72
  • 120
0

You'll need a versioned datastore and a diffing algorithm.

Store versions of your resources by giving each resource a revision number. When a user edits a resource, instead of replacing the resource, save the edit as a new entry in your datastore with a new, higher revision number. When you want to retrieve the resource, return the one with the highest revision.

Instead of a revision number you could use timestamps. Not only do timestamps always increase, but the revision number itself could be used to identify when the resource was modified.

Choose a diff algorithm based on how you're storing the resources. Wikitext is usually linewise, so if users are editing that, it would make sense to use a linewise diff like the standard Unix diff utility. If the resources are XML, you may wish to find an XML-specific diff algorithm so that it would be clear to users where the differences are.

a paid nerd
  • 30,702
  • 30
  • 134
  • 179