Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XS✔ ◾ rule updates for CTF #9612

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions rules/avoid-generic-names/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Generic names like “manager”, "helper", “processor”, “data”, and “

## Why generic names are problematic

Words like "manager" and "processor" imply something that handles various tasks, which can make it tempting to pile unrelated responsibilities into one class. "Helper" makes this worse as it becomes a catch-all for a collection of disorganized functionality.Names like "data" or "info" are similarly ambiguous, as they could apply to nearly anything, from a database connection to a simple string. Specific names are always preferable, as they make the code easier to understand and prevent code bloat from accumulating unrelated functionality.
Words like "manager" and "processor" imply something that handles various tasks, which can make it tempting to pile unrelated responsibilities into one class. "Helper" makes this worse as it becomes a catch-all for a collection of disorganized functionality. Names like "data" or "info" are similarly ambiguous, as they could apply to nearly anything, from a database connection to a simple string. Specific names are always preferable, as they make the code easier to understand and prevent code bloat from accumulating unrelated functionality.

:::greybox
`OrderManager` - a class to handle orders in an e-commerce system
Expand All @@ -41,12 +41,14 @@ Bad example - while this name suggests that it might have something to do with o
:::

:::greybox
`OrderCreator` - specifically creating orders
`OrderCreator` - specifically creating orders

`ShippingOrderHandler` or `OrderShipmentService` - specifically handles only one aspect - sending orders for shipment
:::
:::good
Good example - This name directly reflects its purpose, making it immediately clear what the class is responsible for
:::
:::


:::greybox
`UserData` - tracking the data for each user account
Expand Down
Loading