One is an implied notion of objective rankings of worth of humans, and binary labels for people. Your post explicitly categorized “all criminals” and “all my friends” at disjoint sets. I can’t speak for your friends, but many of mine are “criminals” in the sense of disregard for drug laws. If you’re willing to sweep minor traffic violations under the heading “criminal” you’d probably sweep up most individuals with drivers licenses. Is the hypothetical person stealing so they (or their children) can eat irredeemable to you? There are certainly folks who on net do more harm than good, but rare are the people who truly only do bad to the world.
Second is a matter of perspective. If your friend started a new thing today, say learning the piano if they’ve never played an instrument, would you expect them to be good? If not, would you think less of them for trying? What if they’ve been playing for years, and one time when playing a song they’ve practiced many times they miss a few keys? Now replace the friend with yourself. Does your feelings about any of these change?
It’s not uncommon (especially in programmer types) to allow others more grace than we allow ourselves. You can be disappointed by your failures, and thrilled by your successes without impacting your sense of self worth.