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

rewrite style guide #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

rewrite style guide #1

wants to merge 1 commit into from

Conversation

itayzit
Copy link

@itayzit itayzit commented Aug 3, 2023

No description provided.

- Scope size correlates to amount of possible interactions (in a scope, the reader must assume that any two elements can interact).

Therefore perhaps the only objective metric by which a design can be examined is code length.
- Bug occurrence is correlated with amount of code. The more code you write, the more bugs you create.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nitzo do you agree with those 3 lines?


Some forms of duplication are easy to spot, simply by the noisy feeling you get reading them.
Put your core logic at the center, and remove "fluff" code that might confuse the reader.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I agree with this statement.


Code reviews are a great tool to enhance code quality and stability. It works like this:
## Before we start, some values

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect something more broad and a bit less opinionated.

I would expect a general guideline covering things below and then a specific guideline for Python and JS. There general rules on how we code that are language agnostic.

Function and Method Guidelines:
Provide best practices for writing functions and methods, including rules on function length, single responsibility principle, and error handling.

Error Handling:
Specify how to handle exceptions and errors in a consistent manner across the codebase.

Code Styling:
which tools we use for code styling

Testing Guidelines:
If applicable, include guidelines for writing unit tests and test case naming conventions. Encourage developers to write testable and modular code.

Security Considerations:
Address security-related coding practices, such as handling user input, avoiding SQL injection, and preventing common vulnerabilities.

Performance Guidelines:
Provide guidelines for writing efficient code and avoiding common performance pitfalls.

Code Reviews:
Outline the code review process and expectations. Mention the roles and responsibilities of team members during code reviews.

Integration and Deployment:
If relevant, include guidelines for integrating code into the main branch and deploying to production environments.

Frameworks and Libraries:
If your project uses specific frameworks or libraries, provide guidelines on how to use them effectively and consistently.

Deprecated Code and Legacy:
Address how to handle deprecated code and legacy systems while maintaining code quality.

Error Messages and Logging:
Specify guidelines for writing clear and informative error messages and setting up logging practices.

Consistency Over Personal Preference:
Emphasize the importance of consistency over personal coding preferences, encouraging developers to adhere to the agreed-upon style guide.


If a function starts with some logic of when the core logic should occur, factor this logic out.
Make sure every word in the function name is meaningful. Therefore, words like ```get```, ```run```, ```process```, ```make```, ```handle```, ```do``` can most times be removed or replaced with a more specific verb like ```fetch```, ```read```, ```load``` etc.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it important? cc: @nitzo

@danielbentov
Copy link

I do find this style guide strongly opinionated (even with the removals). I do wonder if we should focus on clear principles but give people a bit more room and avoid code review comments on things that, to me, are not really important.

For example:
Make sure every word in the function name is meaningful. Therefore, words like get, run, process, make, handle, do can most times be removed or replaced with a more specific verb like fetch, read, load etc.

I have never seen a style guide that goes into those details.
We also want it to be lightweight so people will actually follow it.

This is a very good example (nothing on naming conventions):
https://warpdev.notion.site/How-We-Code-at-Warp-257fe43d556e4b3c8dfd42f70004cc72

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

Successfully merging this pull request may close these issues.

2 participants