04.08.2014 Views

o_18ufhmfmq19t513t3lgmn5l1qa8a.pdf

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 23<br />

■ ■ ■<br />

Project 4: In the News<br />

In this project, you see how you go from a simple prototype without any form of abstraction<br />

(no functions, no classes) to a generic system in which some important abstractions have been<br />

added. Also, you get a brief introduction to the nntplib library.<br />

WHAT IS NNTP?<br />

Network News Transfer Protocol (NNTP) is a standard network protocol for managing messages posted on<br />

Usenet discussion groups. NNTP servers form a global network that collectively manage these newsgroups,<br />

and through an NNTP client (also called a newsreader) you can post and read messages. Most recent Web<br />

browsers include NNTP clients, and separate clients exist as well.<br />

For more information about Usenet, you may check out the informational Web site at http://<br />

www.usenet.org.<br />

What’s the Problem?<br />

The program you write in this project will be an information-gathering agent, a program that<br />

will be able to gather information (more specifically, news) and compile a report for you. Given<br />

the network functionality you have already encountered, that might not seem very difficult—<br />

and it isn’t, really. But in this project you go a bit beyond the simple “download a file with urllib”<br />

approach. You use another network library that is a bit more difficult to use than urllib, namely<br />

nntplib. In addition, you get to refactor the program to allow many types of news sources and<br />

various types of destinations, making a clear separation between the front-end and the backend,<br />

with the main engine in the middle.<br />

■Note Refactoring means improving the design of an existing program, usually by adding abstraction<br />

and structure.<br />

439

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!