jeudi 30 janvier 2020

How to do Design Patterns for files and persistency on applications?

I have an application that used Ionic Storage to store flags and other simple objects used in the system.

Over time the application grew and the objects became bigger and demand more and more.

I would like some Design Patterns suggestions for handling files in Ionic.

In version 3, there was a defined "halt" in AppComponent, where I started all the critical services and storage, now on v4, I had to create a SplashComponent that "holds" until all services are started. I'm switching to files so things started to enter in the uncanny valley.

The diagram below explains it better:

Before (Ionic 2)

AppComponent.ts platform.ready() -> Start Services and prepare Storage -> After all set-up assign a page to rootpage and voilà app good to go

NOW (Ionic 4)

AppComponent.ts platform.ready() -> routing leads to a SplashPageComponent(Page) Basically all methods wich prepare stored are here. As they're all asynchronous I made an "access lock". A big if() checking a boolean for every method

if(method_1_lock && method_2_lock && method_3_lock...)

The core of my application is a gamified questions app, with progress save, as well as a system of achievements.

I didn't put my code itself, because I'm not exactly needing the coding, but the idea of how to do things.

Should I put user settings on file? on memory? Should I use a splash screen, should I start it all on Home? This kind of things.

Every single tutorial on internet are about actually DOING things, but quite few are about thinking on how and how well do a few things...

Any help?

Aucun commentaire:

Enregistrer un commentaire