Class 14

Amanda Rush
2 min readOct 18, 2021

1. Tell me about a project you’re particularly proud of. What did you do that worked out well?

One of the projects that we worked on was a javascript app that called an external API to retrieve data. I called an API that provided decks of cards and the ability to shuffle and draw that deck and built the card game Go Fish. It was really challenging and made me think about code structure and organization in new ways. I tried to break each task into its own function and keep each of the functions small and manageable. Then I could call the functions throughout the program as needed. It also helped to reduce redundant code since I was able to call the same function multiple times when it was appropriate.

2. How do you do testing, and what do you think about it? How would you improve QA?

We worked on testing using Mocha. I found it really helpful to know if your calls were always producing the correct output instead of guessing if your logic was correct. I could think about pieces of my application that were fundamental to it performing correctly, and test those things to make sure there wasn’t a bug in my code.

3. What tools do you use to find a performance bug?

In node I print out the errors to the console so that I can see what went wrong if I have an error. I also use the developer tools to see if any of my calls didn’t execute. I can look at the network tab in the developer tools to see how long calls take and decide if I need to make any code changes based on that.

4. What is the preferred method of resolving unhandled exceptions in Node.js?

If you are using promises, you would use the .then and .catch blocks. The .catch block will catch any errors that occur and handle them as you tell it to. If you are not using promises, you can use a try catch block that works similarly. The code will try to execute but if there is an error it will handle them as you specify.

5. How does Node.js support multi-processor platforms, and does it fully utilize all processor resources?

By default Node.js is a single thread application. It runs on a single processor core and will not take advantage of all processor resources. If you want to take advantage of multiple processors, you would need to use clustering, where you would fork multiple processes.

6. What is typically the first argument passed to a Node.js callback handler?

The first argument passed to a callback in Node.js is an error object. If there is no error then the object is null. Otherwise it returns the error.

--

--