Web & Architecture Basics Flashcards

1
Q

What is package.json file?

A

A package.json holds your dependencies and other configurations of your project.

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

What is a dependency?

A

A dependency is another piece of code that your application depends on to run.

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

What is the back end?

A

Any application (or set of applications) connected to the internet who’s primary purpose is to service client requests.

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

What are some common back end processes?

A

Web servers & databases.

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

What is a web server?

A

Anything that responds to HTTP requests with some data.

It can do something as simple as serve up a static file from a computer.

E.G. www.myhomepage.com

  • HTTP request to server
  • server locates static file & returns it

It can also read and write data to a database, do some custom business logic and return something to the client.

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

What is a database?

A

A place to store data in different ways dependent on your needs.

You can use databases independently from web servers.

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

How do web servers and databases work together?

A

They are usually located on separate servers, and they have their own computer, e.g. web server and database server.

This is because web servers and database both require high performance, so demand a lot of resources, using up lots of memory.

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

What is the front end?

A

Any code running on a client e.g. chrome browser, a mobile phone.

The things you can interact with e.g. websites.

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

How does the front end interact with the back end?

A

It makes requests to web servers and databases

E.G. to read and write data to a database.

The back end will locate the data, do some custom business logic and then return something to the client.

The responsibilities of back & front end can be shared depending on how the app is built.

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

What is back end processing?

A

Used when you need more time to process a request.

E.g. homework grader takes 2 days to grade work, you can close computer, back end processes your work and you get notified in two days when it’s complete.

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

What is caching?

A

Caching = faster & easier access for things that you use frequently.

The response of frequent request gets cached, so the database doesn’t need to keep getting hit with the same requests.

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

What is a framework?

A

Something that allows you to build applications more easily.

Frontend: you don’t have to write the logic on how the change happens on the page, you just write the logic for what should change and when & the framework does the heavy lifting

Backend: Packages of utility functions that give you some rules on how to use them. They make writing code easier.

E.g. 
ruby has ruby on rails
python has django
javascript has react
express
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why do frameworks exist?

A

To save us from writing unnecessary things from scratch.

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

What is URL routing?

A

URL routing dispatches all web requests for you and it’s integrated into frameworks e.g. React-Router

Essentially, where does the URL take you to and what code gets hit.

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

What is relevance do frameworks have to databases?

A

Web frameworks allow us to manipulate and design databases.

E.G. how do you structure your tables and models?

how are things related to each other?

how do you write to your database and how do you read entries?

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

What is templating?

A

ORGANISATION & CREATING PATTERNS IN THE DATA YOU RETURN

Templating is having a better ability to organise the data that your web application returns.

Most websites will return HTML, JSON, xml

E.G. EJS framework. ReactJS builds upon this concept

It allows you to reuse modules, separate out components

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

Relevance between frameworks and security?

A

Comes with built in basic security measurements

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

What are the things that happen when we render a webpage?

A
  1. Gathers Resources (get what we need to display e.g. HTML files, CSS files, images)
  2. Parse HTML & Create a DOM Tree
    - get resources from step 1 and create a tree of elements

(html parsing is super flexible so bad html can still render okay!)

  1. Create the Render Tree from the DOM tree
    - Adding the styling (CSS)
    - The render tree only contains visible elements (e.g. elements with the tag hidden won’t show up)
  2. Layout for the Render Tree
    - positioning of styled elements on screen
  3. Painting
    - Takes steps 1-4 and sends it to the UI backend so you can see it
    - Core UI access graphics library on your OS & uses draw functions to get things on the screen!
    - Z dimension is handled here (depth/overlapping)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What does DOM stand for?

A

Document Object Model regulated by W3

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

What happens when you interact with a webpage?

A

The browser has to re-render the webpage or components in response to what you’ve clicked / interacted with.

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

What is HTTP & what does it stand for?

A

Hypertext Transfer Protocol

It follows the client-server model:

Client for HTTP is the web browser, mobile phone etc

Servers for HTTP are web applications e.g. YouTube

HTTP also defines response status codes that the server makes back to the client (e.g. 404, 200)

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

What is meant by HTTP being naturally a stateless protocol?

A

Every request made through HTTP is independent to any other request.

If you made the same HTTP request two days in a row, it wouldn’t ALONE remember the request and response for what you want.

You can however, get stateful functionality through other mechanisms such as sessions & cookies.

23
Q

How do web applications track your state?

A

Through sessions, cookies, stateful management.

24
Q

What is meant by HTTP being an application layer protocol?

A

It sits on top of a transport layer protocol

25
Q

What is TCP?

A

Transport layer protocol. It defines how data is formatted & transmitted.

The application layer protocol sits on top of this.

HTTP sits above TCP on the stack, so TCP to HTTP is an abstraction - it doesn’t care how the data is sent it just makes a request!

Layers:
APPLICATION (http / smtp / ftp)

(port 80 = used by http)

TRANSPORT (tcp / udp)

26
Q

What client actions (requests) are there?

A

GET - fetch some data
POST - creating something new (new blog post, adding item to shopping cart)
DELETE
PUT - updating data

27
Q

What is a header?

A

Small bits of custom information that you send along with your request & responses.

The purpose of the custom info is to tweak the operation of the requests.

E.G. REQUEST:
you can include the content type in the request header (text file, xml file) & the server will respond with the request in that format

RESPONSE:
custom header could be ‘cache control’
- determines how different resources are cached dependant on how they are being used by each client

28
Q

What is a cookie?

A

Little bits of data that are ALWAYS stored on the client

E.G. username & password => cookie (containing a Session ID)

Other examples: last page you visited, preferred font size,

  • Will only work with the website it was generated on
29
Q

What is a session?

A

Utilises the cookies that are stored on the client to do something smart with it e.g advertisements, login

SOMETIMES server-side.

30
Q

What is cookie-based authentication?

A

Use of a session on the server to handle authentication e.g. a login request.

The cookie gets sent to the server to transport the session ID.

The session will stay active on that server for as long as you interact with the website.
- e.g. if you are inactive on a banking site, you’ll be re-prompted for your password after x amount of minutes

31
Q

What is a JSON Web Token?

A

Think of it like a randomly generated password that allows you certain access to things after a verification process

32
Q

What is the difference between a API tokens & sessions?

A

API token follows a standard

  • token contains session information (user data)
  • involves multiple parties that may not trust each other
  • has a limited lifetime (tokens must be refreshed (regenerated))
  • grants access to a subset of data
  • sent using HTTP headers
  • tokens usually app based

Sessions are implemented as needed by the server

  • sent via cookies (cookie stores the Session ID)
  • cookies are sent as HTTP headers but the browser handles them in a special way, different to tokens
  • sessions usually web based
33
Q

What processes the data once it’s as a response to a request?

A

The source code of the application / website parses the data (e.g. a JSON) and does something with it which in return will render something

34
Q

What are websockets?

A

Realtime communication - no request/response

The server can push messages directly to the client through an established connection called websockets without a request.

35
Q

What is Scalability?

A

Scalability is the ability of a system, network, or process to handle a growing amount of load by adding more resources.

Adding resources can be done in two ways:

Scaling Up
= adding more resources to the existing nodes. For example, adding more RAM, Storage or processing power.

Scaling Out
= adding more nodes to support more users.

An ideal application should be able to serve high level of load in less resources.

36
Q

What is a cluster?

A

A cluster is group of computer machines that can individually run a software.

Clusters are typically utilised to achieve high availability for a server software with minimum down time.

App / Database Server Cluster

37
Q

Why do you need clustering?

A

Clustering is needed for achieving high availability for a server software. The main purpose of clustering is to achieve 100% availability or a zero down time in service.

By creating a cluster of more than one machine, we can reduce the chances of our service going un-available in case one of the machine fails.

38
Q

What is meant by the KISS principle?

A

“keep it simple, stupid”, is a design principle.

The KISS principle states that most systems work best if they are kept simple rather than made complicated.

Simplicity = key goal in design

Unnecessary complexity should be avoided.

39
Q

What is a software architect?

A

They make decisions that cross multiple areas of concern.

Must be familiar with the problem domain, the technology involved & keep an eye out on new technologies that might make the project easier or answer new customers’ feature requests.

40
Q

Define Microservice Architecture:

A

The microservice architectural style is an approach to developing a single application as a suite of small services, each running in it’s own processes and communicating with lightweight mechanisms, often an HTTP resource API (Martin Fowler)

Microservices are an abstraction!
- they can have complex structures

Encourages separation of concerns:
- ability to encapsulate your data structures behind something to ease up co-ordination of one big thing!

Horizonally scaling

  • workload partitioning (breaking workload into smaller components)
  • makes everything more managable

Virtualization & elasticity

  • running in a virtualized environmnet
  • automated operations as much as possible CI/CD
  • on demand provisioning
41
Q

Why would you opt for microservices architecture?

A

Microservices can adapt easily to other frameworks or technologies.

Failure of a single process does not affect the entire system.

Provides support to big enterprises as well as small teams.

Can be deployed independently and in relatively less time.

42
Q

What is monolithic architecture?

A

When all code is packaged up into one one thing, and it all gets deployed in one thing.

This limits scalability as you usually have to use the same langauge(s) and technologies.

43
Q

What is a network?

A

A network is used to connect devices.

Devices connected via a network can:

  • send data (e.g. print jobs to a printer, sending an email, streaming)
  • share internet connection

The goal is to move information from one device to another

44
Q

How can you connect to a network?

A

There are a few ways:

via a switch:

  • schools often use this
  • computers wired into a socket in the wall. the wall socket cable on the other side connects into a patch panel, then that connects into the switch

wirelessly:

  • using wifi
  • the router/access point can be connected to the switch with a cable

because you can wire your wifi into the switch, it allows both wired and wireless connection

45
Q

What is a protocol?

A

How devices understand each other & communicate over a network.

Devices need to “speak the same language” in order to communicate.

This means they must agree on how data is sent, received, organised and handled.

The agreement is called a PROTOCOL.

There are different types of protocol. Software & hardware are designed with these protocols in mind.

46
Q

Name a few different network protocols:

A

Ethernet & TCP (sending & receiving data)
HTTP (accessing the web)
SMTP (email)

Usually several protocols are used together to achieve a task.

47
Q

What is the proper name for devices on a network?

A

Nodes.

Nodes can be devices that help control traffic flowing through a network, such as switches or routers.

Nodes also include endpoints/hosts. These are devices that send & receive the bulk of the traffic e.g. workstations, servers, printers etc

48
Q

What is a SOHO network?

A

Small Office / Home Office (few devices e.g. phone, computer, printer - wired & wirelessly)

The router, switch & access point are often all integrated into one device.

In a SOHO network, the switch is a LAN (local area network).

49
Q

What is an ENTERPRISE network?

A

A much larger network.

This could be a LAN (or multiple LANs), and would have many switches, routers and access points depending on their needs.

The whole building could be one LAN, or it could be broken up to many over floors.

An enterprise network could also be a WAN.

50
Q

What is a LAN?

A

LAN (Local Area Network) is a collection of network devices in a local area e.g. a single building.

51
Q

What is a WAN?

A

WAN (Wide Area Network) connects networks that are far apart.

52
Q

What is the OSI Model?

A

Open System Interconnection Model.

Used to define and understand how data is transferred from one computer to another in a network.

53
Q

How does the OSI Model work?

A

Each layer contains a set of protocols that are needed to make things work correctly in the network.

E.G. a web browser performs application, presentation & session layers.

APPLICATION layer:

  • provides services for applications (e.g. chrome, skype, outlook) with the help of protocols to perform user activities, such as:
  • file transfers (File Transfer Protocol),
  • web surfing (HTTP/s)
  • emails (SMTP)

PRESENTATION layer:

  • receives data from application layer in numbers and letters
  • converts data to binary
  • compression happens here
  • data gets encrypted (enhancing security using SSL (Secure Sockets Layer Protocol))

SESSION layer:

  • setting up & maintaining connections
  • terminating connections
  • APIs (e.g. NETBIOS)
  • authentication (happens on the server). once password & username is matched, a session is established between your computer and the server
  • authorisation - checks your permissions to access a page
  • a separate session gets opened when you request a website, sending images text etc as data packets. these are tracked by the session later
  • sessionID gets stored in a cookie

TRANSPORT layer:
reliability of communication via:
- segmentation: data split up into smaller segments containing source & destination numbers, ports & sequence nums

port sends it to the right application
sequence helps re-assemble in the correct order when the data is recieved

  • flow control: amount of data being transmitted e.g. slow down speed for less powerful device / speed up (computer to phone and vice versa)
  • if data is lost, it will automatically be resent using automatic repeat request

TRANSMISSION CONTROL PROTOCOL (feedback, so if lost it can be resent)
- email, files

USER DATAGRAM PROTOCOL (faster but no feedback, doesn’t matter if partial data is lost)
- video games, films, music

NETWORK layer:
the IP of both sender and receiver are assigned here to each segment of data, forming the packet.

  • logical addressing (IP addresses) ensures the data reaches the correct destination
  • routing = moving packet from source to destination based on IP (first 3 number blocks represent network, final digit is the host). e.g. facebook server, to your network, to your computer
  • path determination = choosing best path for data delivery

DATA LINK layer:
provides access to media through the upper layers of the osi model using framing

  • detects errors due to media limitations
  • physical addressing = mac addresses of sender & receiver are added to the data packet + tail to form the frame.
  • the data packet is now called a frame

(MAC address is embedded into the network interface card of a computer by the manufacturer)

PHYSICAL layer:
transmission over the cables

54
Q

What are the 7 layers of the OSI model?

A

Application
Presentation
Sessions

Transport
Network
Data Link
Physical