views:

18

answers:

1

Suppose you have a profile for an application. This profile stores some data specifically about one user. You can persist the details of the profile and pull them back each run.

Does a profile make a good candidate for the State pattern? If not, is there a good heuristic to model this sort of functionality?

A: 

State design pattern works in case of number of internal states through which your object pass so state design pattern is not applicable here.

You may only need a profile class with respective properties and a DTO object which can store profile object and retrieve it.

It'snot necessary to use a design pattern in a certain problem IF you have small and simple design , implement simple design it will definatley gives you more control over your design.

saurabh