Hacker News new | past | comments | ask | show | jobs | submit login

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 {
  // ....
  }



This only works in languages that support optional variables or overloading.


It doesn't result in a cleaner interface, which is what matters the most (arguably).


It would; unfortunately Java doesn't support that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: