0% found this document useful (0 votes)
7 views26 pages

Lecture 8 - Introduction To OOP

Uploaded by

devmith2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views26 pages

Lecture 8 - Introduction To OOP

Uploaded by

devmith2005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

ICT 1411

Object Oriented Programming

Lecture 8
Content

1. Genealogy of object-oriented languages


2. Different programming paradigms
3. Interacting with Java Programs
3.1 Fundamentals of Java Programming (Java Features, Applications)

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

• Based on the idea of breaking a program into smaller, reusable


procedures or functions.
• It emphasizes clear organization, modular code, and step-by-step
execution.
• Examples: C, Pascal, and Fortran

10
Programming Paradigm
Object-Oriented Paradigm

• Object-oriented programming organizes code around objects, which


are instances of classes that contain both data (attributes) and
methods (functions).
• It promotes encapsulation, inheritance, and polymorphism.
• Examples: Java, C++, Python, and Ruby

11
Programming Paradigm
Functional Paradigm

• It focuses on immutability, higher-order functions, and avoiding shared


state.
• It often uses recursion and higher-order functions extensively.
• Examples: Haskell, Lisp, and Erlang , JavaScript also supports functional
programming features.

12
Programming Paradigm
Logical Paradigm

• Based on formal logic.


• Programs consist of facts and rules, and the program attempts to infer
answers to queries based on the given facts and rules.
• It is especially suited for rule-based systems and expert systems.
• Examples: Prolog

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.

• It provides everything necessary to execute Java programs.

19
JDK
Java Development Kit
• Includes the JRE, the Java compiler (javac), and various development tools.

• JDK is used by developers to create, compile, and package Java applications.

• It is essential for writing and building Java code.

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.

• This bytecode is saved in .class files.

21
Interpretation
• When you run a Java program with the java command, the JVM reads the bytecode
and interprets it into machine code.

• This interpretation happens dynamically during program execution.

• 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

You might also like