Lecture 1 - Intro to OOP
Lecture 1 - Intro to OOP
International University
School of Computer Science and Engineering
1
Object Oriented Programming
● Instructor and Lab Tutor: Dr. Nguyen Trung Ky.
Ph.D. Grenoble Alpes University 2019; second year at IU.
Research on Computational Linguistics (Natural Language Processing,
Natural Language Generation) and Machine Learning.
Office: O1.610
Ask immediately after class or by appointment via email
[email protected]
2
Learning outcomes
1. Analyze a problem and design an object oriented solution
2. Apply an object oriented solution in JAVA/C++/C# programming language
3. Explain concepts of object oriented programming
- Classes.
- Methods.
- Objects.
- Encapsulation.
- Information Hiding.
- Polymorphism.
- Inheritance.
- Abstraction.
4
Topics to be covered in this course
1. Introduction to Object Oriented concepts 10. Generic collection
5
Materials/Books
Textbooks
References
7
Grading policies
8
Project
Create a game in a team 3-4 students.
For examples:
- Plants vs Zombies
- Candy crush
- Monopoly
- Mario
Task
Bonus
10
Agenda
- What are Programming Paradigms?
- What is Object Oriented Programming (OOP) ?
- Why should we learn Java?
- What are JDK, JRE, JVM? How these works together?
11
Introduction to
Object Oriented Programming
12
Programming Paradigms
- Different approaches to build solutions to specific problems.
- Most programming languages belong to one paradigm.
- Two most popular programming paradigms:
- Procedural Programming
- Object-Oriented Programming
13
Procedural Programming
VS
Object Oriented Programming (OOP)?
14
Procedural Programming
- Step-by-step approach to break down a task into a set of variables and
sequences of transformations using functions.
- Data and functions are separated.
15
Procedural Programming Example
Data A Data B
Function 4 Function 5
Output
16
Problems for Procedural Programming
- Hundreds of functions.
- How to manage: Sort them in alphabetical order?
- Hundreds of global variable can be accessed or must not to be accessed
by many different functions.
- How to make sure there is no unintended modifications?
- Not secure, because there is not any proper way for hiding data or limit access of
specific data.
17
What is Object-Oriented Programming (OOP)?
18
Object-Oriented Programming (OOP)
- Software design focuses around data or objects.
- The program is divided into small parts called objects (basic unit).
- Object is an entity that contains attributes (data) and methods (behaviors).
- Objects knows how to perform certain actions and how to interact with other objects
of the program.
Example: a person has:
- Attributes (data): eye colors, heights, …
- Methods (behavior): walking, talking, ...
Object Object
Send message
Attribute (Invokes) Attribute
Attribute A
Method
2
Method 1 Method 3
Method 4
Output Method 5
20
Procedural Programming Object-Oriented Programing
21
Why we choose to learn Java for OOPs?
22
Java
- Java is one of the most popular languages in the world.
- Run on 15 billion devices
- Used by 12 million developers
- Beginner Friendly
- Large Community
- Excellent Document Support
- Many big tech companies used Java as their back-end systems
23
https://www.oracle.com/java/moved-by-java/timeline/
Java is still the king of job market in Vietnam
Attractive Salaries in Vietnam
The most popular language at work in Vietnam
(Vietnam Developer Report 2019)
24
Nearly 1 out of every 5 IT jobs is Java
25
Java Software and Version
27
What are JDK, JRE, JVM ?
- Java Development Kit (JDK)
- Tools to develop and create Java programs (on Windows, MacOS and Linux)
- Contains:
- Debuggers for testing code or find errors.
- Java Compiler to compile the source code into Java bytecode.
- Java Runtime Environment (JRE)
- Including libraries to run and execute the Java bytecode.
- Does not include any developing tools.
- Including a specific Java Virtual Machine (JVM)
- Runs Java bytecode on that specific platform.
- Different platforms requires different JVM.
28
How Java works
Windows
Developers JVM
Java Runtime MacOS
develops (JDK) Environment JVM
(JRE)
Runs
Java source compile (JDK) Java class files
(*.class) - Java JVM Linux
files (*.java) 29
bytecode
31
https://www.oracle.com/java/technologies/downloads/
Recap
This lecture, we have learnt about:
- Programming Paradigms.
- Basic idea of Object Oriented Programming (OOP).
- The importance of Java.
- The differences between JDK, JRE, JVM and how these works together.
32
Thank you for your listening!
33