More fields or more complex filters - which is better

I have several types of tiddlers, say, Articles, Notes, Contacts, etc. I use tags to indicate these.

I also use fields extensively in my TiddlyWiki.

Some field names are generic, say, category. It can apply to almost all types of tiddlers.

There are two approaches possible:

  • Have a separate category field for every tiddler type. So, there will be article-category, note-category, contact-category. And use a relatively simple filter.
    <$list filter="[contains:article-category<currentTiddler>]">

  • Or have only one category field but use a more complex filter to select the tiddlers we want.
    <$list filter=[contains:category<currentTiddler>tag[Article]]>

To my mind, this is a trade-off between storing more data (more number of categories) v. having to do more processing (more complex filters). But I may be wrong.

As a design stratgy, which is better and why?

A wise lady once told me: leaving one man for another, you’re just exchanging tens. Ten good things for ten bad, and ten bad things for ten good.

The best design strategy is the one that suits you the best.

Whatever trade-offs from a technical perspective, I see them as irrelevant.

2 Likes

My thoughts;

Tags are a list field, I try and reserve them for ad hoc use. When I think of categories, I think of multiple-categories but each tiddler has only one. If I want to have multiple values I would create a keyword or subject list field that can contain multiple values ie they are a list just like tags.

So to me fixed in my mind a category field has one of many values and a subject in one tiddler may have many subjects. I also consider a field having more than one value, as a list, and usually prefix it as such “-list”.

Finally where possible rather than just allow a list of tiddlers in a list field, I write my macros so it can also contain a filter which may itself expand the list further. Which I may call a filter or a filter-list.

Oh,

To treat a field as a lists there are the list ops operators, however with my recent use of the select widget with the “multiple” parameters allows you to selectively add and remove items in a list field easily.