Section 1

Preview this deck

Explain how Node is Async, single-threaded non-blocking with a metaphor.

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (18)

Section 1

(18 cards)

Explain how Node is Async, single-threaded non-blocking with a metaphor.

Front

A restaurant has a waiter which receives an order (request) from a customer (client), the waiter will take the order and hand it to whoever can process the needed task (barman or chef), the waiter can then take another order from another client. The waiter is the thread. The chef is the event queue that picks up, processes and removes orders when they are signaled / arrive.

Back

Define 6 main powers of using Node

Front

1. It's ridiculously fast (one of the fastest). 2. It's super fast to develop applications compared to other frameworks. 3. Due to it being asynchronous and non-blocking by default, it scales extremely well. 4. Largest ecosystem of open source libraries. 5. You can achieve more with less code. 6. You can use one language across the stack.

Back

What is nodes main general use?

Front

It allows the creation of backend/server based applications in JavaScript.

Back

What do events consist of? The event name itself and arguments pertaining to those events.

Front

What do events consist of? The event name itself and arguments pertaining to those events.

Back

What is a Module?

Front

Any JS file in a Node application is a self containing module (similar to classes), which is also parsed as a JavaScript object.

Back

What does emit mean? 'make a noise / produce something'. An event is emitted. .emit()

Front

What does emit mean? 'make a noise / produce something'. An event is emitted. .emit()

Back

Why is Node good for I/O intensive apps and not CPU intensive apps?

Front

Node only has a single thread, which is blazing fast at delegating 'tasks'/'events' to be processed by other resources such as I/O, but CPU intensive tasks use CPU threads to process tasks, where there is only one.

Back

How are global objects made available in each node module file?

Front

Due to Node using IIFE's it passes in 'exports', 'require', 'module', __filename, __dirname)

Back

What is a core pillar of Node? Events. What is an event? A signal that is emitted when something happens.

Front

What is a core pillar of Node? Events. What is an event? A signal that is emitted when something happens.

Back

What is an event listener?

Front

A function that listens for and performs something when an event is picked up. In Node, they are callbacks.

Back

True or False (justify): Node is framework or language.

Front

False. It is a Runtime environment that allows us to execute JavaScript.

Back

What's the entry point or main module in a Node app? The Main JS file / Module, usually app.js

Front

What's entry point or main module in Node app? The Main JS file / Module, usually app.js

Back

How do we import a module into another module? Use const myModule = require('./path');

Front

How to import a module into another module? Use const myModule = require('./path');

Back

What is the difference between an interpreter and compile?

Front

A compiler 'converts' and 'minifies' all the code in a codebase at once and an interpreter does it line by line as it's executed.

Back

How do you give objects or functions the ability to emit events? Inherit from the EventEmitter class, and emit the event where necessary.

Front

How do you give objects or functions the ability to emit events? Inherit from the EventEmitter class, and emit the event where necessary.

Back

What can cause JS to behave differently across different browsers?

Front

They have have their own JavaScript Engine. (Edge: Chakra, Chrome: V8, FF: SpiderMonkey)

Back

How can we import a built-in node module or a module inside node_modules?

Front

const fs = require('fs');

Back

Much of Node development involves listening for an event and reacting to it when one is emitted.

Front

Much of Node development involves listening for an event and reacting to it when one is emitted.

Back