FrontEnd Flashcards
Compare callbacks to promises in Node
A callback is a function that will run after another function has completed and returned, which is another way of saying “A callback is synchronous”.
A promise, on the other-hand, is asynchronous, it is often described as being a “future result of an async operation”.
Essentially when using Promises, we don’t wait for the first function to finish. Both functions run at the same time and they finish when they are done.
Have you had any experience with message queue systems and if so can you describe them.
I have not worked directly with them, but I know that we use them in the backend for both of the applications that I build.
We use them to send emails to volunteer managers when someone signs up to help with a task.
The premise of the message queue, in our system, is that we add all of the operations into a queue, and then when it reaches a set capacity, it runs a set of operations, in this case, generating emails and sending those out to users.
What is the difference between unit testing and integration testing?
Unit testing is the testing of small parts of an application, for instance, “When I run this function with these inputs, do I get the output that I anticipated?”.
Integration testing takes this a step further. We build the application and run it using a headless browser, like PhantomJS, and make sure that once all of the application’s components are built and running alongside one another, does the functionality of the application work as we expected?
How have you handled the concept of foreign key relationships in a NoSQL database?
There are a number of methods for this. The way that I would be inclined to use would be setting up the “relation” in the ORM model, I use Mongoose, which will allow us to write an id to multiple collections at once, or search for the same id across collections.
How have you handled performance concerns / scaling issues?
On the static sites that I’ve built for my company, I’ve taken advantage of pre-loading js and css libraries, which helps avoid flashing unstyled content.
In React, I’ve taken advantage of lifecycle methods that avoid re-rendering components unless a condition is met.
And I have also used ui-router extensively in production applications, so RESOLVING data and letting data get pulled in from a parent if it’s needed in multiple components.
What purpose do directives serve in AngularJS?
Directives are used in Angular to describe a DOM node that the html compiler will spit out. In that way, it’s very similar to something like React.
We describe our button and tell it that when we click on it, it should fire this function, and then Angular compiles that into a Button dom element with an on-click handler for us!
What are the three types of directives in AngularJS?
Components, Structural Directives, Attribute Directives.
Components are directives that come with a template.
Structural are used to change the shape of the DOM, showing/hiding a list.
Attribute components, change the appearance or attributes of another directive/component, very similar to addClass in jQuery.
What are the different ways you can bind data in AngularJS?
SINGLE OR DOUBLE BINDING -
Single binding just means that once the component is compiled and the data is bound into the template, that’s it, and we can’t change it. This is great for performance tweaking, because a single-binding doesn’t create any sort of scope.
Double-binding gives you a scope that allows the value to communicate with a controller and update after compilation. Binding data requires a lot of consideration to avoid causing considerable performance issues to the application.
What are the different ways you communicate between controllers in AngularJS?
The $rootScope service gives us access to $broadcast and $emit services, which we can listen to using the $on service.
For instance, when a user signs into my application and they haven’t given us access to show them browser notifications (think of Slack), I could broadcast the success of their login from my login controller and then listen to that on my header controller and display a call-to-action component, asking them for access to their browser’s notification api.
How would you specify that a scope variable should have one-way binding in AngularJS?
In the template binding, we put in two semi-colons before the variable, which is interpreted as a single bind.
Is it a good or bad practice to use AngularJS together with jQuery?
Bad. Not that it’s unforgivable, but you should be able to do anything that jQuery would allow before the nodes are generated in the DOM, and you shouldn’t need to run jQuery functions on that DOM.
Can you name some built-in AngularJS services?
$cookies, $window, $document, $location
There are quite a few, most of them bridging our application with the browser’s API, for instance, there are services for handling browser cookies, the window object, the document, and the location (aka window.location)
- These are extremely useful for building applications that need to store data in the user’s browser, or even just to tell the application what URL is currently open.
What’s a Retrospective
A “scrum ceremony” where the team meets and discusses the failures and successes of the most recent sprint, and brainstorm ways to improve.
What is NASH - backend?
DONT KNOW. DONT GUESS.
Oh, I never heard that term before. I’d love to get an explanation though!
What is NASH - backend?
DONT KNOW. DONT GUESS.
Oh, I never heard that term before. I’d love to get an explanation though!