diff --git a/modules/module1/sections/02-introduction-to-software-architecture.md b/modules/module1/sections/02-introduction-to-software-architecture.md index ec285b5..b41d0f1 100644 --- a/modules/module1/sections/02-introduction-to-software-architecture.md +++ b/modules/module1/sections/02-introduction-to-software-architecture.md @@ -353,12 +353,15 @@ async def create_order(request: CreateOrderRequest): #### Примеры реализации -**Выберите язык программирования:** -- [Java (Spring Boot + JPA)](#java-sql) | [Rust (SQLx)](#rust-sql) | [JavaScript (Node.js)](#javascript-sql) | [Python (SQLAlchemy)](#python-sql) - ---- - -### Java (Spring Boot + JPA) {#java-sql} +
+
+ + + + +
+ +
```java // SQL подход (PostgreSQL) @@ -417,8 +420,9 @@ public class MongoUser { } } ``` - -### Rust (SQLx) {#rust-sql} +
+ +
```rust // SQL подход (PostgreSQL) @@ -499,8 +503,9 @@ async fn create_user_with_order( Ok(user) } ``` - -### JavaScript (Node.js) {#javascript-sql} +
+ +
```javascript // SQL подход (PostgreSQL) @@ -588,8 +593,9 @@ async function createUserWithOrderMongo(request) { return await user.save(); } ``` - -### Python (SQLAlchemy) {#python-sql} +
+ +
```python # SQL подход (PostgreSQL) @@ -665,6 +671,8 @@ def create_user_with_order_mongo(request): user['_id'] = result.inserted_id return user ``` +
+
### 3. REST vs GraphQL @@ -705,12 +713,15 @@ def create_user_with_order_mongo(request): #### Примеры реализации -**Выберите язык программирования:** -- [Java (Spring Boot)](#java-rest) | [Rust (Actix Web)](#rust-rest) | [JavaScript (Node.js)](#javascript-rest) | [Python (FastAPI)](#python-rest) - ---- - -### Java (Spring Boot) {#java-rest} +
+
+ + + + +
+ +
```java // REST API @@ -738,8 +749,9 @@ public class UserResolver implements GraphQLResolver { } } ``` - -### Rust (Actix Web) {#rust-rest} +
+ +
```rust // REST API @@ -775,8 +787,9 @@ const resolvers = { } }; ``` - -### JavaScript (Node.js) {#javascript-rest} +
+ +
```javascript // REST API @@ -794,8 +807,9 @@ const resolvers = { } }; ``` - -### Python (FastAPI + Strawberry) {#python-rest} +
+ +
```python # REST API @@ -811,6 +825,8 @@ class User: async def orders(self) -> List[Order]: return await order_service.find_by_user_id(self.id) ``` +
+
### 4. Стратегии кэширования @@ -1011,12 +1027,15 @@ class User: #### Примеры реализации -**Выберите язык программирования:** -- [Java (Spring Boot + Redis)](#java-cache) | [Rust (Redis + Tokio)](#rust-cache) | [JavaScript (Node.js + Redis)](#javascript-cache) | [Python (FastAPI + Redis)](#python-cache) - ---- - -### Java (Spring Boot + Redis) {#java-cache} +
+
+ + + + +
+ +
```java // Cache-Aside Pattern @@ -1073,8 +1092,8 @@ public class UserServiceWriteThrough { } ```
- -
+ +
```rust // Cache-Aside Pattern @@ -1133,8 +1152,8 @@ impl UserService { } ```
- -
+ +
```javascript // Cache-Aside Pattern @@ -1209,8 +1228,8 @@ class UserServiceWriteBehind { } ```
- -
+ +
```python # Cache-Aside Pattern