let us use a hero as an example. A hero has a name, hp, exp, level etc:
Rohane
69/420
14,230
18
Parsing is expensive, so any one piece of data is grabbed only once per page.
What I did before:
- Parse page for data as a plain string
- Dump the strings onto the gui to display
So what it would have looked like before:
Parser <-> Gui
When the strings are dumped directly it is relatively fast and efficient, but it is not flexible, parser had to send specific pieces of data to specific places on the gui.
The strings being dumped are stuck on the gui once dumped, retrieving for it to examine afterwards would be difficult.
The strings themselves don't have any meaning, they only have meaning because you see it in context of other strings and can derive meaning from it, for example if I showed you three strings:
"123/324", "69/420", "132/314"
You could guess that they are hp of heroes, but without context you don't know exactly what they mean, or whose it is.
What I do now:
- Parse page for data as plain strings
- Create a object to represent a concept (Hero)
- Attach that string to the object as one of its properties (hp = "69/420")
- Centralize these representations in one location for convenient access
- Gui can access these representations and interpret them individually
So what it would look like now:
Parser -> Data <-> Gui
But now it doesn't have to only be a gui that is attached to the data, you can plug something else into it as well to interpret the data from the middle layer:
Parser -> Data <-> Script
Or plug multiple things at once
Parser -> Data <-> Gui
<-> Script
<-> Your email
<-> Your phone (Mobile client??!!?!?)
As you can imagine, with the extra steps, and with having to create representations, the program is slower than before.
But as you can see also, that it is now more flexible than before.
Of course, this is what I have for now, there might be better ways to do this that I am not aware of, and I will gladly change it in to a better way when I find one.
And also, this is why previous versions are still available, if you find that you don't like/need additions in newer versions, you could always use an older version.
Edited by Nonexistent, 10 July 2016 - 06:42 AM.