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

Separate concerns into targets/modules #177

Open
adamjcampbell opened this issue May 29, 2020 · 1 comment
Open

Separate concerns into targets/modules #177

adamjcampbell opened this issue May 29, 2020 · 1 comment
Labels
task A task that needs doing

Comments

@adamjcampbell
Copy link
Contributor

❕ Problem Statement

Currently the main target/module AppStoreConnectCLI imports all other dependencies. As we move past simple commands into more complex synchronisation it'll be more important to separate our concerns.

💬 Task Description

Separate different concepts into their own modules, namely models and their encodings moving to Model and network calls and transformations moving to Network. This leaves the main target to deal with command line input and translating intent to the correct services to call down to. This also alleviates name collisions

👩‍🔧 Technical Design Notes

Model

Houses our concept of stored and rendered data for the CLI tool

  • Includes models structs
  • Includes information about how to serialise the models in their respective formats
    • e.g. JSON, CSV, YAML, Tables

As such model will import Yams, SwiftyTextTable and CodableCSV

Network

Takes in input options and translates these to API calls. Translates API models returned from the AppStoreConnectSDK into CLI Models to return to the caller.

  • Houses extension on Model to initialise them with API data
  • Should expose functions to return requested CLI Models
  • Keeps it's reactive implementation internal so that the caller can call it's functions in a blocking manner

Network would import Model, Combine and AppStoreConnect-Swift-SDK
As this is where a lot of the logic is housed there is potential for it to be broken up further. But that could stay internal to the Network module... It's definitely the spot that would need the highest test coverage

Filesystem

Exposes functions to retrieve CLI models or write CLI models from disk

  • Knows the concept of a sync filesystem setup
    • e.g. default locations and folder heirarcy
  • Pulls data from disk turning it into CLI models or writes CLI models to disk in the right (or provided) locations

Filesystem would depend on Model and Files

AppStoreConnectSDK

Takes command line input, validates it and calls the appropriate functions on Network or Filesystem

  • Owns the concepts that come with the command line
    • Validates command line input
    • Has a renderer to output serialised CLI models to stdout and errors to stderr

The entrypoint to the CLI tool would import ArgumentParser, Model, Network and Filesystem

🤝 Relationships

Supersedes the domain layer concept described in #41

@adamjcampbell adamjcampbell added the task A task that needs doing label May 29, 2020
@adamjcampbell
Copy link
Contributor Author

This is just a draft, feedback on the design is welcomed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task A task that needs doing
Projects
None yet
Development

No branches or pull requests

1 participant