Everybody loves Google because they do a great job at everything, but there are two things I noticed on YouTube.com that my fellow flash developers should avoid in their Flash applications.

While watching a video I noticed debug statements appearing in my FlashTracer window. Although it is pretty common to see similar debug statements on websites that have flash content, it should not be common and it is very easy to remove these statements for production content.

99% of these statements were typical, but there were a couple that irked me; look at the two lines of text I highlighted in the left column of this screenshot:

YouTube.com screen capture

Although it is hilarious to see these statements in code from a reputable company, they still irked me. Not because I was offended by the “bad” fucking language, but because most people know a developer who has been burned by writing these type of statements and they never learn. Google can get away with this because nobody is really going to be offended and they’re their own client. But, when I’m working for a client I follow these two rules:

  1. Never put anything in your code that you don’t want your client or boss to see.
  2. When you do comment your code, be professional enough to omit them when you compile for production! Not because the content of the statements might be unprofessional, because having any statements at all in your production code is unnecessary.

Here are some other funny examples of code I have seen in applications that should be omitted for production…

  • The connection just got tea bagged - reset and reload
  • Fuck bandwidth detection script its taking too long or not working so fuck it hard
  • This feature does not work and crashes the player fix laterz
  • HACK HACK HACK HACK HACK this scuks

When you compile/publish in Flash, remember to select “Omit Trace Actions” in the publish settings to prevent your trace statements from appearing in the compiled swf.

The best part about the google debug statements, is that you can see them for yourself by installing the FlashTracer add-on for Firefox and the Debug Flash Player, then browse over to YouTube.com and watch a video. And, although I named this post after Google, you could also look at another example of what not to do in this article. It’s about a bunch of unprofessional comments from some Microsoft Win2K source code.