michaldo commented on pull request #709: URL: https://github.com/apache/commons-lang/pull/709#issuecomment-774952472
@garydgregory, explanation how `StopWatch` works would be much more demanding task that implementing `lap()`! The problem is that current `StopWatch` is good model how physical device works, but bad class to use in software development. It is over-complicated. First problem is state diagram (life-cycle). As a software developer, I want stop watch to measure how long runs some piece of code. I want get time spent between start and stop point, without learning stopwatch states. Second problem is API. The difference between *split* and *lap* must be clarified because both *exists*. Split is overhead, because every time I need split stopwatch time, I can just call `getTime()`. I'm afraid that current `StopWatch` passed point of no return: bringing back to operability needs rebuild from scratch. I don't know if it is acceptable in commons-lang. What do you think about creating new class, `SimpleStopWatching` with three methods: ``` static SimpleStopWatching.started(); SimpleStopWatching.getTime() SimpleStopWatching.lap() ``` ? That API is self-descriptive (I will add Javadoc of course), simple, without state diagram and functionally identical with `StopWatch`. For example *suspend/resume* can be implemented with two simple stop watched. `SimpleStopWatch` will match *commons-lang* spirit: classes from the library are not a rocket science, but saves developer write few lines of code. `SimpleStopWatch` match *commons-lang*, `StopWatch` match *joda-time* ---------------------------------------------------------------- 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]
