Characteristics of higher level language
the common Major characteristics of higher level language are as follow:
- Interactive:
The major advantage of higher level language is that they are interactive. They allow user to interact with program through sophisticated input-output statement while program is being executed on a system. The GUI (Graphical User Interface) is very common in modern softwares. the visual language supports the development of GUI software. The example includes Microsoft visual basic, Microsoft CC++, Java and many more.
- Variety of data types:
A unique objective of any program written in any programming language is to process the data. Different category of problems need different types of information or data to be processed. Also particular data is having different range of values in different application. To allow a flexibility needed by problems for which programs are to be developed, programming languages support variety of data types with various sizes.
Data types are broadly categorized in two categories : Basic and User defined. The basic types include data types for characters, integers and real values, while user defined data types include data types for more complex information. Examples of user defined data types are array, structure or records, unions etc. Some languages also support qualifiers which are used with basic types in order to change range of values supported by particular type.
- Rich set of operators:
An operator defines operations to be performed on data. For example, + defines arithmetic addition of two numbers. Operators are also of different types like arithmetical, relational, logical etc. The capability of performing various types of operations by language depends on the various types of operators language support. The bit-wise operators supported in C language makes it capable of performing operations at bit-level on given numbers. The arithmetic, relational, logical operators are common to all languages but other operators may be language specific. For example, bit-wise operators are not supported in many languages
More Operators means more flexibility. The most common operators are arithmetic, logical, relational, increment/decrement, ternary(? : ) or conditional, assignment, comma, dot, arrow, sizeof, and others.
- Flexible control structure:
The control structures are providing necessary mechanism for implementing algorithms in language format. The structure programming language provide mainly three type of control which are essential for any type of programming. They are as follow:
- Sequence
- Selection or decision
- Repetition or looping
- for loop
- while loop
- do-while loop
- Readability:
Once the program is written, it is read many times in future by same or other person. A program if read after long time even by same person looks new and requires lot of time to read and understand. To make this task easier and help in understanding program, programming languages allow insertion of additional statements in program known as comments. A comment is a sentence which explains some aspect of a programs segment or statement. Thus, the comments help in process of reading and understanding programs. For example, at the beginning user may write problem statement as comment which explains the purpose for which program is written.
Commonly comment is written in /"....*/. Any thing written between /* and */, is considered as comment and removed during compilation process as comments are not part of program. They are written just for improving readability of a program.
Modularity: - File handling:
In many applications, input to program is taken from another file which is already available or output of program is stored in file for future use. If output of the program is stored in a file, It can transferred to other machine also through a disk. example, in payroll application it is not possible that every time when program runs, all the details about employees are entered again. Rather, details are kept in a file which is read by program when runs and changes made during execution are stored into file so that when program runs again, it starts with latest detail.
In higher level programming language, file management is supported through rich set of file handling functions which allows user to open a file, read from file, write into file etc.
- Memory management:
Memory is valuable resource and should be used judiciously. Memory management covers the issue of allocating memory dynamically at run time and deallocating memory during execution if it is no longer required so that it can be used later for other purpose.
In languages like C++ and JAVA, memory management is done through operators new and delete which are part of language itself. JAVA also supports concept of garbage collection where by memory not in use is released automatically.
- Procedural Vs. Object Oriented:
Procedural languages emphasize on procedures, while object oriented languages emphasize on object oriented principles like object, classes, encapsulation, inheritance, polymorphism, etc. The C is a procedural language, while C++ is an object oriented extension to C. Another example of object oriented language is JAVA. Modern trend is towards object oriented languages because of their number of advantages. Although C is a procedural language, it will remain in use for longer time because of many reasons like speed, wide spread use and availability on almost all platforms from PC to supercomputer.
- Procedure Vs. Event driven:
In procedure driven programming, execution is strictly done by calling procedures i.e. one procedure calls another which may call some other procedure and so on. The result is sequential execution where execution of program begins by transferring control to top level procedure which then calls other procedures in program and the end of top level procedure is termination of the program. For example, execution of C program begins by calling function main() which acts as entry function and calls other functions in a program.
Modern softwares are GUI (Graphical User Interface) softwares which are developed using visual languages like Microsoft Visual Basic, Microsoft VC++, Sun JAVA etc. In such programs, clicking mouse in program window causes an event. Event is identified by program and corresponding event handler (Procedure written to handle particular situation) is located and executed. The execution of program is not sequential as the occurrence of events decide the part of program to be executed. All GUI programs are event driven.
- Interface to other languages:
Many programming language supports interface to other language i.e. they provide extension to other language(s). Such interface or extension is very useful for many reasons.For example C supports interface to assembly language statements within C program itself. It then facilitates to access operating system services directly or some critical portion can be written in assembly for efficiency purpose.
Another example is JAVA's JNI (Java Native Interface) where by it is possible to interface C routines with JAVA code so that JAVA routines makes call to these C routines to perform some special task. As JAVA does not support pointers, using these interface, C pointers can be used by JAVA programs.
- Availability of library support:
A library is a collection of related functions or subroutines which are available as part of compiler and can be used in program by making calls to them. It saves time of development plus improves reliability as these functions are well tested. Earlier library support with compiler was limited, but in modern compilers, a large collection of various types of libraries are made available. Hence, the word "package" is more used rather than just compiler.
- Supporting tools:
For software development not only compiler is sufficient. Many more tools like editor, debugger, linker etc. are required. The product like Turbo C/Borland C provides IDE (Integrated Development Environment) which includes all necessary tools in a single software. When it is started, it allows you to edit or modify source file and then it can be compiled, linked and executed. If logical errors are found, debugger inbuilt into it allows you to debug program by running it in step mode (line by line) and watching values of variables in separate window as execution proceeds. It also provides number of other facilities like setting proper environment, creating projects etc.
Any algorithm either simple or complex consists of various combination of above three types of steps. Thus, in order to implement such algorithm, language should provide necessary control structure which implement above.
The sequence is inherent to any programming language as control always goes to next statement in sequence unless otherwise, it is intentionally send to some other part. For Example:
X = 5;
Y = X+10;
In above case, first statement assigns 5 to X and then control moves sequentially to next statement which assigns value of expression x+10(=15) to Y.
The selection or decision statement are very important and used for deciding future execution path based on logical conditions. A decision may skip some part of the program. For example, two-way decision selects one of the block or group of statements out of two. Multi-way decision selects one from many. Programming language supports number of selection and decision statement like if, if-else, multiple if-else, switch etc. A simple example of two way decision is.
if(x > x);
printf("%d",x);
else
printf("%d",y);
In above case, depending on the value of x and y, only one value which is larger will be printed. Hence, decision is mage by comparing values of x and y.
Many times, it is necessary that same process is to be repeated. For this purpose, language support three different looping statement as follows:
Following example, repeats process for printing value of variable i for ten times.
The size and complexity of a program depends on problem itself for which program is to be written. As the problem is bigger and complex,, resulting program will naturally be large and complex. As the size and complexity increases, developing a single large program is too difficult. It is also unmanageable, even once it is developed.
Programming languages support concept known as modularity in order to handle size and complexity effectively. Modularity is nothing but dividing large program into collection of small subroutines. Each subroutine is itself a small program and perform well defined task. Modularity not only reduces development complexity, but also reduces complexity of managing the code i.e. changes, bug fixing, increasing functionalities etc.
In any programming, function is a vehicle to support modularity. Any program is a collection of one or more functions (i.e. subroutines). As function is small and performing specified task, it is easy to write and understand also.