Often known as a junction box, the special metal or plastic box includes a cover to protect the wiring within and protect you from the wiring.
The first clue that a device is designed to be used without a junction box is that it has its own complete housing. And it generally will not have any wire leads extruding from it, because these wires are contained inside a wire connection compartment. Common examples of electrical devices that require no junction boxes include:
Recessed lights ("can lights")
Bathroom ventilation fans
Wall-mounted heaters
Fluorescent tube-style light fixtures
Garbage disposers
Baseboard heaters
Many permanently installed appliances, such as kitchen vent hoods, dishwashers, and hot water heaters also don't require junction boxes. With these devices, if the electrical wires will be exposed or run outside of a wall, ceiling, or floor cavity, the wires must be contained inside metal armored cable rather than in standard non-metallic (NM) cable.