Cycling is a fantastic sport. It's been particularly prone to cheating through doping because there are a variety of drugs that can make a huge difference. The history has not been good. I'm not as familiar with the situation in swimming but I can see why there would be similarities.
Scientific advances and changes in doping methods have made detection difficult. In addition, the UCI (organizing body) has not done a good job of overseeing things, and has even looked the other way at times. But the situation is much better ATM. IMO calling pro road cycling a joke is a low blow, but that's partly because I have close relationships with athletes who I believe such statements unfairly tarnish. It's going to take a long time to rehab the image in the eyes of many people. The current testing situation involves a "biological passport." Athletes are routinely tested to measure their biological parameters, rather than to look for markers for specific drugs (which has proven virtually impossible). If the parameters change in non-natural ways the cyclist is suspended, even if the testers don't know why the change occurred. Multiple suspensions result in banishment. Most people familiar with the situation feel a lot more comfortable with the cleanliness of the sport than they ever have before. I'm sure some people will always assume cycling is dirty no matter what the current reality is. Unfortunately clean athletes will always pay the biggest price for the actions of dirty athletes.