Stuart Wright
Well-known member
Prompted by the new thread types in XF2.2, I'm reflecting on the method of structuring data for addons going forward.
In lots of addons we currently have a table to store content (e.g. resources) plus an associated discussion thread.
Each entry in the database effectively has two rows (e.g. resource + thread) instead of one (thread only).
We use this method in the competitions addon, for example, where we have a row for each competition and a thread to go with it. I know there are many other examples of functionality which do this, and it seems to be a standard.
However, there are some obvious disadvantages in doing it this way.
Can this not all be achieved (in some scenarios) using a new thread type and custom fields?
Do as much as possible using threads and avoid creating at least one additional table?
I'm sure other people must have considered this.
There are probably multiple tables used in the Resources addon (I don't know, I've never had cause to purchase it), and this is where my suggestion gets a bit more complicated.
With our competitions addon, for example, we have a couple of tables. One for competitions and one for competition entries. We'd still need to keep the table for competition entries. But with custom fields, there is nothing really stopping us from ditching the competitions table and doing everything using custom thread fields.
The competition itself would be a thread (like an article thread) and the competitions home page would be a list of competition type threads with custom field information displayed.
Granted there might be a lot of custom fields. But does this really matter? Maybe it would actually be slower to deal with lots of custom fields?
Putting this out there as a general suggestion for addon developers and the Xenforo team.
What do you think?
In lots of addons we currently have a table to store content (e.g. resources) plus an associated discussion thread.
Each entry in the database effectively has two rows (e.g. resource + thread) instead of one (thread only).
We use this method in the competitions addon, for example, where we have a row for each competition and a thread to go with it. I know there are many other examples of functionality which do this, and it seems to be a standard.
However, there are some obvious disadvantages in doing it this way.
- you (often) have to maintain the thread when you add/edit/remove the associated content. Maybe you have to change the content of the first post or add replies to the thread.
- you effectively have two pages on the site containing similar (or the same) content, which is not good from Google's perspective.
- you have tabs linking the content and the thread.
- you have an additional table in the database.
- you have to query more tables.
Can this not all be achieved (in some scenarios) using a new thread type and custom fields?
Do as much as possible using threads and avoid creating at least one additional table?
I'm sure other people must have considered this.
There are probably multiple tables used in the Resources addon (I don't know, I've never had cause to purchase it), and this is where my suggestion gets a bit more complicated.
With our competitions addon, for example, we have a couple of tables. One for competitions and one for competition entries. We'd still need to keep the table for competition entries. But with custom fields, there is nothing really stopping us from ditching the competitions table and doing everything using custom thread fields.
The competition itself would be a thread (like an article thread) and the competitions home page would be a list of competition type threads with custom field information displayed.
Granted there might be a lot of custom fields. But does this really matter? Maybe it would actually be slower to deal with lots of custom fields?
Putting this out there as a general suggestion for addon developers and the Xenforo team.
What do you think?