City gardeners who want to grow edibles typically face two big obstacles: too little land and not enough sunlight. Buildings and trees rob outdoor areas of light, which is good for humans wanting to get out of the sun but a huge impediment to raising veggies and herbs.

You may read in magazines and books that you can eke out a crop in darker corners by growing such things as parsley, carrots or lettuce and by painting fences and walls white for increased reflective light. This is nonsense, in my experience. Veggie gardens need open and sunny locations to be successful and productive.

The value of planting things in a container is that you can position your vegetative vessel in that one sunny corner of the patio, or on a south- or west-facing balcony or, best of all, on the roof. Roof gardens have their own requirements, for sure. You need a strong, flat roof with access to water, and its edges have to be safe for everyone.

Whatever the location, the best advice is this: Forget a million little pots and spring for the largest freeze-proof planting box you can afford. This will give your plants the critical mass of soil they need to avoid constant stress.

This principle has been taken to glorious extremes this summer with the transformation at the top of the University of the District of Columbia’s College of Agriculture, Urban Sustainability and Environmental Sciences at the Van Ness campus in Washington. In July, the college officially opened a 20,000-square-foot garden in the sky that consists of a greenhouse, a central green roof and, at its perimeter, dozens of large containers where garden manager Sandy Farber has overseen the planting and care of vegetables, herbs and flowers.

Each container is six feet long, two feet wide and 18 inches high, although the soil layer extends down to about half that depth. (The rest is taken up with weight-saving polystyrene.) Weight is an issue, and the plants are growing in a purpose-made light mixture of sand, compost, humus and volcanic rock.

In July, the University of the District of Columbia officially opened a 20,000-square-foot garden in the sky

A hundred feet or so above the street, the containers are part of a loftier mission to develop an urban agriculture program aimed at connecting people in food deserts to affordable and nutritious vegetables. But from a simple gardening perspective, the boxes prove, too, that there is a lot of stuff you can grow in containers. Admittedly, this assemblage is on a grand scale. There are 117 containers that by my tally offer a growing area of more than 1,400 square feet.

I saw the rooftop garden in June but decided to check back to see how its first summer had gone. The answer? Far better than the gardeners imagined.

“I thought maybe we would have 1,000 pounds of produce. We aren’t done yet, and we have already exceeded 3,000 pounds,” said Farber, who is also the city’s Master Gardener program coordinator. The harvest has been distributed to food banks.

The spicy bush basil, now pulled, yielded 100 pounds. In 17 boxes where Farber and her team grew cucumber vines behind rows of Swiss chard, she harvested 800 pounds of cukes.

Only a dozen veggie types have been grown. The section of boxes devoted to tomatoes, for example, contains just Cherokee Purple. The 20 containers of peppers have a sweet-fruited hybrid named Vanguard, loaded with blocky green peppers waiting to redden. The curious gardener may find this varietal restraint too limiting — I would have grown a different tomato in each box — but in terms of yield, it seemed a good strategy.

“Between yesterday and today,” Farber said, “we harvested 124 pounds of tomatoes.” Each container holds three vines, trained espalier-like onto the metal grid fences that surround the roof. The foliage looks unusually healthy and clean for so late in the season, a product in part of the near-constant breeze up here.

Even with the drip irrigation that cycles through the containers each day, watering is needed.

For the gardener, this phenomenon mitigates the heat of the sun and also chases away mosquitoes and gnats. There has been a bit of bird pecking but none of the banes of terrestrial gardens — rats, squirrels, chipmunks or voles. Pests and diseases have been largely absent, no doubt thanks in part to its being a fresh garden where the nasties have yet to build up.

The trade-off is in extra care, especially watering. Even with the drip irrigation that cycles through the containers each day, watering is needed. “Things dry out considerably more up here,” Farber said.

She puts the unexpected yields down to the fertility of the soil, the abundance of sunlight and the care of the gardeners. She was pleasantly surprised that the plants didn’t scorch, as she had feared. “We thought the wind would be stronger and would be a problem, but it really hasn’t been,” she said.

The varieties were selected by Che Axum, director of the school’s Center for Urban Agriculture and Gardening Education.”I was looking for crops that would withstand high temperatures,” he said.

In future seasons, he hopes to try varieties specifically developed for container gardening, along with those with high nutrient density, such as protein-rich okra.

In late summer, boxes along the roof’s northern edge are full of tall, purple-podded okra and the pretty yellow flowers that herald them. “I’m getting people to eat raw okra now I never thought I would get to try okra. Sliced and sprinkled with a little sea salt,” Axum said. Proving that you can take your container gardening to a higher plane.