-
-
Notifications
You must be signed in to change notification settings - Fork 223
Code coach modularize #1396
Code coach modularize #1396
Conversation
Was there from an experiment with code/output side/side
# Conflicts: # runestone/activecode/css/activecode.css # runestone/activecode/js/activecode.js
|
I stress-tested the deterministic output with a TestCoach that just waited a random amount of time before returning a set string. Works as intended when there are multiple coaches taking variable amounts of time. |
| let code = await this.buildProg(false); | ||
| let results = []; | ||
| for(let coach of this.codeCoachList) { | ||
| results.push(coach.check(code)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a method to add a coach? If I'm thinking about the future and adding a new coach I would want to have a method to do that so I don't have to modify this code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No one should have to touch that code.
Coaches are added up in the constructor (line 143). I'm not sure where else they would be injected from - that was one of my questions. I don't have a good sense of how to make creating coaches more modular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, can't figure out how to quote in those lines without starting a new conversation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was imagining a method on the Activecode instance, but then I'm not sure what other object would call it, so having it in the constructor is fine for now.
|
Updated to filter import * related warnings from pyflakes to avoid scary warnings in existing books. |

Coaches are added to a list during ActiveCode construction.
runCoaches function is triggered on program run. It asynchronously runs all coaches, but then waits for all results so Code Coach div can display any coach feedback deterministically in the order coaches were created.
Questions/Comments: