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

More modular structure #32

Open
chshersh opened this issue Mar 11, 2021 · 0 comments
Open

More modular structure #32

chshersh opened this issue Mar 11, 2021 · 0 comments
Labels
refactoring Refactor, improve code quality, pay tech debt

Comments

@chshersh
Copy link
Contributor

Current structure of modules is a bit messy:

GitHub
  GitHub.Author
  GitHub.Connection
  GitHub.GraphQL
  GitHub.Id
  GitHub.Issue
  GitHub.Label
  GitHub.Lens
  GitHub.Milestone
  GitHub.Order
  GitHub.PullRequests
  GitHub.Render
  GitHub.Query
  GitHub.Repository
  GitHub.RequiredField
  GitHub.Title
  GitHub.User

Current problem is that we have fields for different types (title of issue, login of user, etc.) and we also have different connections with input parameters (issue by state, pullrequests, etc.). Some connections can be polymorphic, so to abstract further, it's better to separate types.

I propose a new structure with clearer boundaries (and probably avoiding recursive dependencies).

I will write in a shorter syntax for clarity. Mostly duplicates the GitHub API structure:

GitHub
  Types
    Connection
    Issue
    Milestone
    PullRequest
    User
    Id
  Connections
    Labels
    Issue  -- issue by number
    Issues  -- list of issues
    PullRequests
    Milestones
  Interface
    Actor  -- has author name
  Enums
    IssueState
    PullRequestState
    IssueOrder
  Queries
    Repository
    Viewer
  Mutations
    CreateIssue
    AddAssigneesToAssignable
  GraphQL
    Query
    Mutation
    Render
  API  -- calling remote API, better name needed
    Common
    Query
    Mutation
  Abstraction  -- local abstractions for better UX and UI, better name needed
    Lens
    Author  -- HasAuthor typeclass and instances
    Title  -- HasTitle typeclass and instances
    RequiredField

With this structure, it's clear what to add and where:

  1. All new types go to GitHub.Types.
  2. All new connections for those types use types and go to GitHub.Connection
  3. New read-only queries and mutations go to the corresponding sections.
  4. Functions to call GitHub API are in the GitHub.API module.
  5. Our local helpers in GitHub.Abstraction
@chshersh chshersh added the refactoring Refactor, improve code quality, pay tech debt label Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactor, improve code quality, pay tech debt
Projects
None yet
Development

No branches or pull requests

1 participant