The novelty requirement of the Patent Act, generally under §102, exists to prevent people from getting patents over inventions that already exist in the world.  Of the basic requirements for receiving a patent, the novelty requirement is the most complex.
§102(a) of the Patent Act contains the most basic aspects of the novelty requirement. No patent will be granted for an invention that is already "known or used by others in this country." Obviously, this prevents people from patenting things that we all use every day, which would severely disrupt innovation and commerce.
In examining the novelty of an invention, the Patent Office will search previous patents and published literature for occurrences of elements of the invention. For inventions in older sciences such as chemistry and physics, there are established journals and databases for the office to turn to. For computer science, however, there is less of an organized infrastructure of information on general practices and known methods. This is one of the reasons that many feel that software patents are much too easy to receive.
An invention will be considered known to others in this country if the invention has been fully disclosed in some way, and if the disclosure was accessible to the general public of the United States. "Full disclosure", for the purposes of §102(a), does not have the usual meaning. Instead, an invention is fully disclosed if it has been actually or constructively reduced to practice. This means that the invention was either constructed, or someone has written down how to build or practice the invention.
In addition, the general public must have access to the disclosure. Like the disclosure limitation, this limitation is not as weak as one might think. An invention might be considered disclosed to the general public if one talks about it to people who have no obligation to keep quiet. 
Similarly, an invention is considered to have been used by others in this countryand hence to be ineligible for a patentif someone in this country has used the invention for the purpose it was invented. In the middle 1800s, an inventor developed an improvement to the then-stylish corsets (a corset, like a brassier, is worn underneath clothing and is not visible). The inventor's wife used the improved corsets for several years, until the inventor realized that the improvement might be valuable and patented the invention. Later, a company infringed on the patent, but was able to have the patent voided due to the wife's use.  One method of examining whether or not an invention was in public knowledge or use is to determine if the products of the invention have been "on sale." If such a sale has occurred, then the invention cannot be patented. Note that this "on sale" doctrine refers to the products of the invention, not to any legal rights in the invention itself (such as contract to sell the patent rights). 
The novelty requirement does have an exception allowing the inventor to experiment on the invention. Since the utility requirement necessitates that the inventor show that the invention is workable and useful, some experimentation on the invention may be required. If the inventor makes public use of an invention for the purposes of testing the invention's efficacy, and not to test the invention's marketability, then the novelty requirement will not be breached. There are several additional considerations that surround experimental use, including: whether the inventor maintained strict control over the invention, whether the experimentation concerned the core of the invention itself or some ancillary aspect of the invention, and whether publicly accessible experimentation was necessary .
Finally, there is also interplay between novelty and trade secret. If one person has an invention, but keeps the invention secret, than a subsequent inventor will not be prevented from obtaining a patent on the same invention . This is one trade-off for inventors to consider when choosing between patent and trade secret: trade secret protection might potentially last indefinitely, as long as no one figures out the secret. Patent protection only lasts for twenty years, and requires disclosure of the invention to the public, but it confers very strong legal rights during the term of the patent.