Skip to content

Commit 81e094a

Browse files
committed
Add tasks
1 parent a312a39 commit 81e094a

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

JavaScript/Tasks.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Strategy tasks
2+
3+
1. Extract strategy selection mashinery from `3-function.js` to reuse it for any strategy of certain format:
4+
- Implement `selectStrategy(strategy, name)` returning function
5+
- Reading certain behaviour from `strategy` collection do not use technique like this `renderers[rendererName] || renderers.abstract`
6+
- Try to get `strategy` collection keys and check required key; in collection contains no key use `abstract` instead
7+
2. Rewrite example from `3-function.js` to decouple strategy implementation and `console`
8+
- Resurn `string` from all strategy implementations
9+
- Here is an example: `console.log(png(persons))`
10+
3. Make high level abstraction from `5-agent.js`:
11+
- Now we have `registerAgent(name, behaviour)` and `getAgent(name, action)`
12+
- Create `Strategy` class:
13+
- `constructor(strategyName: string, actions: Array<string>)`
14+
- `registerBehaviour(implementationName, behaviour)`
15+
- `getBehaviour(implementationName, actionName)`
16+
4. Prepare ESM or CJS module for `Strategy`
17+
- Add .d.ts typings
18+
- Add tests and cases
19+
5. Rewrite strategy from classes to just module exporting interface:
20+
- `createStrategy(strategyName: string, actions: Array<string>)`
21+
- `createStrategy` will return `{ registerBehaviour, getBehaviour }` without class syntax
22+
- Module contains a collection of strategies
23+
- Strategy (closure) contains a collection of `implementations`
24+
- Implementations (struct) contains a collection of `actions`

0 commit comments

Comments
 (0)