dimanche 23 septembre 2018

Singleton & "sequential execution" design patterns

I'm implementing a game library for mobile using Singleton design pattern as below

Game.initialize("game_id")
.downloadMap()
.showMap()
.setAutoAdjustMapResolution(true)

I have no problem with Singleton & Builder design pattern but my problem is

downloadMap() -> need to wait until initialize("game_id")
showMap -> waits until downloadMap() finishes
showMap -> depends on setAutoAdjustMapResolution(true)

I don't know what kind of design pattern I can apply in this case I'm thinking of Chain of Responsibility but no sure

Please give me your idea or advice. Thank you

Aucun commentaire:

Enregistrer un commentaire