You are on page 1of 19

Object-Oriented Programming (OOP)

Programming Languages

Programming languages allow programmers to code software.


The three major families of languages are:
Machine languages
Assembly languages
High-Level languages
Machine Languages

Comprised of 1s and 0s
The “native” language of a computer
Difficult to program – one misplaced 1 or 0 will cause the
program to fail.
Example of code:
1110100010101
111010101110
10111010110100
10100011110111
Assembly Languages

Assembly languages are a step towards easier programming.


Assembly languages are comprised of a set of elemental
commands which are tiled to a specific processor.
Assembly language code needs to be translated to machine
language before the computer processes it.
Example:
ADD 1001010,1011010
MOV AX,BX
High-Level Languages

High-level languages represent a giant leap towards easier


programming.
The syntax of HL languages is similar to English.
Historically, we divide HL languages into two groups:
Function-Oriented languages
Object-Oriented languages (OOP)
Function-Oriented
Languages(Procedural)
Early high-level languages are typically called Function-Oriented
languages.
Function-Oriented languages are characterized by sequential sets
of linear commands. The focus of such languages is on structure.
Examples include C, COBOL, Fortran, LISP, Perl, HTML,
VBScript
Object-Oriented Languages

Most object-oriented languages are high-level languages.


The focus of OOP languages is not on structure, but on modeling
data.
Data modeling is a process used to define and analyze data
requirements needed to support the business processes within the
scope of corresponding information systems in organizations.
Programmers code using “blueprints” of data models called
classes.
Examples of OOP languages include C++, Visual Basic.NET and
Java.
Java
What is Java?
- programming language that was originally developed by Sun
Microsystems which was initiated by James Gosling and released in 1995
as core component of Sun Microsystems' Java platform (Java 1.0 [J2SE]).

The latest release of the Java Standard Edition is Java SE 8. With the
advancement of Java and its widespread popularity, multiple
configurations were built to suit various types of platforms. For example:
J2EE for Enterprise Applications, J2ME for Mobile Applications.
The new J2 versions were renamed as Java SE, Java EE, and Java ME
respectively. Java is guaranteed to be Write Once, Run Anywhere.
Java is:

Object Oriented: In Java, everything is an Object. Java


can be easily extended since it is based on the Object
model.

Platform Independent: Unlike many other programming


languages including C and C++, when Java is compiled,
it is not compiled into platform specific machine, rather
into platform independent byte code. This byte code is
distributed over the web and interpreted by the Virtual
Machine (JVM) on whichever platform it is being run
on.
Java is:
Simple: Java is designed to be easy to learn. If you
understand the basic concept of OOP Java, it would be
easy to master.
Secure: With Java's secure feature it enables to develop
virus-free, tamper-free systems. Authentication
techniques are based on public-key encryption.
Architecture-neutral: Java compiler generates an
architecture-neutral object file format, which makes the
compiled code executable on many processors, with the
presence of Java runtime system.
Java is:
Portable: Being architecture-neutral and having no
implementation dependent aspects of the specification
makes Java portable. Compiler in Java is written in
ANSI C with a clean portability boundary, which is a
POSIX subset.
Robust: Java makes an effort to eliminate error prone
situations by emphasizing mainly on compile time error
checking and runtime checking.
Multithreaded: With Java's multithreaded feature it is
possible to write programs that can perform many tasks
simultaneously. This design feature allows the
developers to construct interactive applications that can
run smoothly.
Java is:
Interpreted: Java byte code is translated on the fly to
native machine instructions and is not stored anywhere.
The development process is more rapid and analytical
since the linking is an incremental and light-weight
process.
High Performance: With the use of Just-In-Time
compilers, Java enables high performance.
Java is:
Distributed: Java is designed for the distributed
environment of the internet.
Dynamic: Java is considered to be more dynamic than C
or C++ since it is designed to adapt to an evolving
environment. Java programs can carry extensive amount
of run-time information that can be used to verify and
resolve accesses to objects on run-time.
History of Java
James Gosling initiated Java language project in
June 1991 for use in one of his many settop box
projects. The language, initially called ‘Oak’
after an oak tree that stood outside Gosling's
office, also went by the name ‘Green’ and ended
up later being renamed as Java, from a list of
random words.
Sun released the first public implementation as
Java 1.0 in 1995. It promised Write Once, Run
Anywhere (WORA), providing no-cost
run-times on popular platforms.
History of Java
On 13 November, 2006, Sun released much of
Java as free and open source software under the
terms of the GNU General Public License
(GPL).
On 8 May, 2007, Sun finished the process,
making all of Java's core code free and
opensource, aside from a small portion of code
to which Sun did not hold the copyright.
Five Phases of JAVA Programs
Phase 1: Edit
The programmer writes the program (preferably on a
notepad) and saves it as a ‘.java’ file, which is then
further used for compilation, by the compiler.
Phase 2: Compile javac (java compiler)
- The compiler here takes the ‘.java’ file, compiles it
and looks for any possible errors in the scope of the
program. If it finds any error, it reports them to the
programmer. If no error is there, then the program is
converted into the bytecode and saved as a ‘.class’ file.
Five Phases of JAVA Programs
Phase 3: Load
Now the major purpose of the component called ‘Class
Loader’ is to load the byte code in the JVM.
It doesn't execute the code yet, but just loads it into the
JVM’s memory.
Phase 4: Verify
- After loading the code, the JVM’s subpart called
‘Byte Code verifier’ checks the bytecode and verifies it
for its authenticity. It also checks if the bytecode has
any such code which might lead to some malicious
outcome. This component of the JVM ensures security.
Five Phases of JAVA Programs
Phase 5: Execute
The next component is the Execution Engine. The
execution engine interprets the code line by line using
the Just In Time (JIT) compiler. The JIT compiler does
the execution pretty fast but consumes extra cache
memory.

After these processes we have the Machine Code which


is thereby run.
Tools You Will Need for Java
Programming
For performing the examples discussed in this tutorial,
you will need a Pentium 200-MHz computer with a
minimum of 64 MB of RAM (128 MB of RAM
recommended).
You will also need the following softwares:
Linux 7.1 or Windows xp/7/8 operating system
Java JDK 8
Microsoft Notepad or any other text editor

You might also like