How can fish swim in the dark without hitting objects?

Fish have what is known as a lateral line, running down each side of
the body, from behind the eyes to the base of the tail. You may be able
to spot this in some cases, as a lighter streak evident near the midline on the side
of the fish’s body. It is a tube beneath the skin filled with a
jelly-like substance, which is very sensitive to vibrations and
connects directly to the brain.

The lateral line works rather like
radar. As the fish swims, so it can detect waves in the water being
reflected back off obstacles in its path such as rocks, or the approach
of a likely predator, enabling it to take appropriate avoiding action.
With this highly efficient system to guide them, so your fish will
therefore avoid colliding with obstacles in their aquarium.

The
only case where you may be advised to adjust the decor in the aquarium,
and not include any rocks, is if you are intending to keep the
so-called bubble-eyed goldfish, a variety distinguished by the large
swellings under each eye. These fish can occasionally puncture their
sacs on a rough, protruding piece of rock as they swim around their
quarters.