Monday, July 13, 2009

Sixth/Seventh Week Status Update

It appears as though there are now some diffs about which week we're on! Depends on whether we're indexing from 0 or 1?

This week I find myself working on two different tasks with a very similar theme.

The first task is in the News Feed module. When we generate a feed item, we're doing it on the logic side. the onCreate, onUpdate, and onDelete hooks that are used to create the feed item is in the model logic layer, and the feed item process itself (now being converted to a scheduled Task) is also in the logic layer.

However, the payload for a certain feed item requires access to view params in many cases so that model-specific payload templates can be re-used to render the payload for the activity item.

And you could say, "yes logic can't retrieve from view, but isn't the view retrieving from the logic anyways?" This is true, and this is why normally this is not a problem. But the problem arises when the view for one model type (site) wants to access view params for another model type (document, or survey).

This is also a challenge for the view for org admins to view the results from the manage a student project page. In this situation, the view model is for StudentProject, but the most obviously DRY approach would be to also instantiate a view class for survey view models so that we could render a list of ProjectSurveys or GradingProjectSurveys.

Short version: the view layer seems somewhat impenetrable from the logic layer, as it is tied up in the HTTP request. As a view should be. But what do we do about these edge cases?

I've been impressed with the orthognalness (is that a word?) of Melange, so it's entirely possible that I haven't yet figured out how to properly instantiate a view from the logic -- or why I don't want to do that in the first place.


On an unrelated note, another good learning experience has been in how I've been thinking about privacy in regard to how news feed activity can be consumed. While at first I was mostly alright with the idea of generating a hash key for hard-to-guess URLs. But the news feed activity is mostly HTML, content, and key words. In other words, if we're not careful, it could very easily end up crossing paths with a robot (edit: not if we set our robots.txt correctly!).

No comments:

Post a Comment