Clicks For Ticks#306
What’s the difference between operational and programmer errors?
— Operational errors, which are anticipatable, unavoidable errors, even in correct programs (e.g., failing to connect to a server), and programmer errors, which are bugs in the program. In general, using throw and expecting a caller to use try/catch is pretty rare expect for JSON.parse
What is ‘event-driven’ programming?
— In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads. Event-driven programming is the dominant paradigm used in graphical user interfaces and other applications (
What are ‘worker processes’?
— Worker processes provide the execution environment for all web sites and applications configured in IIS (Internet Information Services). Valuable information such as CPU utilization and memory footprint can be obtained from the API to help monitor the health of worker processes and the web server. The /api/webserver/worker-processes endpoint lists all the worker processes that are currently running.
Describe how Node.js can be made more scalable.
— If you find yourself asking why node.js application is scalable?, one of the major reasons is asynchronous processing. The main design principle which makes apps made in Node scalable is processing requests asynchronously. Whenever there is any background activity than needs to be handled for a request, Node delegates the required work e.g. File I/O or network I/O and goes on to handle another request, providing non-blocking I/O. Once the work is done, Node passes the processed data to the client.
Single threading in handling requests
— Almost all other platforms create new threads for each request. This can reduce performance and cause scalability issues. This is due to factors such as thread initialization and termination overhead. Node differs from other platform such as PHP, J2EE and .NET in that a single thread handles client requests.
— For any client request, Node listens to requests, hands over work to worker threads and is ready to accept new requests. Once the worker threads are done processing, the worker threads return their results to the main thread. The results can be sent to the request and processed further. This mean there is no context switching and makes it great for applications that are highly concurrent.
Explain global installation of dependencies.
— Install the dependencies in the local node_modules folder. In global mode (ie, with -g or — global appended to the command), it installs the current package context (ie, the current working directory) as a global package. By default, npm install will install all modules listed as dependencies in package.
- Global installation of dependencies is stored in /npm directory. While local installation of dependencies stores in the local mode. Here local mode refers to the package installation in node_modules directory lying in the folder where Node application is present.
- Globally deployed packages cannot be imported using require() in Node application directly. On the other hand, locally deployed packages are accessible via require().
- To install a Node project globally -g flag is used.
Explain RESTful Web Service.
— RESTful Web Services are basically REST Architecture based Web Services. In REST Architecture everything is a resource. RESTful web services are light weight, highly scalable and maintainable and are very commonly used to create APIs for web-based applications.