Home > Back-end >  Today development interface, receive the caller parameters using the map, the leader says I low, let
Today development interface, receive the caller parameters using the map, the leader says I low, let

Time:05-21

Background: others let me provide an interface, internal calls, the reference is defined, only two parameters, and I have the vo class is not coincidence, use a post request, if I build a vo alone is a little waste, so I just use the @ RequestBody Map receiving, leadership let me change, want to do you have the relevant specification or reasons for why can't write?

CodePudding user response:

 bosses who can help explain the younger brother

CodePudding user response:

You can hold a ali coding standards

CodePudding user response:

Few parameters directly defined String userId String bookId can
Build a more actually vo not bother entity class ah, convenient extension after
Naming conventions can be simple and clear

CodePudding user response:

Use the benefits of vo is code readability is very high, can immediately know what are the parameters, but don't know what are the key map, and you don't define this map, the request. GetParameterMap is parameter in it

CodePudding user response:

PO, VO, BO know

CodePudding user response:

Build a vo not bother, less than a minute, but physical analogy map more constraints and also more intuitive, more simple, maintain the map almost no constraint, strongly typed can reduce the communication cost and maintain

Actually, according to my idea is that you return the value returned Data I feel not perfect, this is pure code duplication, direct return objects can
To combat it under your leadership ~
https://blog.csdn.net/educast/article/details/82863570

CodePudding user response:

Vo + the validator + swagger2 + unified exception handling

CodePudding user response:

reference thin black camel died 4 floor response:
using the benefits of vo is code readability is very high, can immediately know what are the parameters, and map all don't know what are the key, and you don't define this map, the request. GetParameterMap there is parameter
this is only a personalized interface parameters... Even the readability is adjustable as defined

CodePudding user response:

The
reference 5 floor baidu_41833867 reply:
PO, VO, BO know
is too personality, I can't come to a personality to others to define a VO... So I will use the map in this character, the leader says to get rid of, norm, I just don't know where the specification is this accept parameters

CodePudding user response:

refer to the second floor lkwahl response:
you can hold a ali coding standards
ali specification can't sweep out using the map to receive...

CodePudding user response:

General or build a dot or vo, so straightforward, if separation using sawwger before and after the end, also can do it through annotation interface documentation comments. Using the map to receive, generally do not do so, indeed, it should be said low...

CodePudding user response:

11 references weixin_43869905 response:
general or build a dot or vo, so straightforward, if separation using sawwger before and after the end, also can do it through annotation interface documentation comments. Using the map to receive, generally do not do so, indeed, it should be said low...
in fact, we do so, reason is followed to do so

CodePudding user response:

People development and try to avoid the map, the key is you don't use the map to write good comments, I will let you change,

CodePudding user response:

You wrote, front end staff do not know to send what parameters to you, what legal parameters, which parameters required, after you left, how others know you need a map? Don't let other people look at the code to check what? Even the interval for a long time, even you all forget this map what parameters are needed,

CodePudding user response:

The only way is through comments need to explain what, but remember, all look not to understand others, oneself also don't understand, the annotation is needed to know what are you doing in the code, code is very low,

CodePudding user response:

First, you this is a post request, you have to do a check request parameters, you'll have to put all the parameters from the get out of the map, and then judge can is empty, whether regular meet, whether in a reasonable scope, etc., or more troublesome, write a entity class receives, cooperate with some annotation type check is very convenient, that is why it is not recommended in map receiving,

CodePudding user response:

: actually, I feel you are entangled with low this vocabulary, leader said low mean I feel that no general meaning, do you think leadership really say you technology is poor

CodePudding user response:

Set up the DTO, use swagger2, really

CodePudding user response:

On the map parameter is cancer of the industry
  • Related