Skip to content

Commit 78a93e1

Browse files
committed
Initial commit
1 parent e3056d3 commit 78a93e1

32 files changed

+140
-214
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/pages.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: "pages"
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: ruby/setup-ruby@v1
23+
with:
24+
ruby-version: "3.3"
25+
bundler-cache: true
26+
27+
- name: Build site
28+
run: bundle exec jekyll build
29+
env:
30+
JEKYLL_ENV: production
31+
32+
- uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: _site
35+
36+
deploy:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: github-pages
41+
url: ${{ steps.deployment.outputs.page_url }}
42+
steps:
43+
- id: deployment
44+
uses: actions/deploy-pages@v4
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
layout: default
33
title: "Single Responsibility"
44
nav_order: 2
5-
permalink: /srp/
5+
permalink: /01-single-responsibility/
66
---
77

88
{: .note }
9-
> **Language:** **English** | [O'zbek]({{ site.baseurl }}/uz/srp/)
9+
> **Language:** **English** | [O'zbek]({{ site.baseurl }}/uz/01-single-responsibility/)
1010
1111
# Single Responsibility Principle (SRP)
1212

@@ -18,12 +18,12 @@ When a class handles multiple concerns (e.g. business logic, persistence, format
1818
## Diagram
1919

2020
<p align="center">
21-
<img src="{{ site.baseurl }}/assets/srp.png" width="700" alt="SRP class diagram" />
21+
<img src="{{ site.baseurl }}/assets/01-single-responsibility.png" width="700" alt="SRP class diagram" />
2222
</p>
2323

2424
## Violation
2525

26-
In [`violation.py`]({{ site.baseurl }}/srp/violation.py) the `Order` class handles three unrelated responsibilities:
26+
In [`violation.py`](violation.py) the `Order` class handles three unrelated responsibilities:
2727

2828
- **Price calculation** — computing the order total
2929
- **Discount logic** — applying business discount rules
@@ -42,7 +42,7 @@ Any change to discount rules, pricing formulas, or storage backends forces modif
4242

4343
## Correct
4444

45-
In [`correct.py`]({{ site.baseurl }}/srp/correct.py) each responsibility is extracted into its own class:
45+
In [`correct.py`](correct.py) each responsibility is extracted into its own class:
4646

4747
| Class | Responsibility |
4848
|-------|---------------|
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
layout: default
33
title: "Single Responsibility (UZ)"
44
nav_exclude: true
5-
permalink: /uz/srp/
5+
permalink: /uz/01-single-responsibility/
66
---
77

88
{: .note }
9-
> **Til:** [English]({{ site.baseurl }}/srp/) | **O'zbek**
9+
> **Til:** [English]({{ site.baseurl }}/01-single-responsibility/) | **O'zbek**
1010
1111
# Single Responsibility Principle (SRP)
1212

@@ -18,12 +18,12 @@ Agar bitta class bir nechta vazifani bajara boshlasa (masalan, biznes-logika, ma
1818
## Diagramma
1919

2020
<p align="center">
21-
<img src="{{ site.baseurl }}/assets/srp.png" width="700" alt="SRP class diagramma" />
21+
<img src="{{ site.baseurl }}/assets/01-single-responsibility.png" width="700" alt="SRP class diagramma" />
2222
</p>
2323

2424
## Noto'g'ri yondashuv
2525

26-
[`violation.py`]({{ site.baseurl }}/srp/violation.py) dagi `Order` class'i uchta turli vazifani bajaradi:
26+
[`violation.py`](violation.py) dagi `Order` class'i uchta turli vazifani bajaradi:
2727

2828
- **Narxni hisoblash** — buyurtma summasini hisoblash
2929
- **Chegirma** — biznes-qoidalari bo'yicha chegirma qo'llash
@@ -42,7 +42,7 @@ Chegirma qoidalari, narx formulasi yoki saqlash tizimi o'zgarganda — aynan shu
4242

4343
## To'g'ri yondashuv
4444

45-
[`correct.py`]({{ site.baseurl }}/srp/correct.py) dagi har bir vazifa alohida class'ga ajratilgan:
45+
[`correct.py`](correct.py) dagi har bir vazifa alohida class'ga ajratilgan:
4646

4747
| Class | Vazifasi |
4848
|-------|----------|

ocp/README.md renamed to 02-open-closed/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
layout: default
33
title: "Open/Closed"
44
nav_order: 3
5-
permalink: /ocp/
5+
permalink: /02-open-closed/
66
---
77

88
{: .note }
9-
> **Language:** **English** | [O'zbek]({{ site.baseurl }}/uz/ocp/)
9+
> **Language:** **English** | [O'zbek]({{ site.baseurl }}/uz/02-open-closed/)
1010
1111
# Open/Closed Principle (OCP)
1212

@@ -18,12 +18,12 @@ This is typically achieved through **inheritance** and **polymorphism**.
1818
## Diagram
1919

2020
<p align="center">
21-
<img src="{{ site.baseurl }}/assets/ocp.png" width="700" alt="OCP class diagram" />
21+
<img src="{{ site.baseurl }}/assets/02-open-closed.png" width="700" alt="OCP class diagram" />
2222
</p>
2323

2424
## Violation
2525

26-
In [`violation.py`]({{ site.baseurl }}/ocp/violation.py) an `AreaCalculator` uses `isinstance` checks to handle each shape type:
26+
In [`violation.py`](violation.py) an `AreaCalculator` uses `isinstance` checks to handle each shape type:
2727

2828
```python
2929
class AreaCalculator:
@@ -40,7 +40,7 @@ Adding a `Triangle` requires modifying the existing `AreaCalculator` — it is *
4040

4141
## Correct
4242

43-
In [`correct.py`]({{ site.baseurl }}/ocp/correct.py) a `Shape` abstract base class defines the `area()` contract.
43+
In [`correct.py`](correct.py) a `Shape` abstract base class defines the `area()` contract.
4444
Each shape implements its own calculation:
4545

4646
```python
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
layout: default
33
title: "Open/Closed (UZ)"
44
nav_exclude: true
5-
permalink: /uz/ocp/
5+
permalink: /uz/02-open-closed/
66
---
77

88
{: .note }
9-
> **Til:** [English]({{ site.baseurl }}/ocp/) | **O'zbek**
9+
> **Til:** [English]({{ site.baseurl }}/02-open-closed/) | **O'zbek**
1010
1111
# Open/Closed Principle (OCP)
1212

@@ -18,12 +18,12 @@ Bunga odatda **inheritance** (meros olish) va **polymorphism** orqali erishiladi
1818
## Diagramma
1919

2020
<p align="center">
21-
<img src="{{ site.baseurl }}/assets/ocp.png" width="700" alt="OCP class diagramma" />
21+
<img src="{{ site.baseurl }}/assets/02-open-closed.png" width="700" alt="OCP class diagramma" />
2222
</p>
2323

2424
## Noto'g'ri yondashuv
2525

26-
[`violation.py`]({{ site.baseurl }}/ocp/violation.py) dagi `AreaCalculator` har bir shakl turini `isinstance` tekshiruvi orqali aniqlaydi:
26+
[`violation.py`](violation.py) dagi `AreaCalculator` har bir shakl turini `isinstance` tekshiruvi orqali aniqlaydi:
2727

2828
```python
2929
class AreaCalculator:
@@ -40,7 +40,7 @@ class AreaCalculator:
4040

4141
## To'g'ri yondashuv
4242

43-
[`correct.py`]({{ site.baseurl }}/ocp/correct.py) dagi `Shape` abstract class `area()` metodini belgilaydi.
43+
[`correct.py`](correct.py) dagi `Shape` abstract class `area()` metodini belgilaydi.
4444
Har bir shakl o'z hisob-kitobini mustaqil bajaradi:
4545

4646
```python

ocp/correct.py renamed to 02-open-closed/correct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(self, radius: float) -> None:
2727
self.radius = radius
2828

2929
def area(self) -> float:
30-
return math.pi * self.radius ** 2
30+
return math.pi * self.radius**2
3131

3232

3333
class Triangle(Shape):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def calculate(shape: object) -> float:
2727
if isinstance(shape, Rectangle):
2828
return shape.width * shape.height
2929
if isinstance(shape, Circle):
30-
return math.pi * shape.radius ** 2
30+
return math.pi * shape.radius**2
3131
raise TypeError(f"Unknown shape: {type(shape).__name__}")
3232

3333

0 commit comments

Comments
 (0)