I'm struggling with thinking of how to implement the following (in java):I try to create a program, that displays information about lots of tv series. For this i use the website Burning Series (https://bs.to) (I don't use or want to use this site for streaming tv series illegally over one of the hosters! Instead i just want to fetch the series most important information). The user should be shown a gui, containing a list of all series on the left, and on the right side the more detailed information about the clicked series (Description, Seasons, Episodes, etc.). I don't need help with that part, but rather with how to store the needed information for a series in classes.My current implementation consist of 4 classes. A SeriesInfo, for storing just the name and the url from where to fetch the additional data if needed. I thought that all my SeriesInfo's should be shown in the series list on the left side of my window. The next is my Series class for storing the actual series with it's actors, directors and seasons (in a List). Then, as mentioned, my Season class wich in turn contains a list of episodes (List) and it's season number. And my last class called Episode which contains it's id, title, english title (I'm german so title means the german title), and it's description.At first I thought, i could just download the whole series information, when the user clicked on it's item in the list. I quickly noticed that it takes a long time to establish all the connections to every webpage of every episode (On Burning Series every episode has it's own page and that's the only place where i can find the description of that episode). I tried to load all the information about One Piece as a stress test for my program which took around 320 seconds! Thats way too much.I thought about another approach. I came to the result, that I should download, for example, the description just when needed. Now I'm uncertain how to implement this the best way.I thought about creating a class, just like java's optional, which would represent content which may not be downloaded yet. If information is requested it would start downloading. But that doesn't seem right. Every part of my code which would be dealing with a series object would have to do several if checks, to know if the episodes are actually downloaded and useable at the moment. I need to download my information asynchronously, so that the rest of my program continues it's work. Also somehow I would have to implement a callback which would, once the download finishes, insert the fetched info into the textboxes and labels.If you have any good ideas to accomplish this task, or know some completely different approach, please let me know.
Downloading information, but just when needed
java;design;async