Lecture 8 - Introduction To OOP
Lecture 8 - Introduction To OOP
Lecture 8
Content
2
Genealogy of
Object-Oriented
Languages
3
Evolution of
Programming
Languages
Source: https://vinbloom.blogspot.com/2018/09/object-oriented-programming-
4
oop.html
Genealogy of OO Languages
Simula (1967): First object-oriented programming language. Simula introduced the concepts of classes,
objects, and inheritance.
Smalltalk (1972): Smalltalk was a pioneering language that heavily influenced modern OOP languages. It
introduced the concept of a graphical user interface and dynamic typing.
C++ (1983): Created as an extension of the C language, C++ introduced the concept of classes and
objects to C, adding features like inheritance, polymorphism, and encapsulation.
Objective-C (1983): Developed by Brad Cox, Objective-C combined elements of Smalltalk and C. It gained
popularity through Apple's adoption for macOS and iOS application development.
5
Java (1995): Java was designed with portability and platform independence in mind. It introduced the
Java Virtual Machine (JVM) and emphasized the "Write Once, Run Anywhere" principle.
C# (2000): Developed by Microsoft, C# combines elements of C++ and Java. It's commonly used for
Windows application development and integrates with the .NET framework.
Python (late 1980s/early 1990s): While not initially an OOP language, Python incorporated OOP
features, and today, it supports both OOP and other paradigms. Python is known for its simplicity and
readability.
Ruby (1995): Ruby is known for its elegant syntax and was heavily influenced by Smalltalk. It's often used
for web development (Ruby on Rails).
6
Programming
Paradigms
7
The way of programming using programming language/s.
8
9
Programming Paradigm
Procedural/ Structured Paradigm
10
Programming Paradigm
Object-Oriented Paradigm
11
Programming Paradigm
Functional Paradigm
12
Programming Paradigm
Logical Paradigm
13
% Facts
parent(john, bob).
parent(john, alice).
parent(bob, charlie).
% Rule
is_parent(X, Y) :- parent(X, Y).
% Query
?- is_parent(john, bob). % This query asks if john is a parent of bob.
14
Fundamentals in
Java Programming
15
• Java is a versatile, high-level, object-oriented
programming language.
• Developed by Sun Microsystems (now owned
by Oracle Corporation) in the mid-1990s.
• Platform independence, strong security
features, and extensive libraries.
16
JVM, JRE and JDK
17
JVM
Java Virtual Machine
• A critical component that executes Java bytecode.
• Responsible for translating Java bytecode (compiled from source code) into machine code
that can run on the host system.
• The JVM is platform-dependent, meaning there's a different JVM for each supported
platform (e.g., Windows, Linux, macOS).
• It ensures Java's "write once, run anywhere" capability by adapting the bytecode to the
host system.
18
JRE
Java Runtime Environment
• A runtime environment that allows you to run Java applications.
• It includes the JVM (Java Virtual Machine), the Java standard libraries, and various
runtime tools.
• JRE is essential for end-users who want to run Java applications but do not need to
develop or compile Java code.
19
JDK
Java Development Kit
• Includes the JRE, the Java compiler (javac), and various development tools.
20
Compilation
• When you write Java source code (with a .java file extension) and use the javac compiler, it
compiles the code into platform-independent bytecode.
21
Interpretation
• When you run a Java program with the java command, the JVM reads the bytecode
and interprets it into machine code.
• The JVM can also employ Just-In-Time (JIT) compilation, where certain parts of the bytecode
are compiled to native machine code for improved performance.
22
JIT Compilation
• JIT – Just In Time
• Modern JVMs use JIT compilation.
• The JVM analyzes the bytecode and, if it deems it worthwhile, compiles parts of the
bytecode into native machine code.
• This native machine code is specific to the host system, and it can execute much faster than
interpreted bytecode.
23
Features In Java
• Platform Independence: write once, run anywhere capability, promoting cross-platform
compatibility.
• Object-Oriented: Emphasizing the use of objects and classes to model data and behavior. It
supports encapsulation, inheritance, and polymorphism.
• Automatic Memory Management: Includes automatic garbage collection (manages
memory and reduces the risk of memory leaks).
• Rich Standard Library: Java offers an extensive standard library (Java API) with pre-built
classes and methods for various tasks, streamlining development.
• Security: Java incorporates multiple security features to protect systems from potentially
harmful code, including bytecode verification, classloaders, and security managers.
24
Activity
Study on different JDK versions
(Version and the new features).
25
END