Learn the most popular programming language of the most popular Operating System: Windows

Ad

Procedure-Oriented and Event-Oriented Languages

Besides low-level and high-level languages, computer languages can be classified as procedure-oriented or event-oriented.  Procedure-oriented languages tend to run without human interference or the taking of some action by the user: A computer program is executed by a simple run instruction, and usually runs from top to bottom, with all the code executed until the program ends.  Event-oriented languages are different in that they depend on the user: They wait for the user to take some action before they execute.  The program waits for an event (or happening) to occur before beginning a program execution.

Procedure-Oriented Languages

Prior to 1990, most commercial high-level languages were procedure-oriented languages.  The emphasis in writing a computer program was to identify a set of processing tasks and to describe the steps important to each task.  Collectively, the set of tasks represented a procedure: a listing of a set of tasks required to perform an activity.  As an example, consider the procedure required in processing an employee paycheck, in which the steps of the procedure are expressed as tasks:

  1. Get employee name.
  2. Get hours worked.
  3. Get hourly wage.
  4. Multiply hours worked by the hourly wage to compute gross pay.
  5. Compute taxes based on gross pay.
  6. Subtract taxes and other deduction (such as union dues) from gross pay to compute net pay.
  7. Print the employee’s check.

This procedure could be used in writing a QBasic program. The following code listing shows a partial QBasic program written to print an employee’s check.  Even though you may not know the QBasic language, you should be able to understand, step by step, how the computer processes an employee paycheck.

'Compute and print a payroll check
'Initialize variables
emp.name$ = "Roger Rabbit"
pay.date$ = "06/12/99"
hours.worked = 40              
'Total hours worked
rate = 7.50                    
'pay per hour
tax.rate = 0.25                
'Tax percentage
'Compute gross and net pay
gross.pay = hours.worked * rate
taxes = gross.pay * tax.rate
net.pay = gross.pay - taxes
'Display the results
PRINT TAB(40); "Date: "; pay.date$
PRINT
PRINT "Pay to the order of: "; emp.name$
PRINT
PRINT "Pay the full amount of: "; gross.pay
PRINT TAB(28); "---"
PRINT
PRINT TAB(40); "------------------"
PRINT TAB(40); "W. Pinchpenney, treasurer"

Event-Oriented Languages

Event-oriented languages became possible with the advent of the Macintosh operating system for Apple Macintosh computers and Microsoft Windows for MS-DOS computer systems.  Both environments were designed to bring hardware and software together into a standard user interface by employing a graphical user interface, or GUI (pronounced goo-ey).  A GUI simplifies learning:  Once you learn how to work with one application using the interface, it is easy to learn another application because the interface remains the same.

An event-oriented language implies that an application (the computer program) waits for an event to occur before taking any action.  What is an event?  It might be the press of a key on the keyboard or the click of a mouse button.  With these events (these are many types), the computer waits for a key press or a mouse click (pushing a button on a hand-held mouse).

Share:

No comments:

Post a Comment

Trending

Popular Posts

Search This Blog

Powered by Blogger.

Featured Post

Coded Statements and Methods

In the preceding procedure , you wrote several coded instructions, which introduced two different programming statements and a method: the D...

Recent Posts