Java code to practical skills explosion

development tools

I do not know how many "old" programmers are still using Eclipse, these programmers either the beaten track, or else simply do not know there are other good development tools, Eclipse eat memory card Dayton phenomenon and various occasional inexplicable abnormal appearance, we are told that it is time to find a new development tool.

Replace the IDE

Simply do not want to explain what kind of IDE want to change, if you want to be a good Java programmer, replace IntelliJ IDEA. The benefits of using IDEA, search Google.

Do not tell me the shortcut does not work well

Replace the IDE is not my main focus of this article, so do not want to use too much space to write Why replace the IDE. Here, I can only tell you replace the IDE in order to better and faster just to write Java code. A Cause.

Do not tell me the shortcut does not work well, try new things.

bean

bean allows us to use one of the largest model, I will go to great length to explain the bean, I hope the reader a good experience.

domain name package

According to many Java programmers 'experience' point of view, a database table corresponds with a domain object, so many programmers write code at the time, the package name is used: com.xxx.domain, write seems to have become the industry's a constraint, database mapping objects should be the domain. But you are wrong, domain is a domain object, often we do the traditional Java Web development software, these are anemic domain model, there is no act or behavior does not have enough domain model, so to this theory speaking, these domain should be a common entity objects, not domain objects, so please read the package name: com.xxx.entity.

If you do not understand what I say, take a look at Vaughn Vernon out of a book called "IMPLEMENTING DOMAIN-DRIVEN DESIGN" (domain-driven design to achieve) the book, the book explains the difference between anemic model and domain model, I believe you It will benefit.

DTO

Data transmission should we use DTO objects as transport objects, this is what we agreed, because for a long time I've been working on mobile-side API design work, a lot of people told me that they think only to the transfer of data when the phone (input or output), these objects become DTO objects. Please note! This understanding is wrong, as long as the object is used for network transmission, we believe they can be used as a DTO object, such as electronic business platform, a single user data after the orders, the order will be sent to the OMS or ERP system, these return values ​​and docking to the Senate, also called DTO objects.

We agreed that if an object DTO objects, changed the name to XXDTO, such as OMS issued an order: OMSOrderInputDTO.

DTO transformation

As we know, DTO model object systems to interact with the outside world, then there will certainly be a step into the DTO objects BO object or objects is a common entity, so that service layer to deal with.

Guess you like

Origin www.cnblogs.com/xuyiding/p/11621901.html
Recommended