# Getting Started

## What This Project Does

This Java project demonstrates **source code header and license management patterns** — covering the full spectrum from no header at all, to MIT License headers, standard formatted headers with version control metadata, partial headers, and extreme long-form version history headers. It serves as both a reference implementation and a practice ground for deciding how your team's source files should declare copyright, license terms, and change history.

## Recommended Reading Order

1. **NoHeader.java** — The simplest case. Zero header overhead.
2. **WithHeader.java** — A standard formatted header using Japanese-style documentation fields (処理名 = processing name).
3. **MitLicense.java** — The canonical open-source license block template.
4. **PartialHeader.java** — When you need only a module name and functional summary, without version lines.
5. **Crosslink.java** — Minimal class with an inline version-controlled field annotation (how version tags appear inside code).
6. **LongHeader.java** — The edge-case file. A header with 250+ version-change entries. Use this to understand the upper bound of what a file header can contain and when to stop putting metadata in the source file.

## Key Entry Points

| File | Purpose |
|------|---------|
| [Crosslink](src/main/java/Crosslink.java) | Demonstrates inline version annotation via a Java field comment (`v72.00.00 ANK-4427-00-00 ADD START`). Shows how version tracking can appear inside the class body rather than the file header. |
| [LongHeader](src/main/java/LongHeader.java) | The most complex file — a header block containing **250+ version entries** (v01.00.00 through v250.00.00). Illustrates how version history can balloon when every change is logged inline. |
| [MitLicense](src/main/java/MitLicense.java) | The simplest licensed file — one block comment with the MIT License boilerplate. Good starting point when adding a license to a new project. |
| [NoHeader](src/main/java/NoHeader.java) | A class with no comment header at all. Useful when a file lives inside a larger project where the license is declared in `pom.xml` or `LICENSE` instead. |
| [PartialHeader](src/main/java/PartialHeader.java) | A header containing only module name (モジュール名) and function summary (機能概要) in Japanese. Shows when to include project-internal metadata without the full version-line noise. |
| [WithHeader](src/main/java/WithHeader.java) | The reference "standard" header — formatted with a separator line, processing name (処理名), version, JIRA-style ticket ID, and author. This is the template to copy for new files. |

## Project Structure

```
src/main/java/
├── Crosslink.java       – Inline version tracking pattern
├── LongHeader.java      – Long-form version history
├── MitLicense.java      – MIT License header
├── NoHeader.java        – No header
├── PartialHeader.java   – Partial module header (Japanese)
└── WithHeader.java      – Standard formatted header
```

There are no sub-modules, build configurations, or test directories in this repository. All code lives in the single `src/main/java/` source root.

## Architecture Overview

```mermaid
flowchart LR
    Start["Getting Started"] --> ReadFirst["Read Project Structure"]
    ReadFirst --> KeyClasses["Study Key Classes"]
    KeyClasses --> Build["Build & Verify"]
    Build --> Modify["Make Changes"]
    Modify --> Commit["Commit with Proper Headers"]

    subgraph src["src/main/java/"]
        Crosslink["Crosslink.java<br/>Inline version tracking"]
        LongHeader["LongHeader.java<br/>Long version history"]
        MitLicense["MitLicense.java<br/>MIT License header"]
        NoHeader["NoHeader.java<br/>No header"]
        PartialHeader["PartialHeader.java<br/>Partial header"]
        WithHeader["WithHeader.java<br/>Standard header"]
    end

    KeyClasses --> src
```

The classes fall into two categories:

- **Header templates** — `WithHeader.java`, `MitLicense.java`, `PartialHeader.java`, `NoHeader.java`. These are reference implementations of different header styles.
- **Versioning patterns** — `Crosslink.java`, `LongHeader.java`. These show how version metadata is stored either inside a class body field (`Crosslink`) or bloated across 250+ lines in a single comment block (`LongHeader`).

## Configuration

This project has no build files, CI configs, or external configuration. There is no `pom.xml`, `build.gradle`, `settings.json`, or `.env` file. The project consists of standalone `.java` files that can be compiled with a single command:

```bash
javac src/main/java/*.java
```

Each class is a top-level, default-package class. There are no dependencies, no imports, and no runtime configuration to manage.

## Common Patterns

### Header format convention

The project uses a consistent block-comment header with a separator line (`-----`). When the header contains version history, each line follows this pattern:

```
v<version>  <ticket_id>  <author>
```

Example from `WithHeader.java`:

```java
/**
 * ------------------------------------------------------------------------
 * 処理名     ： 発行SODCC
 * ------------------------------------------------------------------------
 * v72.00.00  ANK-4427-00-00  X.Nguyen
 */
public class WithHeader {}
```

Fields used in headers:
- **処理名** (shori-mei) — Processing name / class purpose
- **モジュール名** (modoru-mei) — Module name
- **機能概要** (kinou-gaiyou) — Functional summary

These appear when the header is written in Japanese (as seen in `PartialHeader.java` and `WithHeader.java`).

### Inline version tracking (Crosslink pattern)

When a file needs internal change tracking, `Crosslink.java` shows an alternative: place version annotations inside a comment immediately before a field, bracketed by `ADD START` / `ADD END` markers:

```java
// v72.00.00 ANK-4427-00-00 ADD START
private String field = "";
// v72.00.00 ANK-4427-00-00 ADD END
```

This avoids inflating the file header (avoiding the `LongHeader` anti-pattern) while still keeping change history near the code it describes.

### When to use which header

| Scenario | Use this |
|----------|----------|
| New file in a licensed project | `MitLicense.java` header |
| New file in a proprietary repo | `WithHeader.java` header (copy the template) |
| Module-only metadata needed | `PartialHeader.java` header |
| File with no external license declaration | `NoHeader.java` (no header) |
| Tracking changes inside a class body | `Crosslink.java` inline pattern |

### The LongHeader anti-pattern

`LongHeader.java` exists as a **negative example**. A 250+ line header comment makes the file harder to navigate, pushes actual code off-screen, and creates merge conflict noise. When a file's header grows beyond ~20 lines, move the detailed change history to an external changelog, issue tracker, or release notes — not the source file.

## Quick Commands

| Action | Command |
|--------|---------|
| Compile all files | `javac src/main/java/*.java` |
| Compile a single file | `javac src/main/java/WithHeader.java` |
| Run a class (no `main` method) | N/A — these are template classes with no entry point |
