Wandering Thoughts archives


The advantages of editors over database programs for modifying your data

Yesterday I mentioned that one advantages of using plain text files is that you could modify your data with an editor instead of having to use some sort of database program (whether a SQL shell, some shell scripting on top of that, or custom code you write). One reason this is an advantage is that someone else has already written your editor of choice and you already know how to use it, but another part of this is that editors are often genuinely better environments to modify your data in.

There are at least two aspects of this. The first is that any decent editor has not just undo but multi-level undo that crosses over file save boundaries. In most editors you can revert your entire set of modifications all the way up until you quit out of the editor while at the same time making your modifications visible to other programs (by saving the file or files). Actual database programs generally can't match this level of support for 'oh oops, better revert that' moments, partly by design.

(Most editors are implicitly built around being the sole modifier of the files you're working on. Databases are generally built around assuming multiple people are modifying things on an ongoing basis.)

The second is that editors make your changes fully visible and also show you the surrounding context (or at least a screen's worth). You literally see your data sitting there on the screen. This makes it much easier to notice undesirable changes and other accidents, especially large scale ones; if you mangled your data, you have a chance to see that. Did you change a field you didn't want to or accidentally delete half your data? You'll probably spot that. By contrast, working through a database access program can literally make your accidents invisible since you often don't see the post-change or post-addition records.

The two aspects combined are great for avoiding accidents and fixing them when they happen during modifications (provided that you notice at the time). This goes especially well with version control, not just because version control lets you revert things but also because it can explicitly show you what you changed. Databases, well, databases don't do diff very much without a lot of outside assistance.

programming/WhyEditorsForDBChanges written at 01:11:47; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.