Sensor networks are not just data networks with sensors being the sources of data. Rather, they are often developed and deployed for a specific application, and the entire network operation is accordingly geared toward satisfying this application. For overall system efficiency, it may be necessary for nodes to perform computations on data, as opposed to simply originating or forwarding data. Thus, the entire network can be viewed as performing an application-specific distributed computation. The topic of this article is to survey some lines of research that may be useful in developing a theory of in-network computation, which aims to elucidate how a wireless sensor network should efficiently perform such distributed computation. We review several existing approaches to computation problems in network settings, with a particular emphasis on the communication aspect of computation. We begin by studying the basic two-party communication complexity model and how to optimally compute functions of distributed inputs in this setting. We proceed to larger multihop networks, and study how block computation and function structure can be exploited to provide greater computational throughput. We then consider distributed computation problems in networks subject to noise. Finally, we review some randomized gossip-based approaches to computing aggregate functions in networks. These are diverse approaches spanning many different research communities, but together may find a role in the development of a more substantial theoretical foundation for sensor networks.