I am torn between to DRY and loose coupling :(
I have two sites which you can link your account and then the sites can share data (via a RESTful api...)
one site is a media aggregation site and the other is a media store where people can buy digital media (music/photo/video).
My boss wants to emulate the itunes store and have a built-in store in the aggregation site where people can buy the stuff they like and have it added to their account automatically.
I have 99% of the templates and views (django) written for the store site, that I would need to display the content on the media site.
Should I just render the templates and deliver pre-rendered html (via api) to the media (aggregation) site, (and obey DRY) or should I deliver json to avoid tightly coupled custom templates on the store side?
Or maybe a hybrid design would work better? deliver pre-rendered chunks of html (like a top 10 products in a <ol>
) and let the media site request the chunks it needs?
The hybrid design seems most promising to me (right now), but will probably result is a lot more api calls (and therefore more database queries)
What do you think?
edit - A new idea: (as seen in the comment) What do you think of having the store site loaded up with some custom css into an iframe?
I think that should eliminate confusion, reduce the amount of tightly coupled code to 2 of 3 dozen lines or so, and save me the massive headache of maintaining two sets of templates that are almost identical.