Domain names historically have been www.example.com, written also with the protocol prefix http://www.example.com, but in reality www. is optional, only example.com is actually needed.
www. is technically a sub-domain and sub-domains incur a small penalty in search engine optimization.
There is no right or wrong. What is important is that you choose one, and the other needs to be a 301 Permanent Redirect to the one you have chosen.
You also need to know that creating a server alias in your web server configuration, for example Apache or Tomcat is not a permanent redirect, in-fact it is technically duplicate content, with two web sites the same also incurring a penalty for search engine rating.
So what do the big players do. Here are a few.
Do not use www
Show duplicate content
Curiously youtube.com uses a 303 redirect, microsoft.com, stumbleupon.com and craigslist.org a 302 redirect.
How do you check? Use a CLI tool such as wget.
$ wget www.google.com --2008-09-22 19:56:48-- http://www.google.com/ Resolving www.google.com... 22.214.171.124, 126.96.36.199, 188.8.131.52, ... Connecting to www.google.com|184.108.40.206|:80... connected. HTTP request sent, awaiting response... 200 OK $ wget google.com --2008-09-22 19:57:56-- http://google.com/ Resolving google.com... 220.127.116.11, 18.104.22.168, 22.214.171.124 Connecting to google.com|126.96.36.199|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.google.com/ [following] $ wget www.facebook.com --2008-09-22 20:07:59-- http://www.facebook.com/ Resolving www.facebook.com... 188.8.131.52 Connecting to www.facebook.com|184.108.40.206|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/html] $ wget facebook.com --2008-09-22 19:59:43-- http://facebook.com/ Resolving facebook.com... 220.127.116.11, 18.104.22.168 Connecting to facebook.com|22.214.171.124|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://www.facebook.com/ [following] $ wget digg.com --2008-09-22 20:10:47-- http://digg.com/ Resolving digg.com... 126.96.36.199 Connecting to digg.com|188.8.131.52|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 15322 (15K) [text/html] $ wget www.digg.com --2008-09-22 20:14:06-- http://www.digg.com/ Resolving www.digg.com... 184.108.40.206 Connecting to www.digg.com|220.127.116.11|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://digg.com/ [following] $ wget twitter.com --2008-09-22 20:26:18-- http://twitter.com/ Resolving twitter.com... 18.104.22.168 Connecting to twitter.com|22.214.171.124|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2655 (2.6K) [text/html] $ wget www.twitter.com --2008-09-22 20:26:41-- http://www.twitter.com/ Resolving www.twitter.com... 126.96.36.199 Connecting to www.twitter.com|188.8.131.52|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: http://twitter.com/ [following]
Professionally, I prefer shorter and simpler without www.