@@ -8,49 +8,49 @@ Structuring your project properly is extremely important.
88Structure is Key
99----------------
1010
11- Thanks to the way imports and module are handled in Python, it is
11+ Thanks to the way imports and modules are handled in Python, it is
1212relatively easy to structure a python project. Easy, here, means
13- actually that you have not many constraints and that the module
14- importing model is easy grasp. Therefore, you are left with the
15- pure architectural task of drawing the different parts of your
13+ that you do not have many constraints and that the module
14+ importing model is easy to grasp. Therefore, you are left with the
15+ pure architectural task of crafting the different parts of your
1616project and their interactions.
1717
18- Easy structuration of a project means it is also easy
19- to do it poorly. Some signs of a poorly structured projects
18+ Easy structuring of a project means it is also easy
19+ to do it poorly. Some signs of a poorly structured project
2020include:
2121
22- - Multiple and messy circular dependencies: if your classes
22+ - Multiple and messy circular dependencies: If your classes
2323 Table and Chair in furn.py need to import Carpenter from workers.py
24- to answer to a question such as table.isdoneby(),
25- and if convertly the class Carpenter need to import Table and Chair,
26- for example to answer to carpenter.whatdo(), then you
27- have a circular dependency, and will have to resort to
24+ to answer a question such as table.isdoneby(),
25+ and if conversely the class Carpenter needs to import Table and Chair,
26+ to answer the question carpenter.whatdo(), then you
27+ have a circular dependency. In this case you will have to resort to
2828 fragile hacks such has using import statements inside
2929 methods or functions.
3030
31- - Hidden coupling. Each and every change in Table implementation
31+ - Hidden coupling: Each and every change in Table's implementation
3232 breaks 20 tests in unrelated test cases because it breaks Carpenter's code,
3333 which requires very careful surgery to adapt the change. This means
3434 you have too many assumptions about Table in Carpenter's code or the
3535 reverse.
3636
37- - Heavy usage of global state or context: Instead of explicitely
37+ - Heavy usage of global state or context: Instead of explicitly
3838 passing ``(height, width, type, wood) `` to each other, Table
3939 and Carpenter rely on global variables that can be modified
40- and are modified on the fly by different agent . You need to
41- scrutinize all access to this global variables to understand why
42- a rectangular table became a sqaure , and discover that a remote
40+ and are modified on the fly by different agents . You need to
41+ scrutinize all access to these global variables to understand why
42+ a rectangular table became a square , and discover that remote
4343 template code is also modifying this context, messing with
4444 table dimensions.
4545
4646- Spaghetti code: Multiple pages of nested if clauses and for loops
4747 with a lot of copy-pasted procedural code and no
4848 proper segmentation are known as spaghetti code. Python's
49- meaningful indentation (one of its most controversial feature ) make
49+ meaningful indentation (one of its most controversial features ) make
5050 it very hard to maintain this kind of code. So the good news is that
5151 you might not see too much of it.
5252
53- - Ravioli code is more likely in Python: it consists of hundreds of
53+ - Ravioli code is more likely in Python: It consists of hundreds of
5454 similar little pieces of logic, often classes or objects, without
5555 proper structure. If you never can remember if you have to use
5656 FurnitureTable, AssetTable or Table, or even TableNew for your
0 commit comments