I'm trying to implement an application using node.js and other related technologies. Heading from java land polymorphism but natural, but for the classical programmer node works differently.
The application will load new code during run-time provided by the user. In order for the main core to use this code "we" need to agree on some kind of a convention. Knowing how new Node is I wasn't that surprised that I didn't find the answer. The problem is this issue is rather vague in JS too.
Requirements:
- Strong decoupling.
- loading new code in run-time.
- The solution should be applicable so I can share as much code as possible with the browser.
Update:
- I did fiddle around with duck-typing, I've also encountered ideas from Clojure in regards to protocol based implementation.
- I would appreciate some code in the answer.