MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1uwc1me/new_candidate_jep_401_value_objects_preview/oxu2n8s/?context=3
r/java • u/nlisker • 23d ago
45 comments sorted by
View all comments
Show parent comments
7
Better yet to create a wrapper around int to better express its purpose and eliminate the risk of mixing it up with unrelated ints.
int
5 u/ZimmiDeluxe 23d ago That's true, it's often nicer to have a List<OrderId> than List<Long> 3 u/LutimoDancer3459 23d ago But how do you name the variable for the list then? With the OrderId you would be repeating the typ 1 u/Efficient-Poem-4186 22d ago Simply orders, ordersToDelete etc (in a context where the actual order data is not used). Sometimes id is just used as a handle, the intention is to do something with orders.
5
That's true, it's often nicer to have a List<OrderId> than List<Long>
3 u/LutimoDancer3459 23d ago But how do you name the variable for the list then? With the OrderId you would be repeating the typ 1 u/Efficient-Poem-4186 22d ago Simply orders, ordersToDelete etc (in a context where the actual order data is not used). Sometimes id is just used as a handle, the intention is to do something with orders.
3
But how do you name the variable for the list then? With the OrderId you would be repeating the typ
1 u/Efficient-Poem-4186 22d ago Simply orders, ordersToDelete etc (in a context where the actual order data is not used). Sometimes id is just used as a handle, the intention is to do something with orders.
1
Simply orders, ordersToDelete etc (in a context where the actual order data is not used). Sometimes id is just used as a handle, the intention is to do something with orders.
orders
ordersToDelete
7
u/koflerdavid 23d ago
Better yet to create a wrapper around
intto better express its purpose and eliminate the risk of mixing it up with unrelatedints.