Computers are tools for manipulating and analyzing information. Computer programs are the means f... more Computers are tools for manipulating and analyzing information. Computer programs are the means for specifying what actions a computer performs. This chapter will look at a simple computer program. Some specific elements covered are: ✓ High-level computer languages ✓ Compiled vs. interpreted languages ✓ A simple C++ program ✓ Specifying variables ✓ Assignment and mathematical operations Programming Languages Computers are among the most complex artifacts made by humans and are comprised of billions of distinct elements. Direct control of such complexity is beyond our abilities. Instead, computer programming relies upon the principal of abstraction to allow us to specify what actions a computer should perform. Abstraction Abstraction is the pruning away of complexity resulting in a simplified mental model of a process. For example, the driver of a car is not required to understand the mechanics of a car engine in order to drive. As long as there is a mental model that the gas pedal makes the car go faster, the brake slows the car, and the steering wheel makes the car turn, a driver can be reasonably effective. Note that this mental model is not really correct – pressing the gas provides torque to the wheels, which may or may not accelerate the car. This example highlights one danger of abstraction; in unusual situations, the simplified model may provide incorrect predictions. For this reason, computer programming practitioners should have some understanding of how computers operate as well as detailed knowledge of the programming language.
Computers are tools for manipulating and analyzing information. Computer programs are the means f... more Computers are tools for manipulating and analyzing information. Computer programs are the means for specifying what actions a computer performs. This chapter will look at a simple computer program. Some specific elements covered are: ✓ High-level computer languages ✓ Compiled vs. interpreted languages ✓ A simple C++ program ✓ Specifying variables ✓ Assignment and mathematical operations Programming Languages Computers are among the most complex artifacts made by humans and are comprised of billions of distinct elements. Direct control of such complexity is beyond our abilities. Instead, computer programming relies upon the principal of abstraction to allow us to specify what actions a computer should perform. Abstraction Abstraction is the pruning away of complexity resulting in a simplified mental model of a process. For example, the driver of a car is not required to understand the mechanics of a car engine in order to drive. As long as there is a mental model that the gas pedal makes the car go faster, the brake slows the car, and the steering wheel makes the car turn, a driver can be reasonably effective. Note that this mental model is not really correct – pressing the gas provides torque to the wheels, which may or may not accelerate the car. This example highlights one danger of abstraction; in unusual situations, the simplified model may provide incorrect predictions. For this reason, computer programming practitioners should have some understanding of how computers operate as well as detailed knowledge of the programming language.
Uploads
Papers by Aniket Patil