开发者

customize initial data issue and solution

I want to design an object for loading and showing customized data, for example, the object firstly loads all employees in dat开发者_开发问答abase, then look up whether login user in the list, if so then show the login user, otherwise show dummy data "all employees"(means null). But another scenario is the component should "remember" last time user selected data and show in another page, any good design suggestion?


You describe four major pieces of function:

  1. checking the user against a list
  2. identifying one of two scenarios
  3. remembering selected data
  4. using the remembered selected data

Overall I don't think you've decomposed the problem enough yet to start thinking about design patterns - patterns become important once you've identified some candidate classes and start to look at how to decouple them. So my next step would be to design some classes to do these 4 tasks and then critically example the resulting Object model, see whether refinement is needed. THe first step: identify classes with clear interfaces and responsibilities.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜