Android Question B4x Best Practice for downloading and parsing Objects

jamesnz

Active Member
Licensed User
Longtime User
This is a generic question about the responsibility of a class in downloading and parsing it's own members
and if this is considered good practice.
I have a now large program that downloads multiple objects from the internet and saves them into lists
I am trying to keep my main class as "clean" as possible.
My classes are mainly structures and I store global lists of such objects in either main or starter.

Should the class contain the code that downloads the objects from the internet, and should the parsing be done inside the class, which means instantiating an object of a class just so I can downloading and parsing such objects and them add them to a global list, or should I define another class for downloading and parsing.

I had thought about a code module but these can't handle events such as jobdone
 

William Lancee

Well-Known Member
Licensed User
Longtime User
That's true, but service modules can handle what you need to do. You can have any number of these to organize your code.
 
Upvote 0

jamesnz

Active Member
Licensed User
Longtime User
so Ive made a class called datamanager, with functions and event handlers
Ive dimmed it under process Globals and initialised it in starter under service_Create
if I want to access those functions from main do I use callsub delayed ?
I have tried dimming another class under main ( so I can access) but this is a a different instance of the class than the one initialised under starter class , right ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…