# (DD06) Business Logic — ConsoleUI.registerMember() [5 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `ui.ConsoleUI` |
| Layer | Controller |
| Module | `ui` (Package: `ui`) |

## 1. Role

### ConsoleUI.registerMember()

`registerMember()` is a user-interaction method in the console presentation layer that collects the minimum member registration data required by the application: the member name and email address. It acts as a thin orchestration step that bridges human input from the terminal to the domain registration service, rather than performing any business validation or persistence logic itself. The method follows a delegation pattern: it reads the input values, forwards them to `libraryService.registerMember(name, email)`, and then immediately prints the returned `Member` object for user confirmation.

In business terms, this method supports the member onboarding flow for the library system. It is specifically responsible for the interactive registration path used by the console menu option that creates a new member record. The method has no branching logic of its own, so it always executes the same linear flow: request name, request email, call the service, and display the registered result.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["registerMember()"])
    N1["Prompt user for name
InputUtils.readLine(\"Name: \")"]
    N2["Prompt user for email
InputUtils.readLine(\"Email: \")"]
    N3["Call libraryService.registerMember(name, email)"]
    N4["Print registered member result
System.out.println(\"Registered: \" + result)"]
    END_NODE(["Return / Next"])

    START --> N1
    N1 --> N2
    N2 --> N3
    N3 --> N4
    N4 --> END_NODE
```

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| - | (none) | - | - |

This method accepts no parameters. It relies on console input as the external data source and reads the following instance field at runtime: `libraryService`, which is the application service used to create the member record.

## 4. CRUD Operations / Called Services

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| C | `libraryService.registerMember(String name, String email)` | - | `model.Member` / member repository persistence | Creates a new member domain object, assigns a generated member identifier, persists it through the repository, and returns the newly registered member for confirmation. |
| R | `InputUtils.readLine(String prompt)` | - | Console input | Reads interactive user input for the member name and email from the terminal. |
| R | `System.out.println(String message)` | - | Console output | Displays the registration confirmation message to the user after creation completes. |

`ui.ConsoleUI.registerMember()` itself does not directly access a database table. Its only business-impacting CRUD effect is the create operation delegated to `LibraryService.registerMember()`, which constructs a `Member` object and stores it through `MemberRepository.add()`.

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

No screen/batch entry points found within 8 hops. Direct callers found: 2 methods.
Terminal operations from this method: -

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Screen:ConsoleUI | `ConsoleUI.mainMenu` -> `ConsoleUI.registerMember()` | `libraryService.registerMember(String, String) [C] model.Member` |
| 2 | Batch/Main | `Main.main` -> `LibraryService.registerMember(String, String)` -> `ConsoleUI.registerMember()` | `libraryService.registerMember(String, String) [C] model.Member` |

## 6. Per-Branch Detail Blocks

**Block 1** — [SEQUENTIAL] `(start)` (L73)

> Begins the interactive member registration flow from the console UI.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `InputUtils.readLine("Name: ");` // read the member's display name |

**Block 2** — [SEQUENTIAL] `(continue)` (L74)

> Captures the email address that will be associated with the new member profile.

| # | Type | Code |
|---|------|------|
| 1 | EXEC | `InputUtils.readLine("Email: ");` // read the member's contact email |

**Block 3** — [SEQUENTIAL] `(continue)` (L75-L76)

> Delegates member creation to the application service and immediately renders the returned member for user confirmation.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `libraryService.registerMember(name, email);` // create and persist a new member |
| 2 | EXEC | `System.out.println("Registered: " + ...);` // display the newly registered member |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `registerMember` | Method | Console menu action that gathers member data and initiates creation of a new library member record. |
| `libraryService` | Field | Application service dependency used to execute member registration business logic. |
| `InputUtils` | Utility | Console input helper used to read free-form user responses from standard input. |
| `readLine` | Method | Reads a single line of text from the terminal for a given prompt. |
| `Member` | Domain model | Library member entity containing identity, name, and email information. |
| `id` | Field | Generated member identifier used to uniquely identify a registered member. |
| `name` | Field | Member display name captured during registration. |
| `email` | Field | Member contact email captured during registration. |
| CRUD | Acronym | Create, Read, Update, Delete — standard data operation classification. |
| UI | Acronym | User Interface — the console-facing presentation layer. |
| Controller | Layer | Presentation-layer component that coordinates user input and application services. |
| repository | Technical term | Persistence abstraction responsible for storing and retrieving domain objects. |
