Last post Feb 22, 2017 11:36 PM by PatriceSc
Feb 07, 2017 01:55 AM|rocket.net798|LINK
I have a music store application and it is used in various locations. Most of the locations have same defaults but there exist few remote regions with regional specifics and need to overwrite the defaults. Details below
Default Language = English
Popular Music = Pop
Default Language = Spanish
Popular music = Rap
Default Language = Italian
Popular music = Jazz
When a Music store user logs in to the app, by default the global data is loaded into the class and then verify if user's data has to be overridden with his regional specifics. I could do this simply by loading the global defaults and then verify if the
user has local specifics and then overwrite the global defaults using simple sequence of statements and if conditions. But curious to know if I could use a best OO pattern.
Feb 07, 2017 03:55 AM|kaushalparik27|LINK
I am unsure about any OO pattern, but Cookies can be a good alternative here in this scenario.
Feb 22, 2017 11:36 PM|PatriceSc|LINK
Not sure how it relates really to OOP but I would do this the other way round ie trying to load specific data and then loading global if not found. This way you loaded always data you actually need (rather than loading something you then immediately override)
and will have 1 or 2 queries (rather than always 2 even if the 2nd one doesn't return anything).