Skip to content

Commit dece5d9

Browse files
authored
Update README.md
1 parent 3d5a1b0 commit dece5d9

1 file changed

Lines changed: 20 additions & 22 deletions

File tree

README.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# clean-code-php
1+
# clean-code-python
22

33
## Table of Contents
44
1. [Introduction](#introduction)
@@ -17,8 +17,8 @@
1717

1818
Software engineering principles, from Robert C. Martin's book
1919
[*Clean Code*](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882),
20-
adapted for PHP. This is not a style guide. It's a guide to producing
21-
readable, reusable, and refactorable software in PHP.
20+
adapted for Python. This is not a style guide. It's a guide to producing
21+
readable, reusable, and refactorable software in Python.
2222

2323
Not every principle herein has to be strictly followed, and even fewer will be universally
2424
agreed upon. These are guidelines and nothing more, but they are ones codified over many
@@ -30,28 +30,28 @@ Inspired from [clean-code-javascript](https://github.com/ryanmcdermott/clean-cod
3030
### Use meaningful and pronounceable variable names
3131

3232
**Bad:**
33-
```php
34-
$ymdstr = $moment->format('y-m-d');
33+
```python
34+
ymdstr = datetime.date.today().strftime("%y-%m-%d")
3535
```
3636

3737
**Good**:
38-
```php
39-
$currentDate = $moment->format('y-m-d');
38+
```python
39+
current_date = datetime.date.today().strftime("%y-%m-%d")
4040
```
4141
**[⬆ back to top](#table-of-contents)**
4242

4343
### Use the same vocabulary for the same type of variable
4444

4545
**Bad:**
46-
```php
47-
getUserInfo();
48-
getClientData();
49-
getCustomerRecord();
46+
```python
47+
get_user_info()
48+
get_client_data()
49+
get_customer_record()
5050
```
5151

5252
**Good**:
53-
```php
54-
getUser();
53+
```python
54+
get_user()
5555
```
5656
**[⬆ back to top](#table-of-contents)**
5757

@@ -62,20 +62,18 @@ understanding our program, we hurt our readers.
6262
Make your names searchable.
6363

6464
**Bad:**
65-
```php
66-
// What the heck is 86400 for?
67-
addExpireAt(86400);
65+
```python
66+
# What the heck is 86400 for?
67+
time.sleep(86400);
6868

6969
```
7070

7171
**Good**:
72-
```php
73-
// Declare them as capitalized `const` globals.
74-
interface DateGlobal {
75-
const SECONDS_IN_A_DAY = 86400;
76-
}
72+
```python
73+
# Declare them in the global namespace for the module.
74+
SECONDS_IN_A_DAY = 60 * 60 * 24
7775

78-
addExpireAt(DateGlobal::SECONDS_IN_A_DAY);
76+
time.sleep(SECONDS_IN_A_DAY)
7977
```
8078
**[⬆ back to top](#table-of-contents)**
8179

0 commit comments

Comments
 (0)