alibaba / alibaba/Alibaba-Java-Coding-Guidelines

Question for using wrapper class at POJO

Đang mở
#16 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
1.1k
Fork
246
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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. 🙏

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với các quy tắc OOP được liên kết, đặc biệt là quy tắc 8 và hướng dẫn của quy tắc này về các kiểu primitive và wrapper. Một kết quả hữu ích sẽ là phần giải thích hoặc làm rõ quy tắc được maintainer phê duyệt, nhưng issue không nêu tệp tài liệu hay bài kiểm thử nào cần cập nhật.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
20/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.