Professional Documents
Culture Documents
The study of programming involves learning languages where, in most cases, vary from
the spoken languages we use in our everyday lives. Choosing the right language to learn may
help the programmer solve a problem in an easy manner. However, learning a poor language
will not only clutter the program but also confuse the programmer. As pointed out by Marcotty
and Ledgard (1986), a programing language must aid in the areas of program design,
challenge of programmers to determine which language is the most effective tool for their
program.
Over the years, programmers have developed their way of programming or what is
commonly known as programming paradigms. Each paradigm makes use of different types of
Concurrent languages. Object-oriented languages, which is the main focus of this research,
includes C++ and Java. Object-oriented programming (OOP) allows the programmer to create
templates that houses both data and functions. Smith (2014) defines OOP as ... the practice of
creating a software architecture that enables flexibility through modular design. However
modularized it may be, OOP doesnt eliminate complexity in the languages it use. When
compared between different languages, one language may be able to avoid more complexity
through its syntax and semantics but later on, this would also create a complexity that is yet to
refers to how set of rules are arranged and presented in a language. In other words, this refers
to the complexities of the programs structure. Complexity of semantics can be defined as to
complexity is developed. The primary goal of this theory is to determine and compare the
practical difficulty of solving a problem using two or more objects and in this case, C++ and
Java. A programming language could have many different complexities which vary in many
resource used by a program as it processes a specific input value. This resource might
be time, space CPU usage, channel activity, etc. We might have a program A with input
B(n) would tell us the amount of a particular resource used by A to compute A(n). Thus
In this paper, the researchers uses the theory of complexity to determine which language is
more effective to learn using complexity measures of syntax and semantics, performance
difference measured using compile time and runtime, and cross-platform portability. This
provides not only a clear comparison between both languages but also, a theory based
comparison.
Martin (1997) compares the complexities of C++ and Java in terms of syntax and coding
style and the disadvantages and advantages of both programming language. Base from Martin
studies that language design always involve trade-offs in which it displeases other
programmers in using such language. Then he compared these two programming language
base on what they can do and cannot do. The first comparison stated was multiple inheritance.
In order to avoid Deadly Diamond of Death(DDD), C++ uses multiple inheritance. DDD is a
feature where a shared class D cant identify whether it inherits Class Bs function and variables
or class Cs. Multiple inheritance provides a shorter code implementation. Java however,
doesnt use multiple inheritance but rather, multiple interface. Martin stated that language
design always involve trade-offs, here C++ implementation of multiple inheritance is much
simpler, however, its virtual functions are prone to the DDD error or inheritance error.
Meanwhile, Java may not have multiple inheritance but, it provides an implementation which is
not prone to inheritance error. Next, both languages were compared regarding its memory
management scheme. Java, in particular, uses Garbage Collection (GC), which manages
memory by automatically freeing unused blocks of memory. On the other hand, C++ memory
management is done manually by using pointers, which is not supported in Java. The use of
pointers, can make implement a program more efficiently but, it takes up more time and space
So which language is better? That's the usual question of researchers. But one cannot
deny the fact that C++ and Java both have advantages and disadvantages. Due to the fact that
they have different design goals and features. Both are OOP (Object Oriented Programming),
but they have different ways in implementing specific functions or task. Now in terms of time
efficiency both have different outputs but base from other researches C++ can compile faster
than Java. Prechelt (1999) discussed the efficiency of Java programs with respect to a well
established programming languages like C++. Where Java, in his own words, ... considered to
be very slow. He then proved this statement by implementing a benchmark in both languages
and comparing the minimum time of execution. The minimum time of execution may mean an
efficient implementation with regards to coding style using the coding syntax of the language.
Java and C++ are both object oriented programming languages the greatest difference
they have is that C++ support handling using pointers unlike Java. C++ handling is done
manually. It requires the programmers visualization on how they want to allocate and transfer
data. This may make up for an efficient program but at the cost of manually doing the memory
management, it is more prone to errors that requires additional debugging time. Java is more
convenient to use since it eliminates the need for manual memory management. However its
level of efficiency cant be enhanced since it uses a built in feature such as GC. With regards to
the minimum time of execution, Java is slower than C++. To begin with, C++ is a machine code.
Machine codes are low-level languages since it runs directly on the processor. Java which is a
mid-level language, does not convert code into machine code until runtime. Java can preserve
its portability, however preserving portability may take more time. In terms of design goals, Java
is more focused on making the implementation simple for users through its built-in features. It
uses a high level of abstraction which simply means the amount of complexity by which a
program is viewed or implemented. The higher the level, the lesser the detail. C++ is more
prone to multiple errors not because of the coding style but because of the programmer. A
higher level of sophistication on the side of programmers is required for implementing efficient
C++ programs. So, in terms of higher level efficiency, C++ is more convenient to use.
Java and C++ have ways in cleaning up the code specifically Java uses a finalizer and
C++ uses a Destructor to clean up the code, but this only happens before the object life time
ends. The difference is that you cannot tell if the Java finalizer did its job unlike in C++ you can
tell when the destructor did its job. According to Markus Winand (2003) The drawback of the
Java solution is that it does well for memory, but what about other resources? For example a file
handle, open socket. With C++ you can just use the same technique, but for Java the use of
the finalizer is usually not sufficient since it is undefined when it is called. The best technology
depends on the size of the project. For smaller projects the Java solution will be fully sufficient
and just more straight. For big projects the C++ solution might become more interesting, since it
allows the elimination of duplicate code (which is error prone). Clearly this is because Java is a
general purpose programming language due to it being general purpose it may provide ease to
programmer because Java was built for the specific purpose at the cost of that its performance
Similar to natural languages, programming languages allows you to learn more by first
understanding the ground rules. In this case, the coding style and syntax used. However, having
only the basic knowledge on ground rules may not be effective in communicating your ideas.
So, it is also necessary to learn more about these languages performance with regards to
different implementations. Productivity is the holy grail of programming language. Time is one
of its most expensive resources. In order to optimize those resources, programmers must look
In order to provide a clear comparison between Java and C++, a single implementation
will not be the basis of the said comparison. Given that one of the language may be favorable to
one implementation but not to another. Sestoft (2010) compares the numeric performance of C,
C# and Java on three small cases (Matrix multiplication, Division-intensive loop and Polynomial
evaluation). From this study, it was concluded that Java is easier and safer to use than C++ on
managing dynamic data structures, graphical user interfaces and etc. Hundt (2011)
implemented a well specified, compact benchmark in C++, Java, Go and Scala. The
implementation of the said benchmark uses the languages idiomatic container classes, looping
is above the rest. However, it requires sophistication beyond an average programmers level in
program optimization. On the other hand, Java is ... the simplest to implement, but the hardest
to analyze for performance. Specifically the effects around garbage collection were complicated
The presented studies however, does not fully delve into which language is favorable to
learn, the researchers takes into account the opinions of the students. Different implementations
may be used in the curriculum of the students. These implementations must also be taken into
account, in order to see which programming language is more beneficial to learn for students.
performance and power, as each object-oriented language could consume more power than the
other. The study yielded results of with object-oriented programming increasing the consumed
power, due to increased instruction count, bigger source code size being compiled, and the
runtimes, but these optimizations can lead to lesser portability on other operating systems.
Likewise, too much portability of a language could lead to performance reductions as loaded
libraries for compilation could not be present in other operating systems. Therefore, the
programing language must create these libraries for other operating systems, thus increasing
the whole size of the whole programming language with new libraries. Compiling a huge number
of additional lines could significantly impact the performance of the whole programming
language. As such balances are made to strengthen both performance and also portability at
Logan (2008) stated that portability is a measure on how easy a software or a program
also define its portability, on whether it was created with the thinking of its portability or
cross-compatibility with other devices or operating systems. Compilers are also closely tied to
applications that would run completely on different platforms and different systems. Goodwin
(2005) stated that, this generally means that the same source code will compile, run and behave
identically on different systems being targeted by the developers. The compiler and tools in
these case would be specific to each type of system, and the Application Programming Interface
(API) may change widely depending on the type of system, but the source code created will be
identical throughout the different systems. This code should be reusable to each platform. This
is to make the developers develop in one period of time, then deploy it to different systems
must work on at least two different target systems using a common or an identical source code.
This is stated to be a skill that is very delicate, as algorithms, libraries, structures, and compilers
could not be changed easily. Slight modifications of the source code could be very dangerous to
a system, as this could also cause catastrophic problems for other platforms. This is also
delicate because each system varies from the operating system, the size of the memory, the
speed of the central processing unit, the type of the filesystem being used, the byte order being
compared to C++. This is because the output of C++ is directly executed by the central
processing unit or the CPU of the computer. The portability of Java is directly related by an
intermediate language known as pseudo code. The pseudo code is then executed by a runtime
system. Javas runtime system is known as Java Virtual Machine (JVM). As long as this virtual
machine is available in the present operating system, Java can then be run on this Operating
System. It is a runtime system and thus stands between both the program and the central
processing unit. It incurs an overhead that is not present in executing a C++ application. That is
why C++ applications usually run quicker and better than applications created or written in java,
despite of it being equivalently written. Java is developed because of the programming needs,
which are mostly unique. These needs were created from the environment of the internet. Since
the internet is mostly connected to different types of hardware which includes the central
operating system, which also has different types of operating systems in it. This variety of
systems made the start or the cause to build cross-platform, portable applications.
allows programmer to reuse their code into different platforms. In this research, the researchers
aims to identify the cross-platform capability of Java and C++ with regards to platforms required
in the Computer Science curriculum. The researchers intends to determine whether which
language is more commonly used in programming assignments and projects. Having this level
of inquiry, the researchers can better assess which language is more efficient to learn for
students.
Complexities in programming language can truly affect the compiling time and run time
of the program specifically the syntax and the programming style. The programming style
matters since not all have the same way of making a programming there are many ways in
which your algorithm will differ and how you implement differs as well and knowing that the
longer your code is the more it takes it to finish compiling but of course base from experts
opinion C++ compiling time is faster than Java since C++ is closer to machine language unlike
Java, but in terms of syntax Java is easier since it is a higher language than C++ since Java
have more general header files than C++ that makes Java easier to code than C++ but of
course there are disadvantages and advantages in using C++ or Java. There is also another
factor to reconsider which is the hardware part respectively the computer unit. The higher the
specs your computer have the faster it can compile the code but the programming language
should be compatible to the unit so that it will function properly. But it all comes down to their
design goals what these programming languages were meant for but of course it is also the
users perspective respectively, but the programmer must be aware of the complexities if they
wish to reduce the time it takes for its code to be compile with the proper equipment which is the
REFERENCES:
Marcotty, M., Ledgard, H. (1986). The World of Programming Languages. Chicago, IL:
Science Research Associates, Inc.
Kedar, S.(2008). Programming Paradigms and Methodology. India. Technical
Publications Pune.
Smith, B. (2014). Advanced ActionScript 3 - Design Patterns. New York, NY: Apress.
McConnell S. C. (2004). Code Complete: A Practical Handbook of Software
Construction. Redmond, Washington. Microsoft Press.
Logan, S. (2008).Cross-Platform Development in C++. Boston. Person Education Inc.
Chatzigeorgiou, A. (2002). Performance and Power Evaluation of C++ object-oriented
Programming in Embedded Processors
Goodman, L. (1971). Complexity Measures for Programming Languages. Cambridge,
MA: PROJECT MAC - Massachusetts Institute of Technology.
Peter S. (2010). Numeric Performance in C, C# and Java Peter Sestoft. Denmark. IT
University of Copenhagen.
Hundt, R. (2011). Loop Recognition In C++/Java/Go/Scala. Retrieved from
https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf
Goodwin, S. (2005). Cross-Platform Game Programming. Hingham, Massachusetts
02043. Charles River Media, Inc.
Schildt, H. (2004) 2nd
Ed. C++: A Beginners Guide.
A. Alnaser, O. AlHeyasat, A. Abu-Ein, H. Hatamleh and A. Sharadqeh, "Time
Comparing between Java and C++ Software," Journal of Software Engineering and
Applications, Vol. 5 No. 8, 2012, pp. 630-633. doi: 10.4236/jsea.2012.58072.