Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryIterator: name of Method AsPoints can be misleading #60

Open
karel-rehor opened this issue Feb 9, 2024 · 0 comments
Open

QueryIterator: name of Method AsPoints can be misleading #60

karel-rehor opened this issue Feb 9, 2024 · 0 comments
Assignees

Comments

@karel-rehor
Copy link
Contributor

Use Case

The Method on QueryIterator named AsPoints returns a pointer to an object of type PointValues. There is also the type Point.

Intuitively a developer could on first view expect a method named AsPoints to return an object of type or pointer to an object of type Point or a container holding objects of this type. When quickly coding Intellij IDE (And I imagine other IDEs as well) offers the Method AsPoints. Inattention to the actual return value can lead to this assumption. There are situations in which this misunderstood usage can compile, but at runtime leads to an NPE being thrown.

Expected behavior

Expect that a method returning a pointer or object of type PointValues to have a more intuitive name, when the return value can be confused with another type.

e.g.

  1. func (i *QueryIterator) AsPointValues() *PointValues{...}
  2. func (i *QueryIterator) AsValues() *PointValues{...}

Actual behavior

See Use Case section

Additional info

Changing the name of this method could of course break existing implementations. Adding this request for future discussion or review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant