Trivia Flashcards

1
Q

What is HTTP, and how it it different from HTTPS?

A
  • The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers
  • protocol used to transfer data over the web
  • insecure and data can be intercepted.
  • HTTP is a stateless protocol because each command is executed independently, without any knowledge of the commands that came before it.
  • Hyper Text Transfer Protocol Secure
  • symmetric key cryptography (like ceasar cypher but more complex) if you know how to encrypt a message you also know how to decrypt it
  • asymmetric key cryptography: you can encrypt a message (lock the box) but you can’t decrypt it (open a closed box). In technical speech the box is known as the public key and the key to open it is known as the private key.
  • encrypting messages using asymmetric cryptography is slower than using symmetric cryptography, so we only use it to exchange the encryption keys.

https://medium.freecodecamp.org/https-explained-with-carrier-pigeons-7029d2193351

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the event loop in JS? How does it work?

A

Every time you call a setTimeout function or do some async operation — it is added to the Event Table. This is a data structure which knows that a certain function should be triggered after a certain event. Once that event occurs (timeout, click, mouse move) it sends a notice. The Event Table does not execute functions and does not add them to the call stack on it’s own. It’s sole purpose is to keep track of events and send them to the Event Queue.

The Event Queue is a data structure similar to the stack. It kind of stores the correct order in which the functions should be executed. It receives the function calls from the Event Table, but it needs to somehow send them to the Call Stack. This is where the Event Loop comes in.

This is a constantly running process that checks if the call stack is empty. Every time it ticks it looks at the Call Stack and if it is empty it looks into the Event Queue. If there is something in the event queue that is waiting it is moved to the call stack. If not, then nothing happens.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens when you type in ‘www.google.com’ and hit enter?

A
  • The browser first checks the cache (browser, OS, router, ISP) for a DNS record to find the corresponding IP address of www.google.com. If that doesn’t work, the ISP’s DNS server initiates a DNS query (where multiple DNS servers may be searched) to find the IP address of the server that hosts google.com
  • Once found, the browser will initiate a TCP connection w/ the server via a 3 way handshake
  • Browser then sends an HTTP request to web server
  • Server will handle the request and send back an HTTP response, and the browser displays the content

https://medium.com/@maneesha.wijesinghe1/what-happens-when-you-type-an-url-in-the-browser-and-press-enter-bb0aa2449c1a

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

*What does it mean for a web page to be responsive?

A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

*What is a hashmap? How is it different from a hash table?

A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

*What are the differences between XSS and CSRF? What are they?

A

-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List the key benefits that HTML5 introduced.

A

In no order: 1). accessibility -it made creating accessible sites easier due to semantics and ARIA, 2) cleaner code - it allows you to write clear and descriptive code, allows u to easily separate meaning from style and content, 3) better interactions and game development - allows u to do most interactive and animated possibilities with canvas tag for example, 4) legacy/cross browser support, 5) Mobile - mobile browsers have adopted HTML5 so creating mobile projects is easy, hence the popularity of responsive design.

https://tympanus.net/codrops/2011/11/24/top-10-reasons-to-use-html5-right-now/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do media queries work?

A

Media query is a CSS technique introduced in CSS3.

It uses the @media rule to include a block of CSS properties only if a certain condition is true.

https://www.w3schools.com/css/css_rwd_mediaqueries.asp

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does it mean to be RESTful?

A
  • Representational State Transfer
  • a set of design principles for making network communication more scalable and flexible
    1. A RESTful system has to operate in the client-server model - A server is a computer that has resources of interest, and a client is a computer that wants to interact with the resources stored on the server.
    2. Stateless: Servers and clients do not keep track of each other’s state. Each request is standalone and server does not keep track of past requests. When not interacting, a server has no idea of client’s existence.
    3. Uniform Interface: ensures that there is a common language between servers and clients that allows each part to be swapped out or modified without breaking the entire system: 1) Identification of resources: Each resource must be uniquely identified by a stable identifier, meaning it does not change w/ interactions. 2) manipulations of resources thru representations: When a client wishes to make changes to resources, it sends the server a representation of what it would like the resulting resource to look like. The server takes the request as a suggestion, but still has ultimate control. 3) Descriptive messages: A self-descriptive message is one that contains all the information that the recipient needs to understand it. 4) Hypermedia is data sent from the server to the client that contains information about what the client can do next–what further requests it can make
    4. Caching: server responses should be labelled as either cacheable or non-cacheable
    5. Layered System: there can be more components than just servers and clients. However, each component is constrained to only see and interact with the very next layer.
    6. Code on demand (optional): refers to the ability for a server to send executable code to the client

https://codewords.recurse.com/issues/five/what-restful-actually-means

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain prototypes in JavaScript.

A

Functions can be used to create class-like functionality in JavaScript; and all functions have a prototype property. That prototype property is somewhat like a class definition in other object-oriented langauge. It is actually an instance of an object and every function in JS (constructor function or not) has a prototype object instance whether u use it or not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What’s a closure? How are they used?

A

A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.

To use a closure, simply define a function inside another function and expose it. To expose a function, return it or pass it to another function.

The inner function will have access to the variables in the outer function scope, even after the outer function has returned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Give a high level overview of how CSS grids work.

A

It is a 2-dimensional system, where it can handle both columns and rows.
You would apply CSS rules both to a parent element (which becomes the Grid Container) and to that elements children (which become Grid Items).
You would define a container element as a grid, set the column and row sizes, and then place its child elements into the grid.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does DNS work?

A
  • A user asks their browser to visit freecodecamp.com
  • The browser queries a DNS Resolver (usually their ISP) “where’s freecodecamp.com?”
  • DNS Resolver queries the Root servers (which have a big important list that keeps this information) “where is .COM?” Replies with Verisign.
  • DNS Resolver then queries Verisign — “where is freecodecamp.com?” Verisign replies with the nameservers ns1.cloudflare.com and the IP address 192.168.178.1
  • Hosting servers are queried with the IP address. “Give me the files for IP address 192.168.178.1”
  • Website files are delivered and rendered on the page
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What lifecycle methods get called in the mounting phase? What are the use cases for each of those methods?

A

1) componentWillMount
Most Common Use Case: App configuration in your root component.
2) componentDidMount
Most Common Use Case: Starting AJAX calls to load in data for your component.

https://engineering.musefind.com/react-lifecycle-methods-how-and-when-to-use-them-2111a1b692b1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is TCP? When is it used? How does it work?

A
  • Transmission Control Protocol / Internet Protocol.
  • Internet traffic needs to be routed to correct place. Online data has to know where it’s going. TCP/IP is used to do this.
  • Once TCP gets the data, it chops it into small chunks called packets where they can individually take quickest route thru internet to where they need to go. TCP puts a header on packet to know its destination and origin and a checklist to make sure no packets are missing.

https: //www.khanacademy.org/computing/computer-science/internet-intro/internet-works-intro/v/the-internet-packet-routers-and-reliability
https: //www.youtube.com/watch?v=PpsEaqJV_A0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What lifecycle methods get called in the update phase? What are the use cases for each of those methods? What method gets called in the unmounting phase?

A

1) shouldComponentUpdate
Most Common Use Case: Controlling exactly when your component will re-render.
2) componentWillUpdate
Most Common Use Case: Used instead of componentWillReceiveProps on a component that also has shouldComponentUpdate (but no access to previous props).
3) componentDidUpdate
Most Common Use Case: Updating the DOM in response to prop or state changes.

1) componentWillUnmount
https: //engineering.musefind.com/react-lifecycle-methods-how-and-when-to-use-them-2111a1b692b1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What’s an IIFE? When would you use it?

A

Immediate Invoked Function Expression. An IIFE is a function expression that is called immediately after you define it. It is usually used when you want to create a new variable scope.

The (surrounding parenthesis) prevents from treating it as a function declaration.

The final parenthesis() are executing the function expression.

Using IIFE avoids polluting the global namespace.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is UDP? When would you use it?

A

User Datagram Protocol

  • packets are smaller than TCP
  • connectionless - no need establish connection before sending
  • more control over when data is sent

Used for multimedia streaming, small transactions (DNS lookups)

https://www.youtube.com/watch?v=Vdc8TCESIg8&t=

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Javascript == vs. ===

A

The identity (===) operator behaves identically to the equality (==) operator except no type conversion is done, and the types must be the same to be considered equal.

== checks for equality with coercion and === checks for equality without coercion — strict equality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is this in JS? What are some common pitfalls with this?

A

An object method may need to access the information stored in the object to do its job. To access the object, a method can use the ‘this’ keyword. The value of this is the object “before dot”, the one used to call the method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is React?

A

A js library for building component based UIs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is recursion? How does it work?

A

The process in which a function calls itself directly or indirectly is called recursion. The idea is to represent a problem in terms of one or more smaller problems, and add one or more base conditions that stop recursion.

https://www.geeksforgeeks.org/recursion/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Name HTTP methods and short description of each.

A

GET - The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data (generally). Can be cached.
POST - A POST request is used to send data to the server, and is expected to process that data. Sends data thru body of request.
DELETE - Removes all current representations of the target resource given by a URI.

https://www.tutorialspoint.com/http/http_methods.htm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is hoisting (JS)?

A

The behavior of “moving” var and function declarations to the top of their respective scopes during the compilation phase is called hoisting.

Function declarations are completely hoisted. This means that a declared function can be called before it is defined.

Variables are partially hoisted. var declarations are hoisted but not its assignments.

let and const are not hoisted.

https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

What are pure/impure functions?

A

Pure functions have no side effects - the return value depends solely on arguments. If you call pure function w/ same set of arguments, you will get same return value - they are predictable. They do not modify the values passed to them.
Impure may call the database or network, may have side effects, may overwrite values passed to them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What does the ‘new’ keyword in JS do?

A

Functions invoked using the new keyword are called constructor functions.

So what does the new keyword actually do?

  1. Creates a new object.
  2. Sets the object’s prototype to be the prototype of the constructor function.
  3. Executes the constructor function with this as the newly created object.
  4. Returns the created object. If the constructor returns an object, this object is returned.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

HTTP requests: GET vs POST?

A
  • GET is used to request data from a specified resource.
  • Note that the query string (name/value pairs) is sent in the URL of a GET request
  • GET requests can be cached
  • GET requests remain in the browser history
  • GET requests can be bookmarked
  • GET requests is only used to request data (not modify)
  • POST is used to send data to a server to create/update a resource.
  • The data sent to the server with POST is stored in the request body of the HTTP request

https://www.w3schools.com/tags/ref_httpmethods.asp

28
Q

HTTP: PUT vs PATCH?

A

When using PUT, it is assumed that you are sending the complete entity, and that complete entity replaces any existing entity at that URI. In the above example, the PUT and PATCH accomplish the same goal: they both change this user’s email address. But PUT handles it by replacing the entire entity, while PATCH only updates the fields that were supplied, leaving the others alone.

https://stackoverflow.com/questions/28459418/rest-api-put-vs-patch-with-real-life-examples

29
Q

JS: What is event bubbling?

A

When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.

https://javascript.info/bubbling-and-capturing

30
Q

Cookies vs localStorage vs sessionStorage?

A
  • sessionStorage (as the name suggests) is only available for the duration of the browser session (and is deleted when the tab or window is closed) - it does survive page reloads
  • if the data you are storing needs to be available on an ongoing basis then localStorage is preferable to sessionStorage - although you should note both can be cleared by the user so you should not rely on the continuing existence of data in either case
  • The data stored in localStorage and sessionStorage can easily be read or changed from within the client/browser so should not be relied upon for storage of sensitive or security-related data within applications
  • cookies can be trivially tampered with by the user, and data can also be read from them in plain text
  • As cookies are used for authentication purposes and persistence of user data, all cookies valid for a page are sent from the browser to the server for every request to the same domain - this includes the original page request, any subsequent Ajax requests, all images, stylesheets, scripts, and fonts. For this reason, cookies should not be used to store large amounts of information. Typically cookies are used to store identifying tokens for authentication, session, and advertising tracking. The tokens are typically not human readable information in and of themselves, but encrypted identifiers linked to your application or database.

https://stackoverflow.com/questions/19867599/what-is-the-difference-between-localstorage-sessionstorage-session-and-cookies

31
Q

What is JS event delegation?

A

The idea is that if we have a lot of elements handled in a similar way, then instead of assigning a handler to each of them – we put a single handler on their common ancestor.

https://javascript.info/event-delegation

32
Q

What is XSS?

A

Cross-site Scripting (XSS) refers to client-side code injection attack wherein an attacker can execute malicious scripts (also commonly referred to as a malicious payload) into a legitimate website or web application.

In order for an XSS attack to take place the vulnerable website needs to directly include user input in its pages. An attacker can then insert a string that will be used within the web page and treated as code by the victim’s browser.

https://www.acunetix.com/websitesecurity/cross-site-scripting/

33
Q

ES5 vs ES6?

A
  1. ES5 only had “function-level scope” (i.e. you wrap code in functions to create scope) and caused a lot of issues. ES6 provides “block”-level scoping(i.e curly-braces to scope) when we use “let” or “const” instead of “var”.
  2. In ES5, “this” can vary based on “where” it is called and even “how” it is called. With the ES6 fat arrow function, lexical “this” a feature that forces the variable “this” to always point to the object where it is physically located within.
  3. In ES5, “arguments” acts like an Array (i.e. we can loop over it), but is not an Array. So, all the Array functions like sort, slice and so on are not available.
    In ES6, we can use a new feature called “Rest” parameters. It’s represented with 3 dots and a name like …args. Rest parameters is an Array and so we can use all the Array functions.
  4. Conceptually, there is no such thing as a “Class”(i.e. blueprint) in JS like it is in other OO languages like Java. But people for a long time have treated the “function” (aka “function constructors”) that creates Objects when we use the “new” keyword as Classes.
    ES6 brings a new syntax that’s common in various programming languages.
    5.

https://medium.freecodecamp.org/5-javascript-bad-parts-that-are-fixed-in-es6-c7c45d44fd81

34
Q

What is CSRF?

A

Cross-site Request Forgery (CSRF) will only be effective if a victim is authenticated. When the malicious link that we mentioned earlier is clicked, the attacker may direct the victim to their own malicious web application that will execute a script that will in turn trigger the victim’s browser to send an illegal request.

https://www.acunetix.com/websitesecurity/csrf-attacks/

35
Q

Describe JS error handling (try/catch).

A
  1. First, the code in try {…} is executed.
  2. If there were no errors, then catch(err) is ignored: the execution reaches the end of try and then jumps over catch.
  3. If an error occurs, then try execution is stopped, and the control flows to the beginning of catch(err). The err variable (can use any name for it) contains an error object with details about what’s happened.

https://javascript.info/try-catch

36
Q

Explain AJAX.

A

AJAX = Asynchronous JavaScript And XML. AJAX is a technique for accessing web servers from a web page. AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

How AJAX works:

  1. An event occurs in a web page (the page is loaded, a button is clicked)
  2. An XMLHttpRequest object is created by JavaScript
  3. The XMLHttpRequest object sends a request to a web server
  4. The server processes the request
  5. The server sends a response back to the web page
  6. The response is read by JavaScript
  7. Proper action (like page update) is performed by JavaScript

https://www.w3schools.com/xml/ajax_intro.asp

37
Q

What are the different stages of a of a page’s lifecycle?

A

The lifecycle of an HTML page has three important events:

  • DOMContentLoaded – the browser fully loaded HTML, and the DOM tree is built, but external resources like pictures <img></img> and stylesheets may be not yet loaded.
  • load – the browser loaded all resources (images, styles etc).
  • beforeunload/unload – when the user is leaving the page.
38
Q

What’s the same origin policy?

A

An origin is defined by the scheme, host, and port of a URL. For example, if a document retrieved from http://example.com/doc.html tries to access the DOM of a document retrieved from https://example.com/target.html, the user agent will disallow access because the origin of the first document, (http, example.com, 80), does not match the origin of the second document (https, example.com, 443).

https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy

39
Q

var vs let vs const

A

Variables (var) and functions declared inside another function cannot be accessed by any of the enclosing scopes — they are function-scoped.

Variables declared inside a block-scope, such as if statements and for loops, can be accessed from outside of the opening and closing curly braces of the block.

let and const are block-scoped alternatives for variable declaration. A common misconception is that const is immutable. It cannot be reassigned, but its properties can be changed!

40
Q

What is CORS?

A

Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell a browser to let a web application running at one origin (domain) have permission to access selected resources from a server at a different origin.

41
Q

Write merge sort. (once a week)

A

-

42
Q

What is JS strict mode?

A

Strict mode makes it easier to write “secure” JavaScript.

Strict mode changes previously accepted “bad syntax” into real errors.

As an example, in normal JavaScript, mistyping a variable name creates a new global variable. In strict mode, this will throw an error, making it impossible to accidentally create a global variable.

https://www.w3schools.com/js/js_strict.asp

43
Q

JS rest and spread

A

https://javascript.info/rest-parameters-spread-operator

44
Q

SQL query order

A

https://sqlbolt.com/lesson/select_queries_order_of_execution

45
Q

SQL vs NoSQL

A

SQL: structured way of storing data using tables with columns and rows. Reasons to use: ur data is structured and unchanging.
NoSQL: nonstructured data stored in a document. Reasons: u have large volumes of data that’s little to no structure

https://www.upwork.com/hiring/data/sql-vs-nosql-databases-whats-the-difference/

46
Q

JS bind

A

https://javascript.info/bind

47
Q

SQL joins

A

http://www.sql-join.com/sql-join-types/

48
Q

Review bubble sort.

A

-

49
Q

Difference between scaling horizontally vs vertically?

A

Horizontal scaling means that you scale by adding more machines into your pool of resources whereas Vertical scaling means that you scale by adding more power (CPU, RAM) to an existing machine.

An easy way to remember this is to think of a machine on a server rack, we add more machines across the horizontal direction and add more resources to a machine in the vertical direction.

https://stackoverflow.com/questions/11707879/difference-between-scaling-horizontally-and-vertically-for-databases

50
Q

JS: function expression vs function declaration?

A

A Function Expression is created when the execution reaches it and is usable from then on — it is not hoisted.
A Function Declaration can be called both before and after it was defined — it is hoisted.

https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e

51
Q

Practice binary search algo (once a week)

A

-

52
Q

JS: Value vs. Reference?

A

Simple values (also known as primitives) are always assigned by value-copy: null, undefined , boolean, number, string and ES6 symbol.

Compound values always create a copy of the reference on assignment: objects, which includes arrays, and functions.

To copy a compound value by value, you need to make a copy of it. The reference does not point to the original value.

https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e

53
Q

What are the 7 different JS types?

A

There are 7 built-in types: null, undefined , boolean, number, string, object and symbol

https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e

54
Q

Explain the difference between + and -*/ in JS when it comes to coercion.

A

The first thing you need to be aware of is the + operator. This is a tricky operator because it works for both number addition and string concatenation.

But, the *, / , and -operators are exclusive for numeric operations. When these operators are used with a string, it forces the string to be coerced to a number.

https://medium.freecodecamp.org/the-definitive-javascript-handbook-for-a-developer-interview-44ffc6aeb54e

55
Q

What’s the JS Global Object?

A

In a browser it is named “window”.

It does two things:

Provides access to built-in functions and values, defined by the specification and the environment. For instance, we can call alert directly or as a method of window.

Provides access to global Function Declarations and var variables. We can read and write them using its properties.

https://javascript.info/global-object

56
Q

Give a high level overview of how to implement a Linked List. Build a linked list class (maybe once a week)

A

http://wlowry88.github.io/blog/2014/08/20/linked-lists-in-ruby/

57
Q

What is JS Promise?

A
  1. A “producing code” that does something and takes time. For instance, the code loads a remote script.
  2. A “consuming code” that wants the result of the “producing code” once it’s ready. Many functions may need that result.
  3. A promise is a special JavaScript object that links the “producing code” and the “consuming code” together. The “producing code” takes whatever time it needs to produce the promised result, and the “promise” makes that result available to all of the subscribed code when it’s ready.

https://javascript.info/promise-basics

58
Q

JS DOM tree

A

The backbone of an HTML document are tags.

According to Document Object Model (DOM), every HTML-tag is an object. Nested tags are called “children” of the enclosing one.

The text inside a tag it is an object as well.

All these objects are accessible using JavaScript.

https://javascript.info/dom-nodes

59
Q

OOP

A

We think of data types first, then think of actions associated with those data types.

Principles:

  1. Encapsulation: only methods of the Cat class should be able to read/write class fields, no other class or code should be able to do this.
  2. Inheritance sometimes classes may overlap (they may have same properties). If Cat inherits from Mammal and Mammal inherits from Animal, Cat gets all attributes of Mammal and Animal. Everything inherits from Object.
  3. Abstraction: Applying abstraction means that each object should only expose a high-level mechanism for using it. This mechanism should hide internal implementation details. It should only reveal operations relevant for the other objects.
  4. Polymorphism: polymorphism gives a way to use a class exactly like its parent so there’s no confusion with mixing types. But each child class keeps its own methods as they are.

https://medium.freecodecamp.org/object-oriented-programming-concepts-21bb035f7260

60
Q

What is a service (rails)?

A

an operation offered as an interface that stands alone in the model. In other words, a service is an action, not a thing. And instead of forcing the operation into an existing object, we should encapsulate it in a separate, stateless service.
- When forcing logic into a domain object is awkward because these use-cases often involve rules outside the responsibility of any single object. Also prevents a controller from being too complicated.

https: //www.engineyard.com/blog/keeping-your-rails-controllers-dry-with-services
https: //blog.carbonfive.com/2012/01/10/does-my-rails-app-need-a-service-layer/

61
Q

What is SOLID and describe each.

A

SOLID is a set of principles developed for object oriented programming.
S - Single-responsiblity principle: A class should have one and only one reason to change, meaning that a class should have only one job.
O - Open-closed principle: Objects or entities should be open for extension, but closed for modification.
This simply means that a class should be easily extendable without modifying the class itself.
L - Liskov substitution principle: every subclass/derived class should be substitutable for their base/parent class.
I - Interface segregation principle: a client should never be forced to implement an interface that it doesn’t use or clients shouldn’t be forced to depend on methods they do not use.
D - Dependency Inversion Principle: Entities must depend on abstractions not on concretions. It states that the high level module must not depend on the low level module, but they should depend on abstractions.

https: //scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
https: //blog.bitsrc.io/solid-principles-every-developer-should-know-b3bfa96bb688

62
Q

Multi page app vs single page?

A

Multi:

  • stateless -> request is done when page is done loading. Nothing to manage on client side.
  • simpler to build
  • SEO

Single:

  • perceived to be faster (better UX)
  • all javascript is loaded so can potentially browse offline
63
Q

Is ruby pass by reference or pass by value?

A

Ruby acts like pass by value for immutable objects, pass by reference for mutable objects

https://launchschool.com/blog/object-passing-in-ruby

64
Q

What is a module (ruby)?

A

Ruby Modules are similar to classes in that they hold a collection of methods, constants, and other module and class definitions. Modules are defined much like classes are, but the module keyword is used in place of the class keyword. Unlike classes, you cannot create objects based on modules nor can you subclass them; instead, you specify that you want the functionality of a particular module to be added to the functionality of a class, or of a specific object. Modules stand alone; there is no “module hierarchy” of inheritance. Modules is a good place to collect all your constants in a central location.

Modules serve two purposes:

  • First they act as namespace, letting you define methods whose names will not clash with those defined elsewhere.
  • Second, they allow you to share functionality between classes - if a class mixes in a module, that module’s instance methods become available as if they had been defined in the class.

http://rubylearning.com/satishtalim/modules_mixins.html

65
Q

Is JS asynchronous or synchronous?

A

Both

66
Q

Tell me about your preferred development environment.

A

I use iterm and MAC OS. My preferred editor is VS Code.