-
Notifications
You must be signed in to change notification settings - Fork 31
Conversation
synchronous versions to help with this approach. | ||
|
||
An example where synchronous programming might be OK is when writing a | ||
commandline script. Often these scripts run a series of steps one-by-one and |
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.
"commandline" probably isn't a word on its own. Maybe "command line" or "command-line"?
Thanks @bengl for the feedback. I tried to address both your points. |
Alright this gets a 👍 from me. Can we get another another reviewer from @nodejs/documentation on this? |
------------------------- | ||
Asynchronous programming is any technique in which the result of an operation | ||
is available outside of the normal synchronous (statement by statement) flow | ||
of code in a program. |
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.
As a document for beginners, it might be best to lead with a more concrete example of the problem we're trying to solve before introducing the solution.
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.
Sounds good. Would you say the problem we're trying to solve is "synchronous programming" or "misunderstanding about asynchronous programming"? (The later is much easier to demonstrate/explain I think 😄 )
This is a first attempt at describing asynchronous programming in node.js. It attempts to at least mention all considerations. It also attempts to present experience and best-practices when such are clear. This fixes issue #20.
OK, I think/hope I've addressed all feedback, and this is ready for another round of review. |
Hey @drewfish can you resubmit this against https://github.com/nodejs/nodejs.org ? |
@bengl submitted as nodejs/nodejs.org#422 |
|
||
// Another approach is to bind the function to the specific desired | ||
// context. | ||
setTimeout(this.increment.bind(this), 300); |
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.
doesn't setTimeout just take a this
parameter?
Closing this since we won't be merging this into this repo, but probably |
This is a first attempt at describing asynchronous programming in node.js. It
attempts to at least mention all considerations. It also attempts to present
experience and best-practices when such are clear.
This fixes issue #20.