Monday, May 28, 2012

Initial Connection Model Implementation

Hey all, this week I've been discussing the requirements and details of the model that I'm going to be using to represent both invitations and requests between an organization and a user. We've decided on using a model called GSoCConnection containing reference properties to the organization and the user involved in the request or invitation. Within this model also resides "private" properties to represent the actions taken by either a user or an organization. For example, a user sending a request to become a mentor will cause the user state to become 'mentor_request_accepted' and the org's state to become 'mentor_request_pending', since we'll be waiting on a response. If the org accepts, their action will be changed to 'mentor_request_accepted' and the calling class will be able to call the is_mutual_acceptance() method in order to determine whether the user needs to be promoted.

Right now I've thought up as many states as I think are relevant and added them to my GSoCConnection class as constants with methods to allow for changing the state. Another approach I've been toying with is just writing out methods for each of these to encapsulate some of the logic for determining the states and chaining them with an internal set_state method. I'm going to discuss this idea with Daniel this week and possibly discuss alternatives.

The code for my first implementation of this model can be found here (not the most elegant way to share code, I know). See you next week!

Update: Changed the pastebin link to reflect change to method names per style guide and changed my strategy for supporting states

No comments:

Post a Comment