# Practice & Exercise

## 1. Identifier Naming Best Practices

**Task:** Write a function that checks if a given number is a perfect square.

* **Requirements:**
  * Name the function appropriately, following identifier naming best practices.
  * Use meaningful parameter names and return a boolean value indicating whether the number is a perfect square.
* **Example Input:** `16`
* **Expected Output:** `true`

## 2. Class and Interface Naming

**Task:** Create a class that models a library book.

* **Requirements:**
  * Name the class and its properties in a way that clearly conveys their purpose.
  * Include properties for the book title, author, and ISBN number.
  * Implement a constructor to initialize these properties.
* **Example Usage:** Create a `Book` object with Title: "1984", Author: "George Orwell", ISBN: "123-4567890123".

## 3. Method and Property Naming

**Task:** Implement a method that calculates the factorial of a non-negative integer.

* **Requirements:**
  * Choose a clear and descriptive name for the method.
  * Use meaningful parameter names and ensure the return type is appropriate.
* **Example Input:** `5`
* **Expected Output:** `120`

## 4. Variable and Boolean Naming

**Task:** Write a function that determines if a person is a minor.

* **Requirements:**
  * Define a meaningful function name and use clear variable names for the parameters.
  * Return a boolean indicating if the person is under 18 years old.
* **Example Input:** `17`
* **Expected Output:** `true`

## 5. Naming Patterns for Self-Documenting Code

**Task:** Create a function that reverses a string.

* **Requirements:**
  * Use an appropriate name for the function that reflects its action.
  * Ensure the parameter and return values are named clearly to avoid confusion.
* **Example Input:** `"hello"`
* **Expected Output:** `"olleh"`


---

# 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://emmanueldonkor.gitbook.io/high-quality-programming/naming-conventions-and-best-practices/practices-and-exercises.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.
