The virtues of canned beans can't be denied: They offer a significant time savings, are almost always cooked perfectly, and don't taste half bad. But whenever someone tells me that their dried beans don't taste much better than canned, I know instantly that they're not cooking the dried beans right. Follow just a couple of simple rules, and I guarantee that your cooked-from-dried beans will be worlds better than anything you can get from a can.
The first rule is to season them properly with salt. The common wisdom says to do that only after cooking them, but, as Kenji has shown, you should actually salt both the bean-soaking water and the bean-cooking water for best results. Since he's written about that at length, I'm going to focus on the second rule here: Always add aromatics to the pot.
It may sound too basic to be true, but aside from salt, there is no more drastic way to improve the flavor of your dried beans than to cook them with flavor-enhancing vegetables and fragrant, woodsy herbs.
There's very little to the method itself, which I use no matter the bean recipe. After soaking the beans and draining the soaking water, transfer them to a pot, fill it with cold water, and then add a bit more salt, along with whichever aromatics are available. Bring the water to a low simmer, then cook it all together until the beans are tender. Those aromatics in the pot will revolutionize the beans' final flavor.
The aromatics I tend to use are onions, carrots, garlic, and celery, and then heartier, woodsy herbs, like rosemary, sage, and thyme, which marry beautifully with the earthy-sweet flavor of beans. If I have rosemary, sage, and thyme, I might put a sprig of each in; if I have only one of them, then I'll add a couple of sprigs. I try not to be too fussy about the specifics, and am extremely casual about quantities. If I don't have celery and carrots, then I'll just toss in an onion and a few cloves of garlic, plus the herbs. No herbs? Probably not worth a special shopping trip just to get them. If I'm at the market and know I'll be cooking some beans, though, I always try to grab the most essential aromatics (onion, carrot, and garlic) and at least one of the herbs.
That said, it's fun to experiment, as well as to keep the geographic origins of the dish you're making in mind. Maybe some leftover fennel bulb or fronds will find their way into my bean pot one day, or perhaps I'll reach for a different herb, like Mexican epazote, if I'm going to be making refried beans on another occasion.
On lazy days (i.e., most days, at least for me), I just toss the vegetables into the pot and deal with fishing them out later, which can be a little tricky after slowly simmering them to the point of turning them to mush. As for the herbs, I'll often tie up rosemary and thyme with some kitchen twine (or stash them in a tea infuser), since their small leaves can otherwise fall off and get scattered throughout the pot—a lazy person does not want to stand around hunting for rosemary needles in a pot of cooked beans, ever.
If I'm being particularly obsessive about my need to retrieve every last bit of the aromatics, I'll tie them all up in a cheesecloth bundle, making their ultimate removal extremely easy.
I'll leave it up to you to decide whether to go commando or create a cheesecloth sling, just as long as the aromatics end up in the pot one way or another. Because leaving them out isn't much better than reaching for the canned stuff.