alibaba / alibaba/Alibaba-Java-Coding-Guidelines

Question for using wrapper class at POJO

Offen
#16 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Keine Sprachdaten
Sterne
1.1k
Forks
246
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Sorry, I don't know where is a suitable place to discuss the question, so I just open an issue here to ask my question.

I have a question about the 8th point of [OOP rules](https://github.com/alibaba/Alibaba-Java-Coding-Guidelines#oop-rules).
> 8. [Mandatory] Rules for using primitive data types and wrapper classes:
  1) Members of a POJO class must be wrapper classes.
  2) The return value and arguments of a RPC method must be wrapper classes.
  3) [Recommended] Local variables should be primitive data types.

Based on this rule, it will only allow us to use the primitive type in local variables. Then, we need to use wrapper classes in all other places.

The thing is that most of the suggestions I saw at the Internet is we should avoid wrapper classes as much as possible.
The reasons are
- performance
- memory footprint

So could anybody explain the reason behind this rule? Thanks. 🙏

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit den verknüpften OOP-Regeln, insbesondere Regel 8 und den Hinweisen zu primitiven und Wrapper-Typen. Ein nützliches Ergebnis wäre eine von einem Maintainer genehmigte Erklärung oder Klarstellung der Regel, aber im Issue wird keine Dokumentationsdatei und kein zu aktualisierender Test genannt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.