开发者

In broad prespective, how to go about creating a write board like 37signals?

I am at the beginning stages of rails and wanted to build something like 37Signals write board just so I can learn and feel "accomplished"开发者_运维知识库 but don't know where to begin on the following segments:

  1. is the markdown formatted text stored as raw text in DB?
  2. is each edit/version stored as raw markdown text in DB?
  3. most importantly how do we find out the differences in two or more versions? is there a set algorithm for this?


While I obviously can't answer as to how exactly it's implemented at 37Signals this is my thoughts:

  1. Since the writeboard supports editing storing the markdown in a formatted form would mean that whenever someone were to edit the markdown you would have to revert the formatted html to markdown. I highly doubt this would be a good idear though one could argue that if the edit-to-no-edit ratio is very small the performance benefits (since you don't have to transform the markdown to html) of having the markdown stored formatted would be a hugh advantage. You could also choose to have both version in the database or the formatted version in cache only.

  2. Since writeboards can get pretty big you would probably store the diff (see 3.) of each versions along with the complete latests version. This way whenever displaying the writeboard you can take the complete latests version and you won't have to build it from diffs and at the same time you save space by not storing each revision in complete form.

  3. You could use a diff, this is what is done in vcs' like svn and git, the diff gives you the difference between two text-files: which characters were changed, inserted and removed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜