You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/10/23 13:08:42 UTC

[GitHub] [maven] mthmulders commented on pull request #388: Refactor ProjectsCollector.collectProjects

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:
users@infra.apache.org