|
| 1 | +## Description |
| 2 | + |
| 3 | +Purpose: learn how to create sandboxed context for modues to separate them and |
| 4 | +minimize cross-modules code coupling, extracting at least two abstraction layers |
| 5 | +(applied and system) and how to execute applied code in virtual environment, |
| 6 | +changing its behavior using IoC from system layer. |
| 7 | + |
| 8 | +## Files |
| 9 | + |
| 10 | +* `framework.js` - small piece of the framework, just to demonstrate IoC |
| 11 | +* `application.js` - small piece of the application, also for IoC demonstration |
| 12 | + |
| 13 | +## How to execute |
| 14 | + |
| 15 | +From the command line, type: `node ./framework.js` or `node framework` |
| 16 | + |
| 17 | +## Tasks |
| 18 | + |
| 19 | +You may select at least one of the following tasks, make a fork of this |
| 20 | +repository and implement your solution there. If those tasks are simple |
| 21 | +for somebody, please see additional tasks below. |
| 22 | + |
| 23 | +1. Add `setTimeout` and `setInterval` to the application context and use them |
| 24 | +printing something from the timer function using console.log() |
| 25 | + |
| 26 | +2. Inject a link to `util` library into the application context and make a few |
| 27 | +calls to its functions from applied code |
| 28 | + |
| 29 | +3. Implement the ability to run different applications inside framework, using |
| 30 | +command line option, e.g.: `node framework <applicationName>` |
| 31 | + |
| 32 | +4. Wrap or intercept `console.log()` call to add more info into console output |
| 33 | +in the following format: `<applicationName> <time> <message>` |
| 34 | + |
| 35 | +5. Wrap or intercept `console.log()` in the sandboxed application logging all |
| 36 | +console output into a file in the format: `<applicationName> <time> <message>` |
| 37 | + |
| 38 | +6. Give a link to `require` function to the application, add call to it and |
| 39 | +wrap it for logging to a file in the format: `<time> <module name>` |
| 40 | + |
| 41 | +7. Export a hash from `application.js` with multiple functions and variables, |
| 42 | +print the list with types from framework |
| 43 | + |
| 44 | +8. Export a function from `application.js` and print its parameter count and |
| 45 | +source code from the framework |
| 46 | + |
| 47 | +9. Print a list of everything from the application global context (application |
| 48 | +sandbox) with the data types specified |
| 49 | + |
| 50 | +10. Compare an application sandboxed context keys before application loaded and |
| 51 | +after, print it from the framework and find a difference (keys added / deleted) |
| 52 | + |
| 53 | +## Additional tasks |
| 54 | + |
| 55 | +11. You can combine several tasks (listed above) in your code, implement a more |
| 56 | +complex example of interaction between framework and application, preparing |
| 57 | +run-time environment (sandbox) and/or improving CLI (command line interface) |
| 58 | + |
| 59 | +12. Implement a similar example in another programming language |
| 60 | + |
| 61 | +13. Improve and/or optimize Impress Application Server code, specifically |
| 62 | +everything related to sandboxing, see: |
| 63 | +[/lib/impress.application.js](https://github.com/tshemsedinov/impress/blob/master/lib/impress.application.js) |
| 64 | + |
| 65 | +14. Use IoC and code isolation principles using sandboxed context and/or other |
| 66 | +similar technique in your projects (any technological stack) to demonstrate its |
| 67 | +use and the effect of such use |
0 commit comments