Abbreve
Abbreve copied to clipboard
[FEATURE] Improve on structure for db
Description
The current structure of db looks like:
[abbreviation]: {
definition: string,
alternatives?: string
}
which is good, but we can improve on the structure by making the alternatives
prop required and an array. So the new structure now becomes:
[abbreviation]: {
definition: string,
alternatives: string[]
}
Using the proposed structure gives us the possibility to add other features, such as linking related abbreviations and other benefits as the app grows
Below is an example showing the current structure and how it would look like after implementing the proposed structure BEFORE:
{
"lgtm":{
"definition":"Looks Good To Me",
"alternatives": "Looks Great To Me, Looks Great To Merge"
},
"lfg":{
"definition":"Let's Fucking Go",
"alternatives" : "Life Feels Good, Looking For Group"
},
"idk":{
"definition": "I Don't Know"
},
"imo":{
"definition": "In My Opinion"
}
}
AFTER:
{
"lgtm":{
"definition":"Looks Good To Me",
"alternatives": ["Looks Great To Me", "Looks Great To Merge"]
},
"lfg":{
"definition":"Let's Fucking Go",
"alternatives" : ["Life Feels Good", "Looking For Group"]
},
"idk":{
"definition": "I Don't Know",
"alternatives": []
},
"imo":{
"definition": "In My Opinion",
"alternatives": []
}
}
Screenshots
No response
Additional information
We can even further improve on the structure to include more information like so:
[definition]: {
definition: string,
contexts: string[], // Check explanation at the bottom
alternatives: {
definition: string,
contexts: string[] // Check explanation at the bottom
}[]
}
Example:
{
"lgtm": {
"definition": "Looks Good To Me",
"contexts": [
"chat",
"conversation"
],
"alternatives": [
{
"definition": "Looks Great To Me",
"contexts": []
},
{
"definition": "Looks Great To Merge",
"contexts": [
"collaboration",
"teamwork"
]
}
]
},
"lfg": {
"definition": "Let's Fucking Go",
"contexts": [],
"alternatives": [
{
"definition": "Life Feels Good",
"contexts": []
},
{
"definition": "Looking For Group",
"contexts": []
}
]
},
"idk": {
"definition": "I Don't Know",
"contexts": [],
"alternatives": []
},
"imo": {
"definition": "In My Opinion",
"contexts": [],
"alternatives": []
}
}
Explanation:
The contexts
field is an array of contexts in which the abbreviation is mostly used.
Notes:
Automatically, all alternatives under each abbreviation fall under the contexts provided for the main definition
e.g
Both Looks Great To Me
and Looks Great To Merge
fall under chat
and conversation
contexts since they are both alternatives to the Looks Good To Me
definition
DISCLAIMER! The items I used for each context are just for demonstration purposes.
I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives.
I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice:
I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives.
I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice:
Making the alternatives
prop required promotes a consistent data structure.
And if the abbrev doesn't have any alternatives, you pass an empty array
I think it makes sense to make Alternatives an array. I would pass on making it required though, since some abbreviations may have no alternatives. I like adding contexts, this will require a UI update to make it beneficial. Maybe something like the following, with the text adjusted slightly to increase readability and separate it from being confused with alternatives would be nice:
Making the
alternatives
prop required promotes a consistent data structure.And if the abbrev doesn't have any alternatives, you pass an empty array
Gotcha, makes sense then. :)