How can I refactor client side functionality to create a product line-like generic design?
- by Nupul
Assume the following situation similar to that of Stack Overflow: I have a system with a front-end that can perform various manipulations on the data (by sending messages to REST back-end):
Posting
Editing and deleting
Adding labels and tags
Now in the first version we created it well modularized but the need as of now for 'evolving' the system similar to Stack Overflow. My question is how best to separate the commonality and how to incorporate the variability with respect to the following:
Commonality:
The above 'functionalities' and sending/receiving the data from the server
Look and feel (also a variability as explained below)
HTTP verbs associated with the above actions
Variability:
The RESTful URLs where the requests are sent
The text/style of the UI (the commonality is analogous to Stack Overflow - the functionality of upvotes, posting a question remains the same, but the words, the icons, the look and feel is still different across sites)
I think this is entirely a client-side code organization/refactoring issue. I'm heavily using jQuery, javascript and backbone for front-end development.
My question is how best should I isolate the same to be able to create multiple such aspects to the tool we are currently working on?