Comments (3)
While reading a little bit further I got to the 6.6.7 Number of methods / fields / variables section.
It says the following:
[...], this is a breach of the single responsibility principle [...]
Which makes me wonder when you said earlier:
Counting (automatically) the number of coding style breaches [...]
Did you meant that having more than a single Code Style is considered a breach?
from 2dgd_f0th.
It seems I created quite a bit of confusion here, my deepest apologies.
At first I thought that you meant something like Python's PEP 8
That is exactly what I meant, but elevated to an "error status" of sorts. You decide on a coding convention and stick to it. This is especially important if your project has a long duration or if you're working with other people. If everyone codes in a different way (stylistically speaking) the resulting code will be harder to read and maintain.
[...], this is a breach of the single responsibility principle [...]
The "single responsibility principle" is a coding principle where something (a function or a class, for instance) should do one and only one thing.
Breaching this principle leads to creating "God objects", which are objects that "do everything" as well as other so-called "code smells".
To make a silly example: you wouldn't trust a light fixture that also dispenses water, right? It's doing too many things (it has too many responsibilities) and some of them collide with each other (from a safety perspective in this case). It's way better having a light fixture that lights up your room and a faucet for the water.
Did you meant that having more than a single Code Style is considered a breach?
In a way, yes. If the team decides on a coding style, they should stick to it. A "coding style breach" of PEP8 (although a minor one) could be having lines longer than 79 characters.
Reading code is already hard, you're focusing on what the code is doing, if how the code is written changes from one file to another (or even inside the same file!) this will just add one more thing you have to mentally worry about.
In conclusion, my usage of "breach" was more geared towards "infringement" than actual security issues.
Hopefully this helps a bit!
from 2dgd_f0th.
This makes sense, thanks man.
from 2dgd_f0th.
Related Issues (20)
- 4.18.2 Coroutines - A simple Typo HOT 1
- 5.3.6 Simulation - Typo? HOT 1
- 6.1.3 Writer - Simple Typo HOT 2
- 6.6.2 Cyclomatic Complexity - Definition with Example HOT 4
- 7.2.4 Levels and Environments - Typo HOT 1
- 7.2.5.6 Losing Conditions - Confused about theme HOT 2
- Duplicated "Two's complement" section HOT 1
- 8.3 Timing your Loop - Subsection Order HOT 9
- Migrate to MathML-compatible LaTeX math
- Consider moving Dot and PlantUML diagrams inside markdown HOT 1
- Consider Restructuring The Entire Work
- Odin Listings
- Zig Listings
- Rust Listings
- Tracking issue: Maintained and planned editions
- Trees
- Typo in 4.13.5 Other diagrams - Pseudocode Edition HOT 2
- 4.15.7 Stacks - What is a cleverly indexed array? HOT 6
- 4.16 Treating multidimesional structures like one-dimensional - What is width? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from 2dgd_f0th.