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

Avoiding get in Function Names #71

Open
beyzasgnms opened this issue Aug 2, 2024 · 4 comments
Open

Avoiding get in Function Names #71

beyzasgnms opened this issue Aug 2, 2024 · 4 comments

Comments

@beyzasgnms
Copy link

beyzasgnms commented Aug 2, 2024

A short summary of issue:
Using get in function names can lead to ambiguity and reduce the clarity of the function’s purpose. It often doesn’t convey the full action or result expected from the function.

Reasoning and motivation:
Using descriptive names instead of get helps to better communicate the function’s role and behavior. For instance, fetchUser() or retrieveUser() are more descriptive and suggest that some action beyond simply returning a value is being performed. This practice enhances code readability and maintainability, making it easier for developers to understand and work with the code.

Sources:
I reviewed Airbnb and Kodeco style guides but couldn’t find an example of this guideline. However, it was included in our previous code style guide.

@beyzasgnms beyzasgnms changed the title Function Naming Avoiding get in Function Names Aug 2, 2024
@eyupgoymen
Copy link
Contributor

I agree, since "get" has several meanings, we should be selective for prefixes. We can also consider properties and computed properties besides functions, they should not have "get" prefix too imo.

@aniltaskiran
Copy link
Member

Earlier version of this document has that logic. Actaully we choose it with team. I think existing rules should be stay. For example this one.

CleanShot 2024-08-02 at 12 08 54@2x

https://github.com/Trendyol/ios-guidelines/blob/b635320c45f40b8cd76ed4d0b18fc37a2ab84fe5/code_style_guideline/code_style_guideline.md#naming

@aniltaskiran
Copy link
Member

By the way, if you removed everything from the previous rules, we will talk about these topics again. I think this will make us waste time. Like this issue, we already agreed on that :D

@eyupgoymen
Copy link
Contributor

Since this rule was part of the previous guide and not existing in our guide, Workgroup will re-review existing rules by considering your comments next week and let you guys know about the action, thanks for your feedbacks 🙌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants