Web & Architecture Basics Flashcards
What is package.json file?
A package.json holds your dependencies and other configurations of your project.
What is a dependency?
A dependency is another piece of code that your application depends on to run.
What is the back end?
Any application (or set of applications) connected to the internet who’s primary purpose is to service client requests.
What are some common back end processes?
Web servers & databases.
What is a web server?
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.
What is a database?
A place to store data in different ways dependent on your needs.
You can use databases independently from web servers.
How do web servers and databases work together?
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.
What is the front end?
Any code running on a client e.g. chrome browser, a mobile phone.
The things you can interact with e.g. websites.
How does the front end interact with the back end?
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.
What is back end processing?
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.
What is caching?
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.
What is a framework?
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
Why do frameworks exist?
To save us from writing unnecessary things from scratch.
What is URL routing?
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.
What is relevance do frameworks have to databases?
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?
What is templating?
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
Relevance between frameworks and security?
Comes with built in basic security measurements
What are the things that happen when we render a webpage?
- Gathers Resources (get what we need to display e.g. HTML files, CSS files, images)
- 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!)
- 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) - Layout for the Render Tree
- positioning of styled elements on screen - 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)
What does DOM stand for?
Document Object Model regulated by W3
What happens when you interact with a webpage?
The browser has to re-render the webpage or components in response to what you’ve clicked / interacted with.
What is HTTP & what does it stand for?
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)