lundi 5 janvier 2015

Is Proxy or state design pattern or perhaps iterator pattern more suitable in this case?

In my application, all operations that are done are on the currently selected object which makes me think state design pattern is best fit. However all objects that are selected on by one are essentially the same so there is really no difference in each state except the item is just a different one.


My situation is a lot like directory structure. I have a collection of folders where each folder may have a different number of files but it is still a folder. Whatever folder is selected, user can only see contents of that folder or add files. My program also iterators through all folders (assume one level) and shows content of all files under the folder.


I am confused, how should I maintain the current state (=currently selected folder) in my application?


Aucun commentaire:

Enregistrer un commentaire