The Purpose of Programming Languages


When computers were first designed in the early twentieth century, they were created to carry out mathematical computations that, at the time, were performed by humans. Computers were preferred over man because they could perform the calculations faster, could work around the clock, and were not susceptible to error. That is, a computer doesn't forget to carry the one when subtracting two numbers, an error every human has likely made at some point.

Computers then, as computers today, were built to accept a sequence of instructions and to carry out these instructions in the order in which they arrived. This made computers ideal for solving problems that could be broken down into a sequence of simple steps. For example, addition of large numbers can be broken down into simpler addition problems by first adding together the ones place in both numbers, then the tens place, and so on, carrying over a digit into the preceding column if needed.

For a computer to solve a problem, though, it first needs to be told the sequence of steps to perform. Think of a computer as a very obedient young child, one who can understand only simple words and commands and will always do whatever you instruct. If you want this child to, say, go to sleep, you would have to tell him first to go to his bedroom, which might require that you first tell him to start walking toward the stairs. Then you would need to give instructions to step up the first step, then the second, and so on. After that you might need to tell him to walk down the hall to his room. You would then need to tell him to open his door, to walk into his room, to lie down in bed, and finally, to fall asleep.

The verbal commands you give the child must be fairly simple ones the child can understand. That is, if you said, "My beloved nipper, I implore that you acquiesce to slumber," the child would wonder what in the world you were saying. Similarly, when you're providing instructions to a computer, the instructions must conform to a specific syntax and structure.

Specifically, computers understand commands only from particular programming languages. A programming language is a language with a well-defined syntax and semantics.

There are multitudes of programming languages. When creating ASP.NET web pages, however, we are restricted to using .NET-compatible programming languages, such as Visual Basic and C#.

By the Way

There are many .NET-compatible programming languages, such as JScript.NET, COBOL.NET, Visual C++, and others. However, ASP.NET web pages are most typically created with either Visual Basic .NET or C#. In fact, Visual Web Developer provides support for using only one of these two languages.


Concepts Common to All Programming Languages

Although many programming languages are in existence, they all share some common features. These features include

  • A means to store data temporarily In Visual Basic variables are used to store data. We'll be discussing variables in the next section, "Declaring and Using Variables."

  • A set of operators that can be applied to the data stored in variables One such operator is +, which sums the values of two variables. We'll look at the operators available in Visual Basic in the "Visual Basic Operators" section.

  • A variety of control structures that can be used to alter the flow of instructions based on the value of variables The control structures in Visual Basic are covered in the next hour, "Managing Program Flow with Visual Basic's Control Structures."

  • A way to modularize source code into reusable units In Visual Basic, code can be compartmentalized into subroutines and functions, as we'll see in the next hour.

In this hour we will look at how the features of the first of these two universal programming languages are implemented in Visual Basic.




Sams Teach Yourself ASP. NET 2.0 in 24 Hours, Complete Starter Kit
Sams Teach Yourself ASP.NET 2.0 in 24 Hours, Complete Starter Kit
ISBN: 0672327384
EAN: 2147483647
Year: 2004
Pages: 233

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net