The short answer
A courtyard brings privacy, calm and an outdoor space shielded from the street, but it comes with trade-offs. The main drawbacks are less light and airflow for nearby rooms, heat or damp in the enclosed space, drainage that needs planning, noise that echoes, and the cost and space that the walls take up.
Light and airflow
Walls and roofs block light, so rooms around a courtyard can be dimmer than rooms with a full outside wall. How much depends on the height of the walls, the size of the space and which way it faces. A deep courtyard with tall walls may get little direct sun for much of the year. Enclosed spaces can also feel still on hot days, because the walls block breezes.
Heat, shade and damp
Hard paving and walls absorb and reflect heat, so a sunny courtyard can become uncomfortably hot in summer, particularly in warm climates. Planting, awnings or a pergola can help, but each adds cost and upkeep. The same enclosure that holds heat also slows drying: shaded corners can stay wet long after rain, and moss, algae and slippery patches are common results.
Drainage
Water from roofs and walls around a courtyard runs into the space, and it has to go somewhere. Without drains, or a fall that carries water to a drain or beyond the walls, a paved courtyard can pool water. Getting the fall right before the surface goes down is much easier than fixing it afterward, and patio grading slope covers the basics.
Debris and upkeep
Leaves, grit and seeds from nearby plants collect in the corners where walls meet the ground. Enclosed spaces often need more sweeping and gutter clearing than an open yard. Timber furniture or screens in a damp courtyard usually need more upkeep than the same items in open air.
Noise and echo
Hard walls reflect sound. Conversation, music and children playing can echo around a courtyard and carry into the rooms that face it. Walls also block street noise, so the effect cuts both ways.
Cost, space and planning
Walls, foundations and any roof add cost, and a courtyard takes up floor area or garden that could otherwise be rooms or lawn. In larger buildings, courtyards can affect escape routes and access for emergency services, so raise the point with a building professional early.
Weighing the trade-offs
The benefits are real. Privacy, calm and a sheltered outdoor space are the reasons many people choose a courtyard. A patio, which is usually open on at least one side, avoids some of these problems, and the difference between courtyard and patio lays out the contrast. If you do build a courtyard, plan for drainage, shade and upkeep from the start rather than fixing them later.