Home >Java >javaTutorial >Identifying the objects of the best championship table API you've ever seen!

Identifying the objects of the best championship table API you've ever seen!

Linda Hamilton
Linda HamiltonOriginal
2024-11-12 05:05:01845browse

Identificando os objetos da melhor API de tabela de campeonatos que você já viu!

In the last text, we ended with a loose idea of ​​what our input and output JSONs could look like.

I went further and asked an LLM to model those requirements in JSON format, so that things were even clearer. Let's see if this helps us?

{
  "nomeCampeonato": "String",
  "equipes": [
    {
      "id": "Integer",
      "nome": "String",
      "localizacao": "String",
      "grupo": "String",
      "subGrupo: "String"
    },
    ...
  ],
  "formatoCampeonato": {
    "divisaoPorGrupos": Integer,
    "grupos": [
      {
        "id": "Integer",
        "nome": "String",
        "equipes": ["Integer"],

      },
    ],
    "turnosDentroGrupo": "Integer",
    "turnosEntreGrupos": "Integer",
    "sorteioGrupos": "Boolean"
  },
  "calendarioConfig": {
    "tabelaOtimizada": "Boolean",
    "totalJogosPorDia": "Integer",
    "diasDescanso": "Integer"
  }
}

Let's understand what LLM brought us:

  • An object called teams, containing the name of the team and its location;
  • An object called FormatCampeonato, which defines how many groups the teams will divide into and brings us, embedded, a group object;
  • The group object is where the teams are organized. Think that in the Brasileirão, for example, we would only have one object like this, with 20 teams. In the Libertadores, we would have 8 "group" objects, with 4 teams each.
  • Within the Championship format we also define whether and how many shifts there will be between teams within the same group and between teams from different groups. Remember that in Paulistão (until 2024), for example, there are 4 groups where teams play one round against teams from other groups and do not play against teams from their own group.
  • formatCampeonato also defines whether we are the ones who will have to draw the groups or whether the user will send everything ready. That's why we have the group and subgroup fields there in the teams object.
  • And, to finish, the calendarioConfig object, which defines calendar issues, such as number of games per day, number of rest days that a team should have between one game and another and our "secret sauce": optimization travel!

Well, if you've studied object orientation a little, you know that these JSON objects that we model here are great candidates for becoming classes in our code, right?

In the next text, we will analyze whether each JSON object like this is eligible to generate a class in our backend and we will also talk a little about the architecture of our Tabelão.

We continue.

The above is the detailed content of Identifying the objects of the best championship table API you've ever seen!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn