mthmulders commented on pull request #388:
URL: https://github.com/apache/maven/pull/388#issuecomment-715329957


   > Can you tell what the purpose is behind this change?
   
   I identified this opportunity for improvement when I was working on 
[MNG-6118](https://issues.apache.org/jira/browse/MNG-6118), but that was 
complex enough already so I decided to postpone this little improvement and 
refactor it separately. 
   
   I think methods that `return` their results are better than methods that 
expect an argument which they can fill with a result, as the latter typically 
leads to code like this:
   
   ```java
   List<?> whatever = new ArrayList<>();
   doSomething(whatever, other, arguments, that, are, needed);
   ```
   
   which obscures the fact that the `whatever` will be modified by invoking 
`doSomething`. After this change, the same code would look like this:
   
   ```java
   List<?> whatever = doSomething(other, arguments, that, are, needed);
   ```
   
   This is shorter and more clear (intention-revealing) IMO.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to