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

refactoring strategies #85

Open
brothercorvo opened this issue Aug 4, 2024 · 0 comments
Open

refactoring strategies #85

brothercorvo opened this issue Aug 4, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@brothercorvo
Copy link
Contributor

brothercorvo commented Aug 4, 2024

in priority order

Refactor Long Functions:
Identify functions that are longer than 20-30 lines and break them down into smaller, single-responsibility functions. This will enhance readability and testability.

Enhance Error Handling:
All the functions should be protected within exceptions. Review error handling throughout the codebase to ensure consistent and informative error messages. Use custom exceptions where appropriate to provide more context.

Enhance Type Annotations:
Ensure all functions have type annotations for parameters and return types.
Parameter Type Annotations: Each parameter in the function has a specified type. For example, a: int indicates that a should be an integer.
Return Type Annotations: After the parameter list, the return type is specified using ->. For example, -> int indicates that the function should return an integer.

Improve Documentation:
Add docstrings to all public classes and methods, explaining the purpose, parameters, and return values. This will help new contributors understand the code more easily.

Configuration Management:
when configurations or any sort are still hard-coded, consider moving them to configuration files or to configuration object .

Centralize Logging:
logging will be used throughout the project, using a central logging component. Prepare each function to log results into the log utility.

Optimize Imports:
Review and optimize imports to remove any that are unused. Group imports logically and follow PEP 8 guidelines for import ordering.
Imports should be grouped into three distinct sections, separated by a blank line between each group:

  • Standard Library Imports: These are the imports from Python's standard library. Examples include modules like os, sys, json, datetime, etc.
  • Related Third-Party Imports: These are imports from external libraries that are not part of Python's standard library, such as requests, numpy, pandas, etc.
  • Local Application/Library-Specific Imports: These imports are specific to your project and typically refer to other modules or packages within your codebase.

Test Coverage:
Ensure that all components have corresponding unit tests performed at the facade level . Use test coverage tools to identify areas lacking tests and focus on achieving higher coverage.

Leverage Python Data Classes:
For classes that primarily store data, consider using Python's dataclass to reduce boilerplate code and improve readability.
the dataclass can be still extending node is node persistency strategy SQLAlchemy is correctly defined

@brothercorvo brothercorvo added the documentation Improvements or additions to documentation label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant