People, especially those who do not run, ask me what I think about when I go on (long) runs, since I'm a mid-distance runner.
My answer is that most of the time it is a form of meditation. I concentrate on my breathing, clear my mind, and sometimes I close my eyes for a few seconds to get "in the zone". It helps release and control stored up energy I may have that I feel causes tension, pressure, and anxiety.
Sometimes while running, I have thought up of solutions to problems that have been bothering me. The best way I can describe this "event" is that wakefulness that occurs deep in the night (past midnight) and you feel lucid and are productive in whatever it is you are doing.
For me I practice sitting meditation, walking meditation, and yoga. Creating art, painting and photography, are also both highly meditative experiences that I enjoy immensely.
I've made great effort to meditate while coding, but I have found it to be nearly impossibly as my mind needs to change its pace in order to solve problems. Keeping with mindful breathing while coding is possible and very beneficial.
One of the greatest benefits of meditation, as you mentioned, is for problem solving. Solutions come when you 'allow' them to. Walking meditation is very effective for this. I keep a timer and take a 5 minute walk for every 25 minutes of work.
They're certainly mindful, but I like to distinguish the mindfulness of meditation from the mindfulness of concentration on something specific.
When you're concentrating on something like coding or creating art, the thoughts themselves provide the framework of your mindfulness and drive your mind's focus.
When I'm meditating, I try to create that intensity of mindfulness without the framework of something specific to concentrate on. By learning to separate the focus from the things that I focus on, I feel I'm doing something more fundamental with my brain.
It helps if I clarify my approach to painting and photography, as both I do without much mental involvement, and with mindfulness.
My painting is highly abstract and very repetitive, so I am free to meditate through most of the process.
The meditative state of my photography is mostly in relation to being present in the moment, before or after my gear is set up, and I can be quite mindful while pressing the shutter release.
The final result is a distilled meditation on the moment.
I agree that any complex task makes meditation difficult.
I guess the people who've asked me must not know much about meditating. I admit I only have a superficial knowledge of it, as well. The people I've talked to see meditating more of a 'relaxing' experience, I guess.
I will look into it more now, though.
The ultimate "goal" is transcendence, which untethers your consciousness from your physical body and is quite a liberating experience.
The catch to it all, is that you can't have a goal while meditating, other than to be present in the moment, which is an admirable goal in itself.