<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_plain.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" id="Module.2004-02-25.2729">
  <name>1.1 - What is a program?</name>
  <metadata>
  <md:version>1.2</md:version>
  <md:created>2006/05/18 11:01:30 GMT-5</md:created>
  <md:revised>2006/05/18 11:20:39.651 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="nanand">
      <md:firstname>Naren</md:firstname>
      
      <md:surname>Anand</md:surname>
      <md:email>nanand@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="nanand">
      <md:firstname>Naren</md:firstname>
      
      <md:surname>Anand</md:surname>
      <md:email>nanand@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>ez430</md:keyword>
    <md:keyword>MSP430</md:keyword>
    <md:keyword>program</md:keyword>
  </md:keywordlist>

  <md:abstract>Explains what a computer program is.</md:abstract>
</metadata>

  <content>
<para id="program1">A <term>program</term> is a set of instructions that are grouped together to accomplish a task or tasks.  The instructions, called <term>machine code</term> or <term>assembly code</term> consist of things like reading and writing to memory, arithmetic operations, and comparisons.  While these instructions sound simple, it is actually possible to solve a huge group problems with them.  The difficulty in doing so is that you must specify in exact detail precisely how.  Good programming is both an art and a science, and what you will learn today is a beginning of the craft. 
</para>

<para id="program2">As mentioned above,  the individual instructions that the machine actually quite simple or <term>low-level</term> in computer parlance.  Writing complex programs in assembly code took such a long time that eventually better <term>programming languages</term> were invented.  A programming language, like C, is a formal set of grammar and syntax like assembly code; but the instructions in <term>high-level</term> languages encompass hundreds of assembly instructions.  Programs called <term>compilers</term> translate a program written in a higher level language into assembly so that the computer can actually execute the instructions.  Compilers let the programmer write programs so that humans can read them relatively easily while the computer can still execute the instructions. 
</para>

<para id="program3">Generally programming code is organized into text files with suffixes that indicate the programming language.  In the case of C these files are appended with ".c", and a C program is made up of at least one of these files.  Many C programs also use <term>header</term> files that contain frequently used segments of code so that it does not need to be written multiple times.  A ".h" is appended to the end of these files.  </para> 
  </content>
  
</document>
