IT

Difference Between Procedural Language and Object Oriented Language

Procedural Language vs Object Oriented Language

Summary: Difference Between Procedural Language and Object Oriented Language is that in a procedural language, the programmer writes instructions that tell the computer what to accomplish and how to do it. With a procedural language, often called a third-generation language (3GL), a programmer uses a series of English-like words to write instructions. While Programmers use an object-oriented programming (OOP) language or object-oriented program development tool to implement objects in a program.

Difference Between Procedural Language and Object Oriented Language

Procedural Language

The disadvantages of machine and assembly (low-level) languages led to the development of procedural languages in the late 1950s and 1960s. In a procedural language, the programmer writes instructions that tell the computer what to accomplish and how to do it. With a procedural language, often called a third-generation language (3GL), a programmer uses a series of English-like words to write instructions.

For example, ADD stands for addition or PRINT means to print. Many 3GLs also use arithmetic operators such as * for multiplication and 1 for addition. These English-like words and arithmetic symbols simplify the program development process for the programmer.

As with an assembly language program, the 3GL code (instructions) is called the source program. Programmers must convert this source program into machine language before the computer can execute the program. This translation process often is very complex, because one 3GL source program instruction translates into many machine language instructions. For 3GLs, programmers typically use either a compiler or an interpreter to perform the translation.

Compiler

A compiler is a separate program that converts the entire source program into machine language before executing it. The machine language version that results from compiling the 3GL is called the object code or object program. The compiler stores the object code on storage media for execution later.

While it is compiling the source program into object code, the compiler checks the source program for errors. The compiler then produces a program listing that contains the source code and a list of any errors. This listing helps the programmer make necessary changes to the source code and correct errors in the program. A compiler translates an entire program before executing it. An interpreter, by contrast, translates and executes one statement at a time.

Interpreter

An interpreter reads a code statement, converts it to one or more machine language instructions, and then executes those machine language instructions. It does this all before moving to the next code statement in the program. Each time the source program runs, the interpreter translates and executes it, statement by statement. An interpreter does not produce an object program. One advantage of an interpreter is that when it finds errors, it displays feedback immediately. The programmer can correct any errors before the interpreter translates the next line of code. The disadvantage is that interpreted programs do not run as fast as compiled programs.

Hundreds of procedural languages exist. Only a few, however, are used widely enough for the industry to recognize them as standards. These include C and COBOL. To illustrate the similarities and differences among these programming languages, the figures on the following pages show program code in these languages. The code solves a simple payroll problem — computing the gross pay for an employee.

The process used to compute gross pay can vary from one system to another. The examples on the following pages use a simple algorithm, or set of steps, to help you easily compare one programming language with another.

C

The C programming language, developed in the early 1970s by Dennis Ritchie at Bell Laboratories, originally was designed for writing system software. Today, many programs are written in C. C runs on almost any type of computer with any operating system, but it is used most often with the UNIX and Linux operating systems.

COBOL

COBOL (COmmon Business-Oriented Language) evolved out of a joint effort between the United States government, businesses, and major universities in the early 1960s. Naval officer Grace Hopper, a pioneer in computer programming, was a prime developer of COBOL. COBOL is a programming language designed for business applications. Although COBOL programs often are lengthy, their English-like statements make the code easy to read, write, and maintain. COBOL especially is useful for processing transactions, such as payroll and billing, on mainframe computers.

Object-Oriented Programming Language

Programmers use an object-oriented programming (OOP) language or object-oriented program development tool to implement objects in a program. An object is an item that can contain both data and the procedures that read or manipulate that data. An object represents a real person, place, event, or transaction. A major benefit of OOP is the ability to reuse and modify existing objects.

For example, once a programmer creates an Employee object, it is available for use by any other existing or future program. Thus, programmers repeatedly reuse existing objects. For example, the payroll program and health benefits program both use the Employee object. That is, the payroll program would use it to process employee paychecks and the health benefits program would use it to process health insurance payments.

Programs developed using the object-oriented approach have several advantages. The objects can be reused in many systems, are designed for repeated use, and become stable over time. In addition, programmers create applications faster because they design programs using existing objects. Programming languages, such as Java, C#, F#, C++, and the latest versions of Visual Basic are complete object-oriented languages.

Object-oriented programming languages and program development tools work well in a RAD environment. RAD (rapid application development) is a method of developing software, in which the programmer writes and implements a program in segments instead of waiting until the entire program is completed. An important concept in RAD is the use of prebuilt components. For example, programmers do not have to write code for buttons and text boxes on Windows forms because they already exist in the programming language or tools provided with the language.

Most object-oriented program development tools are IDEs. An IDE (integrated development environment) includes tools for building graphical interfaces, an editor for entering program code, a compiler and/or interpreter, and a debugger (to remove errors, which is discussed later in the chapter). Some IDEs work with a single programming language, others support multiple languages.

Java

Java is an object-oriented programming language developed by Sun Microsystems. When programmers compile a Java program, the resulting object code is machine independent. Java uses a just-in-time (JIT) compiler to convert the machine-independent code into machine-dependent code that is executed immediately. Programmers use various Java Platform implementations, developed by Sun Microsystems, which provide development tools for creating programs for all sizes of computers.

.NET

The Microsoft .NET Framework, or .NET (pronounced dot net), is a set of technologies that allows almost any type of program to run on the Internet or an internal business network, as well as stand-alone computers and mobile devices. Similarly, ASP.NET is a Web application framework that provides the tools necessary for the creation of dynamic Web sites. Using .NET and/or ASP.NET, programmers easily can develop Web applications, Web services, and Windows programs. Examples of languages that support .NET include C++, C#, F#, Visual Basic, Delphi, and PowerBuilder. The following sections discuss each of these languages.

C++

Developed in the 1980s by Bjarne Sroustrup at Bell Laboratories, C++ (pronounced SEE-plus-plus) is an object-oriented programming language that is an extension of the C programming language. C++ includes all the elements of the C language, plus it has additional features for working with objects. Programmers commonly use C++ to develop database and Web applications.

C#

Based on C++, C# (pronounced SEE-sharp) is an object-oriented programming language that was developed primarily by Anders Hejlsberg, Microsoft chief architect and distinguished engineer. C# has been accepted as a standard for Web applications and XML-based Web services.

F#

F# (pronounced EFF-sharp), which is included with the latest version of Visual Studio (discussed in the next section), is a programming language that combines the benefits of an object-oriented language with the benefits of a functional language. A functional language is a programming language whose natural programming structure is useful in mathematical programs. Benefits of programs written in F# include easy access to .NET libraries and performance similar to that of C# programs.

Visual Studio

Visual Studio is Microsoft’s suite of program development tools that assists programmers in building programs for Windows, Windows Mobile, or any operating systems that support .NET. Visual Studio includes enhanced support for building security and reliability into applications through its programming languages, RAD tools, IDE, a specialized query language, and other resources that reduce development time. For example, Visual Studio includes code snippets, which are prewritten code and templates associated with common programming tasks. Visual Studio also includes a set of tools for developing programs that work with Microsoft’s Office suite. The following paragraphs discuss these programming languages in the Visual Studio suite: Visual Basic, Visual C++, and Visual C#.

  • Visual Basic is based on the BASIC programming language, which was developed by Microsoft Corporation in the early 1990s. This language is easy to learn and use. Thus, Visual Basic is ideal for beginning programmers. The first step in building a Visual Basic program often is to design the graphical user interface using Visual Basic objects. Visual Basic objects include items such as buttons, text boxes, and labels. Next, the programmer writes instructions (code) to define any actions that should occur in response to specific events. Finally, the programmer generates and tests the final program

Also Read:

Difference Between Low Level Language and High Level Language

Difference Between Low Level Language and Assembly Language

Difference Between Object Oriented Programming and Structured Programming

Difference Between Macros and Functions

Difference Between Compiler and Interpreter

Difference Between Control Structures and Control Statements

Difference Between Domain Name and Website