oss-reva / gitscribe

discord bot for github repo and issue info retrieval.
https://pypi.org/project/gitscribe/
MIT License
9 stars 12 forks source link

refactor: Refactor to an object-oriented codebase #26

Open shreyass-ranganatha opened 1 year ago

shreyass-ranganatha commented 1 year ago

The GitHub REST API implementation gitscribe/apis/github.py and the Discord Bot gitscribe/_discord.py are all currently implemented in a functional programming paradigm. Although a welcoming point for beginners, it can be extremely limiting when expanding the project. Let's make use of what Python is great at and refactor the codebase to an object-oriented approach.

Checkpoints:

  1. gitscribe/_discord.py should define a DiscordBot class instead of having a pre-defined bot object which is the current implementation.

  2. gitscribe/apis/github.py should have different classes for Repository, Issue, etc.

    requires discussion:

    • is there a better GitHub REST API python wrapper?
    • would it be more logical to shift to the GitHub GraphQL API for our needs?
  3. scripts/gitscribe Should build an object of the new DiscordBot class and run it from within

Ref: #23

lcrojano commented 1 month ago

Proposal for Refactoring Gitscribe to an Object-Oriented Approach with DDD Principles Hi @shreyass-ranganatha ,

I would like to propose a refactor of the Gitscribe codebase to adopt an object-oriented approach while incorporating Domain-Driven Design (DDD) principles. This will help us create a more maintainable, scalable, and robust architecture. Here are the key points:

Refactor Discord Bot: Create a DiscordBot class to encapsulate all functionalities, enhancing modularity and flexibility.

Refactor GitHub API: Introduce classes for different entities (e.g., Repository, Issue) based on DDD principles to ensure that our code aligns with the business domain and improves clarity.

Domain Model Creation: Develop a domain model that accurately reflects the core concepts and relationships within the project, facilitating better collaboration and understanding among team members.

Explore Alternatives: Consider using established GitHub API wrappers (like PyGithub or Github3.py) and evaluate the benefits of transitioning to the GitHub GraphQL API for more efficient data retrieval.

I believe these changes will greatly benefit the project. I’d love to discuss this further and align on the refactoring strategy. Thank you for considering!