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

refactor: Refactor to an object-oriented codebase #26

Open
shreyass-ranganatha opened this issue Oct 7, 2023 · 1 comment
Open

refactor: Refactor to an object-oriented codebase #26

shreyass-ranganatha opened this issue Oct 7, 2023 · 1 comment

Comments

@shreyass-ranganatha
Copy link
Member

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
Copy link

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!

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

No branches or pull requests

2 participants