0% found this document useful (0 votes)
65 views

Introduction To Oop (Lab)

This document provides an agenda and introduction for a week 1 lab on object-oriented programming concepts in Java. It covers what programming is, different programming paradigms like procedural, functional and OOP, and introduces key OOP concepts like classes, objects, inheritance, encapsulation, polymorphism and abstraction. It also defines important Java terms like JDK, JRE and JVM and their relationships. The document aims to give students an overview of programming, OOP and how Java supports OOP.

Uploaded by

Alishba Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Introduction To Oop (Lab)

This document provides an agenda and introduction for a week 1 lab on object-oriented programming concepts in Java. It covers what programming is, different programming paradigms like procedural, functional and OOP, and introduces key OOP concepts like classes, objects, inheritance, encapsulation, polymorphism and abstraction. It also defines important Java terms like JDK, JRE and JVM and their relationships. The document aims to give students an overview of programming, OOP and how Java supports OOP.

Uploaded by

Alishba Khan
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Week 1

INTRODUCTION TO OOP (Lab)


BY: Engr. Javeria Barkat
Co teachers: Miss Hira Farman
Miss Ghazala Shafi,
Miss Aqdas Hassan

DEPARTMENT OF COMPUTER
SCIENCE
AGENDA
 What is programming? Unit 1.1
 Programming paradigms Unit 1.2
 Object-Oriented Programming (OOP) Unit 1.3
 Introduction to JAVA 1.4
 JRE, JVM and JDK Unit 1.5
AGENDA
 What is programming? Unit 1.1
 Programming paradigms Unit 1.2
 Object-Oriented Programming (OOP) Unit 1.3
 Introduction to JAVA 1.4
 JRE, JVM and JDK Unit 1.5
Unit 1.1
What is programming?
• “Instruct the computer”: this basically means that you provide the
computer a set of instructions that are written in a language that the
computer can understand. The instructions could be of various type
s. For example:
– Adding 2 numbers,
– Rounding off a number, etc.
Just like we humans can understand a few languages (English, Spa
nish, Urdu, French, etc.), so is the case with
computers. Computers understand instructions that are written in a
specific syntactical form called a programming language.
Why should you learn Computer
Programming?
The backbone of a Technology
Company:
The backbones of today’s technology companies like Google, Faceboo
k, Microsoft, Apple, Amazon, and many others, are giant computer pro
grams written by a collaboration of thousands of skilled programmers. I
f you have the right business expertise, knowing programming can hel
p you create the next big tech company.
Programming is fun:
Using Programming, you can create your own
games, your personal blog/profile page, a social networking
site like Facebook, a search engine like Google or an
e-commerce platform like Amazon! Won’t that be fun?
Imagine creating your own game and putting it on Play
Store and getting thousands of downloads!
Programming requires
Language
• As mentioned above, Computers understand instructions that
are written in a specific syntactical form referred as
programming language.
• A programming language provides a way for a programmer
to express a task so that it could be understood and executed
by a computer.

• Some of the popular Programming languages are Python, C,


C++, Java, etc.
Unit 1.2
Programming paradigms
• There three types of Programming paradig
ms.
– Procedural Programming
– Functional Programming
– OOP programming
Procedural Programming
• Procedural Programming may be the first programming paradigm that a new developer will learn.
• Fundamentally, the procedural code is the one that directly instructs a device on how to finish a task
• in logical steps. This paradigm uses a linear top-down approach and treats data and procedures as
• two different entities. Based on the concept of a procedure call, Procedural Programming divides the
• program into procedures, which are also known as routines or functions, simply containing a series of
• steps to be carried out.
• Simply put, Procedural Programming involves writing down a list of instructions to tell the computer
• what it should do step-by-step to finish the task at hand.
• Example C, Gwbasic etc
Functional programming
• Functional programming is a programming paradigm in which it is tried
• to bind each and everything in pure mathematical functions. It is a
• declarative type of programming style that focuses on what to solve
• rather than how to solve (aimed by the imperative style of programming)
.
• Example Python, Erlang, Haskell
1.3 OOP
Object-Oriented Programming (OOP)
• Object-oriented programming (OOP) is a programming language model organized around object
s rather than "actions" and data rather than logic.
• OOP paradigm basically works upon real time scenarios based upon Object and classes.
• Every object in real life has some states/ properties termed as variables in OOP and also has so
me behaviors termed as method in OOP.
• So the structure that defines object is class.
• The first step in OOP is to identify all the objects the programmer wants to manipulate and how t
hey relate to each other, known as data modeling. Once an object has been identified, it is gener
alized as a class of objects.
• For Example Human is class and ALI, Kamran, Sana are the objects.
Pillars of OOP
The building of OOP is based on following four pillars.
• Inheritance.
• Abstraction
• Polymorphism.
• Encapsulation.
Inheritance
• Concept of inheritance is applied in OOP: subclasses has some co
mmon features that inherit from its super class.
• For Example
Human is super class
Male and Female are the sub classes

It’s a concept of parent and child hierarchy.


Any examples??
Abstraction

• Hiding details from outside world


• Skin is an example of human body class.
Polymorphism
• Polymorphism deals in two ways
• How to perform(more than one way)
• on which data it perform
• Example
• From foot : forward walking and backward walki
ng
• Write(left hand) or write (right hand )
Encapsulation
• It refers to binding properties with
functions
• It may referred as data hiding.
• Hands and Foot are dedicated and bound
to do their work that is holding and walking
.
Advantages
• Due to modularity and encapsulation, OOP offers ease of management
• OOP mimics the real world, making it easier to understand
• Since objects are whole within themselves, they are reusable in other progr
ams
Disadvantages
• Object-Oriented programs tend to be slower and use up a high amount of m
emory
• Programs built using this paradigm may take longer to be created
1.4: Java:OOP paradigm
• Java is a programming language and a platform based on object-oriented p
rogramming concepts. It was first released by Sun Microsystems in 1995.
• There are lots of applications and websites that will not work unless Java is
being installed, and more are created every day. Java is high level, fast,
secure, and reliable.
• From laptops to datacenters, game consoles to scientific supercomputers,
cell phones to the Internet, Java is everywhere!
• Java language will be used throughout this workbook to understand OOP.
• It has industrial application as has strong roots in mobiles apps / android
development
1.5 Three Concepts
• JDK
JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a
software development environment which is used to develop Java applications and 
applets. It physically exists. It contains JRE + development tools.
JDK is an implementation of any one of the below given Java Platforms released by
Oracle Corporation:
Standard Edition Java Platform
Enterprise Edition Java Platform
Micro Edition Java Platform
The JDK contains a private Java Virtual Machine (JVM) and a few other resources s
uch as an interpreter/loader (java), a compiler (javac), an archiver (jar), a documenta
tion generator (Javadoc), etc. to complete the development of a Java Application.
• JDK= JRE+ Development toolkits
• JRE
JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. Th
e Java Runtime Environment is a set of software tools which are used for developing
Java applications. It is used to provide the runtime environment. It is the implementa
tion of JVM. It physically exists. It contains a set of libraries + other files that JVM us
es at runtime.
The implementation of JVM is also actively released by other companies besides Su
n Micro Systems.
• JRE= set of libraries/packages+JVM
• JVM
JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine bec
ause it doesn't physically exist. It is a specification that provides a runtime environme
nt in which Java byte code can be executed. It can also run those programs which ar
e written in other languages and compiled to Java bytecode .

You might also like