Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions backend/controller/answers/guillaume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
What is a status code? What are the most common status codes?
Status codes are standardized numbers that correspond to specific situations in the context of HTTP requests.
2xx means successful requests
3xx means redirects
4xx means client errors
5xx means server errors

Most common include:
200 successful request
201 successful creation, like after a POST request
301/302 redirect (page moved to a new location)
401 unauthorized (wrong password/username)
403 forbidden (correct login but don't have permission)
404 page not found (incorrect URL entered)
500 internal server error

What is JSON? What is XML? Why do we use them?
JSON stands for JavaScript Object Notation and XML stands for eXtensible Markup Language. Both are standardized data formats used for exchanging information between systems.
JSON is:

Simpler, less verbose
Native to JavaScript (easy to parse)
Smaller file size
Used by most modern APIs

XML is:
More structured (can validate against schemas)
Better for complex documents
Supports attributes and namespaces
Good for configuration files

JSON is usually preferred for web APIs and data exchange, while XML might be used for complex documents or when strict validation is needed.
We use these standardized formats so all parties have a common language for data communication.

What is an HTTP request? An HTTP response?
An HTTP request goes to the server and contains a method (GET, POST, PUT, DELETE), a URL/endpoint, headers, and maybe a body with data.
An HTTP response comes from the server and contains a status code, headers, and a body with data.
For example, a GET request to /users/123 might return a 200 status code with JSON data containing the user's information.

What is middleware?
Middleware are functions that run between request and response.
They typically are used to perform authentication, parsing of the request body, or logging.
For example, an authentication middleware will check that the user is logged in (by verifying their bearer token) before processing the request.

What is a "controller layer"? Why do we need one?
A controller layer contains functions that handle specific types of HTTP requests (like GET, POST, etc.). Controllers act as coordinators - they receive requests, call the appropriate business logic or database operations, format the response data, handle errors, and send back the appropriate status codes.
We need a controller layer for separation of concerns. It keeps routing code thin and reusable by separating the "what to do" (controller logic) from the "how to get there" (routing). Controllers sit between the incoming request and your business logic, orchestrating the flow without containing the heavy business logic themselves.
For example, a user controller might have functions like getUser(), createUser(), updateUser() that each handle their specific request type and coordinate the necessary operations.

What is the difference between a service and a controller?
A service is typically a separate file that contains business logic such as validating data, hashing passwords, saving to databases, displaying notifications, etc.
A controller just handles HTTP requests/responses.
Several controllers/routes might need the same service, so it is helpful to extract the service-related code so it is more easily reusable.
The pattern is typically: request → controller → service → database.

What is the client/server model? What is a client?
The client/server model describes how software applications communicate.
A client is the software/application used by the user, such as a web browser or mobile app.
A server refers to the software that handles requests and responses.
The client makes requests and the server processes them and sends responses.
For example, when visiting a website, Chrome (client) makes requests to the website's web server, which processes the requests and sends back the web pages.
12 changes: 12 additions & 0 deletions backend/service/answers/guillaume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
What is business logic vs UI logic?
Business logic refers to the core rules, calculations, and operations that are specific to the business domain - like user authentication, account balance calculations, transaction validation, and data processing. This logic would remain the same regardless of how users access the system.
UI logic handles the presentation layer and user interactions - managing what's displayed on screen, button clicks, form validation feedback, and how data is formatted for display. This logic is specific to the interface being used.

What does MVC stand for, and why is it important?
MVC stands for Model, View, and Controller. It's important because it provides separation of concerns, making code more organized, reusable, and maintainable.
Model manages data and business logic - handling database interactions, data validation, and business rule calculations. View handles presentation - displaying data to users or formatting it for APIs (like JSON responses). Controller coordinates between them - processing user requests, calling the appropriate Model methods, and passing results to the View for presentation.
This separation ensures each component has a single responsibility, making the codebase easier to test, modify, and scale.

What is a service?
A service is a specialized class or module that handles specific business operations that don't belong in Models, Views, or Controllers. Services encapsulate complex logic like sending emails, processing payments, generating reports, or integrating with external APIs.
They promote code reusability since multiple parts of the application can use the same service, and they maintain separation of concerns by keeping specialized logic out of MVC components. This makes the codebase more organized, testable, and maintainable.
18 changes: 18 additions & 0 deletions computer-science/light-computing/answers/guillaume.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
What is a computer?
A computer is a programmable electronic device that processes information through three fundamental operations: input, processing, and output. It takes in data (input), performs calculations and transformations on that data (processing), and produces results in various forms like visual displays, audio, or stored files (output). This basic cycle of receiving, manipulating, and presenting information enables computers to perform complex tasks from simple calculations to running applications and multimedia.

What is an operating system?
An operating system is software that manages computer hardware and provides services for other programs. It coordinates shared resources like memory, CPU time, and storage between multiple applications, handles communication between software and hardware components, and provides a user interface for interacting with the computer. Without an OS, programs couldn't run simultaneously or access hardware safely.

What is a runtime?
A runtime is the environment in which a program executes. It includes the software components needed to run code written in a specific programming language, such as memory management, garbage collection, and system libraries. Examples include the Java Runtime Environment (JRE) or the Node.js runtime for JavaScript.

What is memory? RAM? CPU?
Memory is storage space where data and instructions are held. RAM (Random Access Memory) is temporary, fast memory that stores data currently being used - it's cleared when power is lost. CPU (Central Processing Unit) is the "brain" that executes instructions and performs calculations by fetching, decoding, and executing program instructions.

What is a thread? What is a process?
A process is an independent program running in its own memory space with its own resources. A thread is a lightweight unit of execution within a process that shares the process's memory and resources. Multiple threads can run concurrently within a single process, allowing for parallel execution of tasks.

What is a browser?
A browser is an application that retrieves, interprets, and displays web content. It translates HTML, CSS, and JavaScript code into visual web pages, handles user interactions, manages network requests to web servers, and provides security features for safe web browsing.