3 ms·
Wouldn't it be easier to write optional variables, allowing you to keep the same method name? This results in cleaner code that doesn't break existing usage. F
by SamuelAdams 8y ago
Wouldn't it be easier to write optional variables, allowing you to keep the same method name? This results in cleaner code that doesn't break existing usage.
For example:
func ListItems(query Query, limit int = 0, offset int = 0) Items {
// ....
}
- jniedrauer 8y agoThis only works in languages that support optional variables or overloading.
- relyio 8y agoIt doesn't result in a cleaner interface, which is what matters the most (arguably).
- lmm 8y agoIt would; unfortunately Java doesn't support that.