# convience-methods

* Generally, created to allow for mulitple inputs, or different types for an input
* Use overloading judiciously and sparingly
  * best to refrain from overloading methods with same number of params
  * avoid situations where the same set of parameters can be passed to different overloadings by the addition of casts
  * ensure that all overloadings behave identically when passed the same parameters
  * Have consistent argument order
  * Avoid long list of args, esp with same type
    * encapsulate in an object
* For constructors
  * use static factory methods
    * can return differetn subclasses in these methods
    * add validation, without polluting the constructor
    * avoid overloading the constructor


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hanfak.gitbook.io/workspace/general-paradigms/patterns/api/convience-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
