Hi everyone,
As per kinow (Bruno P. Kinoshita) recommendation, I'm writing to this mailing
list about commons-lang issue https://issues.apache.org/jira/browse/LANG-1099.
I created a pull request: https://github.com/apache/commons-lang/pull/47. This
generated a discussion between two possible solutions for shift operation for
arrays.
I'm proposing a solution in O(n) time complexity and O(1) space complexity. On
the other hand rfalke is proposing a solution in O(n) time complexity and O(n)
space complexity, arguing that the first solution, even though better from a
performance standpoint, could be harder to understand.
I hope I summarized correctly the discussion so far. What do you think?
In my opinion, especially taking into account that we're talking about a
generic library, I'll favor the optimized solution. I doubt that any user of
the library will complain about the code readability, as long as the solution
provided works as advertised. As the API is the same in both cases, users will
consider it a black box and will use it as such. If it would been an end-user
system and such options would have been affecting the overall architecture
decisions, then, depending on the performance requirements of the system, I'd
favor an easier to understand solution.
Thank you,
Adrian Ber