As far as I know, it doesn't really matter as long as it's vented outside. Venting into the attic is Very Bad -- in the winter, the humid air will condense and (if cold enough) freeze, and you'll effectively have water in the attic.
For any vents, the straighter the run is, the more efficient and quieter it is. Avoid corrugated pipes, and avoid bends and elbows as much as possible. For that reason, going into the soffit almost guarantees you'll have more bends than going through the roof.
- As an aside, I have two bathrooms, and they both have the identical fan (which is rated as very quiet). One bathroom has a 3" duct that is about 3' long, and goes almost straight out the side of the house (it's done with a small section of flex line that bends up and over be a couple inches, because I lined up the vent on the outside with the siding). The other bathroom vent has a 4" x ~6' line that has two sweeping turns and goes out the side of the house. The second one is noticeably noisier than the first.
As a DIY job, you'll also have to be sure you have the knowledge to cut a hole in the roof. I'd say it'd be far better to go out the side of the house (which is a bit easier to seal) than to go through the roof and cause a leak.
Cutting a hole through brick is no big deal. You could use one of these as a disposable hole saw for $20:
![enter image description here](https://i.stack.imgur.com/tCGZZm.jpg)
Or one of these as the "right" tool, which will be reusable for $75:
![enter image description here](https://i.stack.imgur.com/KLYGvm.jpg)
Most hole saws require a 1/2 inch drill plus a ~$10 arbor, both of which will be very useful for other projects in the future, like installing door knob sets in new doors, installing plumbing, ductwork, plenums, and all kinds of projects in plywood, sheet metal, lumber, plastics, etc.
When making the hole, take care to slant it slightly downward (2%—1/4 inch per foot—is typical) toward the outside to prevent rain, etc. from finding a path indoors. Install a vent device with a damper to prevent hot/cold air from coming inside when the fan is not on, and seal the hole at the outside surface thoroughly with silicon caulk.
Slate can be cut by this type of blade too, but holes through the roof are often fussier to make leak free.
Best Answer
As was said in the comments on your question, you get additional efficiency by clearing hot air in the attic in the process. Your house air is maybe 75-80* F, while your attic can be 100* or more. Ventilating the home and the attic results in greater overall cooling by reducing heat that would conduct back through any attic insulation.
I assume here that whole-house ventilation is used exclusively for cooling, and that we're not discussing heat recovery ventilators (HRVs), which are typically only used for bath and kitchen ventilation and are installed according to strict protocols, which wouldn't allow attic discharge.