I'm writting a .NET application that implements different design patterns. I have an idea to write singleton + flyweight pattern example. Let's imagine I have remote database with Pizzas & ingredients. My idea is to: on app start I would download all Pizzas and Ingredients and keep them in flyweight pattern class. Thanks to this I hope to achieve some memory save.
Moreover:I'd like to implement Singleton pattern, so the download objects are accessible without asking database. Won't this save me time, while accessing database?
Now I would only have to insert orders into database without asking for data.
Please tell me if this explanation for singleton & flyweight is reasonable.
Aucun commentaire:
Enregistrer un commentaire