FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Metrics/FClasses.qhelp at codeql-cli/v2.26.3 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
462
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Metrics
/
FClasses.qhelp
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (33 loc) · 1.79 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Metrics
/
FClasses.qhelp
Copy path
File metadata and controls
41 lines (33 loc) · 1.79 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!
DOCTYPE
qhelp
PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<
qhelp
>
<
overview
>
<
p
>This metric measures the number of classes in each file.</
p
>
<
p
>There are advantages and disadvantages associated with defining multiple classes in the same file.
However, if you define unrelated classes in one file then the resulting module API is difficult for
other developers to understand and use.</
p
>
<
p
>The disadvantages of putting multiple classes in the same file include:</
p
>
<
ul
><
li
>unless the classes are closely related, it can be difficult to understand and maintain the code,
even with good support from development tools</
li
>
<
li
>it increases the risk that multiple developers will work on the same file at once, and increases the
incidence of merge conflicts</
li
>
<
li
>it may be a symptom of badly designed modules, where many different features are handled by a
single file.</
li
>
</
ul
>
<
p
>Sometimes there are advantages of putting multiple classes in the same file, for example:</
p
>
<
ul
><
li
>it reduces the proliferation of files containing very few lines of code</
li
>
<
li
>it can be used to group logically-related classes together.</
li
></
ul
>
</
overview
>
<
recommendation
>
<
p
>Each module should have a single, well-defined role. Consequently, only logically-related classes
should be grouped together in the same file. If your code defines unrelated classes in the same file
then you should refactor the code and create new files, each containing logically related classes.</
p
>
</
recommendation
>
<
references
>
<
li
>Python: <
a
href
=
"
http://docs.python.org/2/reference/compound_stmts.html#class-definitions
"
>Class
Definitions</
a
>.</
li
>
<
li
>M. Fowler, <
em
>Refactoring</
em
>. Addison-Wesley, 1999.</
li
>
<
li
>Wikipedia: <
a
href
=
"
https://en.wikipedia.org/wiki/Code_refactoring
"
>Code refactoring</
a
>.</
li
>
</
references
>
</
qhelp
>
Back
|
FazBrowse Home
|
New Git URL