3 ms·
For the example provided I would encapsulate that logic in the object itself returning a confirmed copy as a return. And as someone else pointed out I also muc
by javaunsafe2019 4y ago
For the example provided I would encapsulate that logic in the object itself returning a confirmed copy as a return.
And as someone else pointed out I also much prefer explicit code where you easily can understand what is going on…
- jeroenhd 4y agoI agree that I'd approach this in the form of (`val completed = order.approveAs(currentUser, Instant.now())` or maybe `val completed = orderService.approve(currentUser, Instant.now())`) myself. That doesn't require any specific programming language either. I was just using the example in the blog. However, I don't see Kotlin as a language that sticks to explicit code where you can understand what is going on. Between extensions, companion objects, infix methods and other syntactic sugar, I would say Java is much better in terms of code explicitness.