Menu

#61 Confusing API - HtmlForm

closed
None
5
2012-10-21
2004-12-07
No

HtmlForm has the following methods:

getInputByName()
getInputByValue()
getInputsByValue()
getAllInputsByName()

It took me forever to find getAllInputsByName() because
of the extra "all" in the name, I was expecting
getInputsByName(). I'm sure this happens all the time...

Discussion

  • Brad Clarke

    Brad Clarke - 2004-12-07

    Logged In: YES
    user_id=257129

    Which form should we be using? I can see the usefulness of
    getThingsByXXXX() since it will appear in your IDE next to
    the other methods but getAllThingsByXXXX() is more explicit.
    The former seems to be used more than the latter but there
    are a few of each throughout the code.

     
  • Daniel Gredler

    Daniel Gredler - 2004-12-09

    Logged In: YES
    user_id=1109422

    As you say, I've seen the mixture throughout the code.
    Objectively, consistency one way or the other would be
    ideal. Subjectively, I prefer getThingsByXXX( ) rather than
    getAllThingsByXXX( ) for two reasons:

    1. The methods will show up together in the IDE (as you
      point out).
    2. A getThingsByXXX( ) method logically has to return all
      Things that match the specified parameter, so the "All" in
      the method name seems superfluous.
     
  • Brad Clarke

    Brad Clarke - 2005-04-29

    Logged In: YES
    user_id=257129

    I changed the one you wanted and a few others but I left
    DomNode.getAllHtmlChildElements() because I really don't
    know what else to call it :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.