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

[ADR] Core APIs language #37

Open
StevenMalaihollo opened this issue Mar 30, 2022 · 4 comments
Open

[ADR] Core APIs language #37

StevenMalaihollo opened this issue Mar 30, 2022 · 4 comments
Assignees
Labels

Comments

@StevenMalaihollo
Copy link
Contributor

Context

After deciding the API model, we need to agree on implementation details.
This document is focusing on the language selection for the core APIs (person API, org API, Affilitaions API, profile API)

Considerations

  1. Type validation
  2. Documentation API
  3. Code maintenance/readability
  4. Language popularity (libraries, community)
  5. Testing
  6. gRPC support

Possible languages

We shouldn't be introducing any new languages to BCC IT so we're going to choose from 3 that are already used

  1. Node js
  2. C#
  3. Golang

Language comparison

Node

Pros

  • The team is familiar with it
  • The most used language with most developers
  • Language is easy to learn and understand
  • Rich community with libraries allowing for testing, debugging, hot reloads
  • Same language as in the frontend, so it allows for code sharing

Cons

  • Higher latencies for API requests
  • Loosely typed
  • Stack traces are useless in async functions
  • NPM packages are often compromised (bad for security)

Remarks

  • It is possible to generate documentation and input validators from Typescript definitions

C#

Pros

  • Strongly typed
  • Input validation and documentation out of the box
  • Solid stack traces
  • Official packages provide good security (entity framework)

Cons

  • A lot of boilerplate
  • Steeper learning code
  • Not that well supported on VS Code
  • More difficult to dockerize

Remarks

  • Team has minimal experience with the language

Go

Pros

  • Strongly typed
  • Compiles to binary
  • Good testing framework
  • Easy to dockerize
  • Cross-platform support
  • Best performance

Cons

  • No experience in the team

Remark

  • Media is satisfied with the language

Decision

Because of insufficient experience with Go and C# we cannot make a decision 100% certainly, but based on research we feel like go is more likely to be the right choice, so we're going to implement the first API with go.
If the results are not satisfactory then we're going to re-evaluate

Consequences

  • We need to learn a new language which is going to take some time and effort.

Alternatives

  • Node: We want to avoid the mess of loosely type language causing data integrity issues
  • C#: Also a good alternative, but with our current knowledge it's better to go with Go
@github-actions
Copy link

Remember that ADRs are publicly available hence do not include any confidential information in the issue description!
To read more about ADR please refer to documentation.

@piotrczyz
Copy link
Member

We do have experience with .NET and we created building blocks that help to setup APIs with minimal effort. But Golang seems to be an interesting option.

@piotrczyz
Copy link
Member

Do we take the decision for the members project all do we consider to use the same language overall?

@rvanoord
Copy link
Member

The language choice can be made from service to service and team to team - different languages may be suitable for different scenarios.

However, leveraging both experience and libraries/patterns from other teams and projects should always be taken into the equation. This can be valuable both for speeding up development time and also when running into common issues.

Support the choice of GO for the first API in Members :-)

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

No branches or pull requests

4 participants