Art is practice. They are one and the same. You have to learn to love practice or you don't really love the art.
Music and programming share this. I cringe thinking of my first programs. But I wrote many many more and they got better.
The musical slang for this is "shedding". At first, you sound so bad, you're exiled to the woodshed. But eventually shedding is just a thing you do. It becomes part of your practice.
When Charlie Parker was starting, he asked if he could sit in on a jam session. It didn't go well. He lost track of the changes while soloing. The drummer threw a cymbal at him.
A year later, Parker showed up at the same club and asked to sit in again. A couple of the band members remembered him, taunted him. This time though, he "cut heads" – jazz slang for dominating musically.
What changed? Parker turned his humiliation into determination, determination to avenge himself through practice. He said later he practiced up to fifteen hours a day during that period.
If you're just starting out with programming, think of yourself in the shed. Don't worry about your programs being great, just keep 'em coming.
At first, practice can be painful. With the guitar, you have to build up literal callouses on your fingertips. Creating the habit of practicing daily can be difficult.
Eventually, the pain can turn into joy. I love this phrase: it's not that I have got to practice, I get to practice. I look forward to it as its own reward.
Parker's determination did not turn into devotion, a practice of gratitude. He lived what we'd today call a rock star lifestyle: booze and drugs, casual sex, and a nasty attitude. When he died at 35, estranged from almost all family and friends, the coroner estimated his age as 50.
Part of art is longevity. Parker's sidemen Miles Davis and Dizzy Gillespie both lived into their seventies and released dozens of albums. Although they both credit Parker as the innovator, they each earned much more recognition. And although they also had personal challenges, I'm sure they experienced a much greater amount of joy overall.
Negative motivations like revenge and money are valid, but only effective in the short term. To borrow a phrase from surfing, I believe the greatest artist is the one who has the greatest amount of enjoyment.
Turn "got" into "get" and learn to love the shed.