Java makes code durable through packages, classes, interfaces, records, exceptions, annotations, and tools that preserve names for years. Musi keeps the concern for contracts, but shifts where contracts live: records/data for shapes, classes/instances for behavior, Option/Result-like values for expected branches, and effects for work Java often hides behind services or exceptions.
Use this guide as a translation journal for Java code. Start with the familiar habit, then ask which Musi construct owns the same promise. A page is successful when it tells you which old instinct to keep and which old shortcut to drop.
Start from the habit that hurts
- Values, Methods, and Expressions - values habits get translated once, then the Musi Book owns the details.
- Blocks and Control Flow - blocks habits get translated once, then the Musi Book owns the details.
- Variables and Mutation - mutation habits get translated once, then the Musi Book owns the details.
- Records, Classes, and Objects - records habits get translated once, then the Musi Book owns the details.
- Collections, Streams, and Pipelines - arrays habits get translated once, then the Musi Book owns the details.
- Null, Option, and Result - absence and failure stop being side channels.
- Exceptions and Effects - outside work becomes a named request.
- Sealed Types and Patterns - patterns habits get translated once, then the Musi Book owns the details.
- Generics, Interfaces, and Laws - generics habits get translated once, then the Musi Book owns the details.
- Methods and Receiver Calls - calls habits get translated once, then the Musi Book owns the details.
- Packages and Modules - package boundaries replace compatibility-era habits.
- Testing and Tooling - testing habits get translated once, then the Musi Book owns the details.
- Native, Unsafe, and FFI - native edges stay narrow enough to audit.
Habits that still help
- Keep the Java habit of naming APIs for future readers.
- Drop class-as-container reflexes when a Musi record, data variant, or instance is the smaller contract.
- Keep examples tied to ordinary work: receipts, routes, files, animals, people, rooms, and services.
First false friend
Musi class is a behavior contract supplied by instances; records and data model object shape. If you need a person, car, invoice, or package, start with records or data. If you need any type that can compare, show, encode, or step, use a class with instances.
When to switch to the Musi Book
Stay in this guide while a Java habit is getting in the way. Switch to Values and let, Records, Patterns, Generics, Classes, and Effects when you need the source-of-truth rule.