Comparative Analysis of Some Programming Languages: Oguntunde, Bosede Oyenike
Comparative Analysis of Some Programming Languages: Oguntunde, Bosede Oyenike
Abstract
Programming languages are used for controlling the behavior of computer machines. Several
programming languages exist and new are being created always. These programming languages
become popular with use to different programmers because there is always a tradeoff between
ease of learning and use, efficiency and power of expression. In this work we examine six
programming languages two from different groups of scientific, non scientific and object
oriented programming languages. We present an algorithm for performing combination and
permutation to implement the comparison. Two parameters, the memory consumption and
running time requirement are tested and objected oriented programming languages perform
better in term of their running times although same could not be said of them in term of memory
requirements.
1. Introduction
107
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
algorithm and possibly control external devices such as printers, disk drives, robots, and
so on.
Abstractions: Programming languages usually contain abstractions for defining and
manipulating data structures or controlling the flow of execution. The practical necessity
that a programming language support adequate abstractions is expressed by the
abstraction principle; this principle is sometimes formulated as recommendation to the
programmer to make proper use of such abstractions.
Expressive power: The theory of computation classifies languages by the computations
they are capable of expressing. All Turing complete languages can implement the same
set of algorithms.
All programming languages have some primitive building blocks for the description of
data and the processes or transformations applied to them. These primitives are defined by
syntactic and semantic rules which describe their structure and meaning respectively.
The syntax of a language describes the possible combinations of symbols that form a
syntactically correct program. The meaning given to a combination of symbols is handled by
semantics (either formal or hard-coded in a reference implementation). Since most languages are
textual, this article discusses textual syntax.
The static semantics defines restrictions on the structure of valid texts that are hard or impossible
to express in standard syntactic formalisms. For compiled languages, static semantics essentially
include those semantic rules that can be checked at compile time. Examples include checking
that every identifier is declared before it is used (in languages that require such declarations) or
that the labels on the arms of a case statement are distinct.
1.2 Language processors
Generally, computers do not understand high-level languages. To make computer
understand the program written in high-level language a translator will be required to translate
the program into its machine language equivalent. Such translators are called Language
processors. Language processors are of three classes namely: Assembler, Interpreter and
compiler.
108
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Assembler: it translate source program written in assembly code to machine code object
programs.
Interpreter: it translates a high-level language one statement at a time and carries out the
execution of the statement before proceeding to the next statement.
Compiler: it translates a program written in high-level language into its machine language
equivalent.
The function of a language processor is to check for the syntactic and semantic
correctness of statements in a program. This is done before the actual translation into machine
language.
The subsequent chapters shall discuss in full the three programming languages:
Scientific, non-scientific and object-oriented programming languages using one language as an
illustration for each.
1.3 Our Objectives
Typically, we are interested in analyzing the “efficiency” of a given programming language. This
involve determining the quantity of computer resources consumed by the language; measurable
resources include the amount of memory (memory space) required by a language and the amount
of computational time (running time) required by a programming language. We evaluate the
performance of some programming languages using performance parameters such as running
time and memory allocation.
2. Programming languages
Programming languages are grouped into three major categories: scientific, non-
scientific and object oriented programming languages.
2.1.1 Scientific programming language
Scientific programming languages are procedural languages. They are command driven or
statement oriented languages. Their basis concept is the machine state. For scientific
programming language, FORTRAN and PASCAL would be used illustration.
109
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
110
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Smallt Visual
Eiffel Ruby Java C# C++ Python Perl
alk Basic
Hybri
Object- d/ Partial
Orientatio Pure Pure Pure Hybrid Hybrid
Add-OnMulti-
/ Hybrid
Hybrid Suppo
n Paradi rt
gm
Static /
Dynam Dynami Dyna
Dynamic Static Dynamic Static Static Static Static
ic c mic
Typing
Generic
Yes N/A N/A No No Yes N/A N/A No
Classes
Single
Single
Single class,
class,
Inheritanc class, multipl Multip Multipl Multip
Multiple Single multiple None
e multiple e le e le
interface
"mixins" interfac
s
e
Feature
Yes No Yes No No No No No No
Renaming
Method
Overloadin No No No Yes Yes Yes No No No
g
Operator
Overloadin Yes Yes? Yes No Yes Yes Yes Yes No
g
Agents
Higher Lambda
(with Yes
Order Blocks Blocks No No No Express No
version (???)
Functions ions
5)
Yes Yes Yes
Lexical Yes
(inline (blocks No No No (since Yes No
Closures (blocks)
agents) ) 2.1)
Mark Mark Mark
Mark and and and and Referen Refere Refere
Garbage Sweep or Sweep Mark and Sweep Sweep ce nce nce
None
Collection Generatio or Sweep or or Countin Counti Counti
nal Generat Generati Genera g ng ng
ional onal tional
Uniform
Yes N/A Yes No No No No No Yes
Access
111
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Smallt Visual
Eiffel Ruby Java C# C++ Python Perl
alk Basic
Class
Variables / No Yes Yes Yes Yes Yes No No No
Methods
Yes (as
of
Reflection Yes Yes Yes Yes No Yes Yes? No
version
5)
public,
public
protect
Protect public, ,
ed,
ed protecte protec
public, private, Name
Access Selective Data, d, ted, public,
protected, internal Mangli None
Control Export Public "packag privat private
private , ng
Method e", e,
protect
s private "frien
ed
ds"
internal
Design by
Yes No Add-on No No No No No No
Contract
Implem
Impleme
entatio
Multithrea ntation- Librar
n- Yes Yes Yes Yes No No
ding Depende ies
Depend
nt
ent
Pointer
No No No No Yes Yes No No No
Arithmetic
112
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Smallt Visual
Eiffel Ruby Java C# C++ Python Perl
alk Basic
All
C, C (via
Language C, C++, C, C++, C, some .NET C, C++, C,
C Assem DCO
Integration Java Java C++ Langua Java C++
bler M)
ges
Yes
Built-In
No No? Yes Yes Yes No No? (perlse No
Security
c)
Capers
Jones
15 15 N/A 6 N/A 6 N/A 15 11
Language
Level*
113
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Start
Supply
N
Supply
R
No
Perform
Comb = N!/R!(N-R)!
Permuta
tion?
Yes
Perm = N!/(N-R)!
Write comb
Write perm
Stop
Fig.1 Flowchart
Algorithm
1. Supply the bigger positive integer as N
2. Supply the smaller positive integer as R
3. IF Permutation Then
Permutation = N! /(N-R)!
Else combination = N!/R!(N-R)!
5. Print permutation / combination
6. Exit.
114
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Memory Requirement
3000
2500
Memory (b)
2000
1500 Series1
1000
500
0
N
VA
L
SIC
+
AL
BO
RA
C+
JA
SC
BA
RT
CO
PA
FO
Language
115
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Running Time
12
10
Time (s)
8
6 Series1
4
2
0
AN
VA
L
C
+
AL
BO
C+
SI
R
JA
SC
BA
RT
CO
PA
FO
Language
4.1 Discussion
From the result above, it could be observed that Object-Oriented program has the
smallest running time followed by scientific program then Non-scientific.
With the Object Oriented programming languages, JAVA program is faster than C++,
although it required more memory allocation than all other programming languages.
With the Scientific programming language, PASCAL is faster than FORTRAN but
they both have the same memory space requirements. Lastly, in Non-scientific programming
language, BASIC has lesser running time compare to COBOL and it also required less
memory space allocation compared to COBOL.
5. Conclusion
This work presents a comparison of some programming languages; we present a
combination and permutation calculator written in all the languages to measure their
performance. To conclude the write-up it is note-worthy that there are many other
programming languages that are all improvement from the old ones. As different
programming languages are being produced, two qualities (runtime and memory space) are
being considered most. In reality, the fastest are not always the smallest, so tradeoffs between
these two important qualities are being maintained.
116
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
Thus, Object Oriented Programming Language was designed to be a good tool for
building a wide variety of systems and allow a wide variety of ideas to be expressed directly.
Not everything can be expressed directly using the built-in features of a language. In fact, that
isn’t even the idea. Language features exist to support a variety of programming style and
techniques. Consequently, the task of learning a language should focus on mastering the
native and natural styles for that language, not on the understanding of every little detail of all
the language features.
Though our research is based on comparison between scientific, non-scientific and
object oriented program using a program that compute the permutation and combination of n
integer. Many researches can still be done on this topic using other program to illustrate.
Likewise, there can be comparison of programming languages through the features of the
languages.
117
Transnational Journal of Science and Technology June 2012 edition vol. 2, No.5
References:
Benchmarking, Comparison between high object based java & non object oriented,
(doi.wiley.com//0.1002/cpe.658)
Bertrand Mayer (1993). What is an Object-Oriented Environment? Five Principles
and their Application, in Journal of Object-Oriented Programming, Volume 6, Number
4, July-August 1993, pages 75-81.
Bertrand Mayer (1994). An Object-Oriented Environment: Principles and
Application, Prentice Hall, 1994.
John R. Hubbard, 1996, Schaum’s outline of Theory and Problems of programming with
C++, published by Mc Grew-Hill book Singapore.
Martine Robert Cecil, 2003, UMI for java programmers, Printice Hall.
Pius Ezeamii, 2005, Computer science for beginners, published by Infomedia, Lagos.
Rajaramon, H. V. Sahasrabuddhe, 1991, Computer programming in COBOL.
Seymour Lipschutz, 1996, Schaum’s oytline of Theory and Problems of Programming with
FORTRAN, Mc Grew-Hill, Singapore.
118