This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am using the restlet framework. I have a resource called Person. This person has the following fields :
a person could be either a teacher, a programmer, or a doctor.
According to the job type, the person will have a set of properties. For example, if a person is a teacher, he will have the following properties :
- teaching hours
if a person is a programmer, he would have the following properties :
the question is, when I want to post a new person, should I post the person(name,age,job) to the following url :
and then post the properties to one of the following ( according to his job )
Personally, I would choose the latter approach since a teacher, a doctor and a programmer are all persons and should be treated in the same manner as such.
I would consider adding a "role" property to the base Person resource. Depending on what the clients accessing the service want for kind of data, I would also consider adding a Teachers, a Doctors and a Programmers resources. Adding these resources would also make it possible to create a Person by POSTING to, for instance, the Teachers resource.