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

Presentation For Object Oriented Programming

The document provides an introduction to an object-oriented programming course in Java, including: - An overview of the course chapters which cover fundamental programming concepts, object-oriented principles, GUI development, data structures and more. - A syllabus listing learning outcomes such as understanding computers, algorithms, and object-oriented design using Java. - Instructions for students to set up their Java programming environment and run a basic "Hello World" program for the first assignment.

Uploaded by

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

Presentation For Object Oriented Programming

The document provides an introduction to an object-oriented programming course in Java, including: - An overview of the course chapters which cover fundamental programming concepts, object-oriented principles, GUI development, data structures and more. - A syllabus listing learning outcomes such as understanding computers, algorithms, and object-oriented design using Java. - Instructions for students to set up their Java programming environment and run a basic "Hello World" program for the first assignment.

Uploaded by

susuhaha0101
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Object Oriented

Programming
Chapter 1: Introduction
1.1 Computer Programs
1.2 The Anatomy of a Computer
1.3 The Java Programming Language
1.4 Becoming Familiar with Your Programming Environment
1.5 Analyzing Your First Program
1.6 Errors
1.7 Problem Solving: Algorithm Design

1
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming
Syllabus
❑ Semester: 2023-2024 Fall
❑ Course Description: SENG 209 Object Oriented Programming
❑ This is an introductory course for the topics to object-oriented programming
with Java.
❑ The course also covers the fundamentals of algorithmic problem-solving
techniques by using basic control and data structures.
❑ Other topics include fundamental data types, control structures including
conditions and iteration, arrays, input and output.
❑ The course is a conceptual and application-based course on object-oriented
programming using the widely used java programming language.
❑ Basic concepts associated with object-oriented programming will be
introduced using the java Programming language and explained with
examples.
❑ Recommended - Textbook: Big Java: Late Objects, by Cay
2 Horstman, John Wiley & Sons Inc., ISBN: 978-1-118-08788-6
3.10.2023 18:27
❑ Course Hours: 3 hours of lecture & 2 hours of Lab. per week ©ÇELİK
Object Oriented Programming
Syllabus
❑ Learning Outcomes:
▪ Main objectives are:
✓ To understand fundamentals of a computer and programming topics,
✓ To develop basic computational thinking skills, i.e., algorithmic thinking
✓ To get familiar with fundamental concepts and terminology in computer programming
✓ To be able to use an integrated development environment to design and write code in the
Java programming language.
✓ To define and correctly use data types, decision structures, arrays, conditionals and loops.
✓ To understand the use of predefined classes and objects.
▪ Also, students
✓ Will be able to explain the basic principles of the use of abstraction,
✓ Will be able to explain the basic principles of object-oriented design workflow,
✓ Will be able to write object-oriented programs using the C# programming language,
✓ Be able to apply the concept of inheritance in object-oriented design,
✓ Will be able to apply the concepts of polymorphism and abstract classes as part of object-
3 oriented design.
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming
Syllabus (For detailed syllabus  look at the portal )
Total
Type Label Count
Contribution Evaluation of Lab grade:
1 Final written exam Final 1 40 Average all Lab exercises (approx. 8 for
this semester) will be evaluated as one
2 Midterm: written exam Midterm 1 30 grade + 2 Lab exams form the grade,
which is (Lab Exam 1+ Lab Exam 2+
3 Homework Homework Ave. of Lab assignments) / 3 = Lab
Grade
4 Quiz Quiz

5 Lab exam Lab exam 1 30

Minimum Requirements to Qualify for the Final Exam:


Students will receive an F grade unless they have a minimum 25% on the midterm exam, AND a minimum 50%
on every lab assignment.

4
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming
Useful Links & Learning Materials
▪ BIG JAVA: LATE OBJECTS, 2ND EDITION ▪ TUTORIALSPOINT
▪ https://www.wiley.com/en- ▪ https://www.tutorialspoint.com/java/java_environm
gb/Big+Java%3A+Late+Objects%2C+2nd+Edition-p- ent_setup.htm
978111932107101
▪ W3SCHOOLS
▪ Student Companion Site ▪ https://www.w3schools.com/java/default.asp
▪ https://bcs.wiley.com/he-
▪ JAVATPOINT
bcs/Books?action=index&itemId=1119321077&bc
sId=10406 ▪ https://www.javatpoint.com/java-tutorial

▪ Instructor Companion Site ▪ ORACLE TUTORIALS


▪ https://bcs.wiley.com/he- ▪ https://docs.oracle.com/javase/tutorial/
bcs/Books?action=index&itemId=1119321077&bc ▪ STACKOVERFLOW (Debugging etc.):
sId=10405 ▪ https://stackoverflow.com/
▪ Reference Sheet
▪ https://higheredbcs.wiley.com/legacy/college/horst
mann/1119321077/rs/BJLO_resources.pdf?newwi
ndow=true
5
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming
Reference Sheet:
https://higheredbcs.wiley.com/legacy/college/horstmann/1119321077/rs/BJLO_resources.pdf?newwindow=true

6
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming- Chapters
⚫ Chapter 1: Introduction ⚫ Chapter 14: Sorting and searching
⚫ Chapter 2: Fundamental Data Types ⚫ Chapter15: The Java Collections Framework
⚫ Chapter 3: Decisions ⚫ Chapter 16: Basic Data Structures
⚫ Chapter 4: Loops ⚫ Chapter 17: Tree Structures
⚫ Chapter 5: Methods ⚫ Chapter 18: Generic Classes
⚫ Chapter 6: Arrays and Array lists ⚫ Chapter 19: Streams and Binary Input/Output
⚫ Chapter 7: Input/output and exception handling ⚫ Chapter 20: Multithreading (Web Only)
⚫ Chapter 8: Objects and Classes ⚫ Chapter 21: Internet Networking (Web Only)
⚫ Chapter 9: Inheritance and Interfaces ⚫ Chapter 22: Relational databases (Web Only)
⚫ Chapter 10: Graphical User Interfaces ⚫ Chapter 23: XML (Web Only)
⚫ Chapter 11: Advanced user Interfaces
⚫ Chapter12: Object-Oriented Design
⚫ Chapter 13: Recursion
7
3.10.2023 18:27 ©ÇELİK
Object Oriented Programming
FISRT ASSIGNMENT- Until End of Next Lab Session
▪ SET UP YOUR PROGRAMMING ENVIRONMENT
▪ SET UP JAVA JDK (Java Development Kit)
▪ SET UP ECLIPSE IDE (Integrated Development Environment)
▪ RUN YOUR FIRT HELLO WORD JAVA FROGRAM
▪ RUN ON COMMAND CONSOLE
▪ RUN ON ECLIPSE

NOTE : FOR ALL SET UP’S FOLLOW


▪ TUTORIALSPOINT-Environment Setup
▪ https://www.tutorialspoint.com/java/java_environment_setup.htm
▪ TUTORIALSPOINT-Basic Syntax
▪ https://www.tutorialspoint.com/java/java_basic_syntax.htm
▪ W3SCHOOLS-Get Started
8 https://www.w3schools.com/java/java_getstarted.asp

3.10.2023 18:27 ©ÇELİK


Object Oriented Programming
FISRT ASSIGNMENT- Until End of Next Lab Session
⚫ To download the Java Development Kit, visit the web site at ⚫ Some Java Definitions and Jargons
www.oracle.com/technetwork/java/javase/downloads
⚫ Select your operation System and Type Tab and download (Ex:
For Operating System «windows» 64 Bit)

9
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 1: Introduction
1.1 Computer Programs
1.2 The Anatomy of a Computer
1.3 The Java Programming Language
1.4 Becoming Familiar with Your Programming Environment
1.5 Analyzing Your First Program 1
1.6 Errors
1.7 Problem Solving: Algorithm Design

⚫ Chapter 2: Fundamental Data Types


2.1 Variables
2.2 Arithmetic
2.3 Input and Output
2.4 Problem Solving: First Do It By Hand
2.5 Strings

10
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 3: Decisions
3.1 The if Statement
3.2 Comparing Numbers and Strings
3.3 Multiple Alternatives
3.4 Nested Branches 100
3.5 Problem Solving: Flowcharts
3.6 Problem Solving: Test Cases
3.7 Boolean Variables and Operators
3.8 Application: Input Validation

⚫ Chapter 4: Loops
4.1 The while Loop
4.2 Problem Solving: Hand-Tracing
4.3 The for Loop
4.4 The do Loop
4.5 Application: Processing Sentinel Values
4.6 Problem Solving: Storyboards
4.7 Common Loop Algorithms
4.8 Nested Loops
11 4.9 Application: Random Numbers and Simulations
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 5: Methods
5.1 Methods as Black Boxes
5.2 Implementing Methods
5.3 Parameter Passing
5.4 Return Values
5.5 Methods Without Return Values
5.6 Problem Solving: Reusable Methods
5.7 Problem Solving: Stepwise Refinement
5.8 Variable Scope
5.9 Recursive Methods (Optional)

⚫ Chapter 6: Arrays and Array lists


6.1 Arrays
6.2 The Enhanced for Loop
6.3 Common Array Algorithms
6.4 Using Arrays with Methods
6.5 Problem Solving: Adapting Algorithms
6.6 Problem Solving: Discovering Algorithms by Manipulating
Physical Objects
12 6.7 Two-Dimensional Arrays
3.10.2023 18:27
6.8 Array Lists ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 7: Input/output and exception handling


7.1 Reading and Writing Text Files
7.2 Text Input and Output
7.3 Command Line Arguments
7.4 Exception Handling
7.5 Application: Handling Input Errors

⚫ Chapter 8: Objects and Classes


8.1 Object-Oriented Programming
8.2 Implementing a Simple Class
8.3 Specifying the Public Interface of a Class
8.4 Designing the Data Representation
8.5 Implementing Instance Methods
8.6 Constructors
8.7 Testing a Class
8.8 Problem Solving: Tracing Objects
8.9 Problem Solving: Patterns for Object Data
8.10 Object References
13 8.11 Static Variables and Methods
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 9: Inheritance and Interfaces


9.1 Inheritance Hierarchies
9.2 Implementing Subclasses
9.3 Overriding Methods
9.4 Polymorphism
9.5 Object: The Cosmic Superclass
9.6 Interface Types

⚫ Chapter 10: Graphical User Interfaces


10.1 Frame Windows
10.2 Events and Event Handling
10.3 Processing Text Input
10.4 Creating Drawings

⚫ Chapter 11: Advanced user Interfaces


11.1 Layout Management
11.2 Choices
11.3 Menus
11.4 Exploring the Swing Documentation
14 11.5 Using Timer Events for Animations
3.10.2023 18:27 11.6 Mouse Events ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 12: Object-Oriented Design


12.1 Classes and Their Responsibilities
12.2 Relationships Between Classes
12.3 Application: Printing an Invoice
12.4 Packages

⚫ Chapter 13: Recursion


13.1 Triangle Numbers Revisited
13.2 Problem Solving: Thinking Recursively
13.3 Recursive Helper Methods
13.4 The Efficiency of Recursion
13.5 Permutations
13.6 Mutual Recursion
13.7 Backtracking

⚫ Chapter 14: Sorting and searching


14.1 Selection Sort
14.2 Profiling the Selection Sort Algorithm
14.3 Analyzing the Performance of the Selection Sort Algorithm
14.4 Merge Sort
14.5 Analyzing the Merge Sort Algorithm
15 14.6 Searching
14.7 Problem Solving: Estimating the Running Time of an Algorithm
3.10.2023 18:27 14.8 Sorting and Searching in the Java Library ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 15: The Java Collections Framework


15.1 An Overview of the Collections Framework
15.2 Linked Lists
15.3 Sets
15.4 Maps
15.5 Stacks, Queues, and Priority Queues
15.6 Stack and Queue Applications

⚫ Chapter 16: Basic Data Structures


16.1 Implementing Linked Lists
16.2 Implementing Array Lists
16.3 Implementing Stacks and Queues
16.4 Implementing a Hash Table

⚫ Chapter 17: Tree Structures


17.1 Basic Tree Concepts
17.2 Binary Trees
17.3 Binary Search Trees
17.4 Tree Traversal
17.5 Red-Black Trees
17.6 Heaps
16 17.7 The Heapsort Algorithm

3.10.2023 18:27 ©ÇELİK


1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 18: Generic Classes


18.1 Generic Classes and Type Parameters
18.2 Implementing Generic Types
18.3 Generic Methods
18.4 Constraining Type Parameters
18.5 Type Erasure

⚫ Chapter 19: Streams and Binary Input/Output


19.1 Readers, Writers, and Streams
19.2 Binary Input and Output
19.3 Random Access
19.4 Object Streams

⚫ Chapter 20: Multithreading (Web Only)


20.1 Running Threads
20.2 Terminating Threads
20.3 Race Conditions
20.4 Synchronizing Object Access
20.5 Avoiding Deadlocks
20.6 Application: Algorithm Animation

17
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 21: Internet Networking (Web Only)


21.1 The Internet Protocol
21.2 Application-Level Protocols
21.3 A Client Program
21.4 A Server Program
21.5 URL Connections

⚫ Chapter 22: Relational databases (Web Only)


22.1 Organizing Database Information
22.2 Queries
22.3 Installing a Database
22.4 Database Programming in Java
22.5 Application: Entering an Invoice

⚫ Chapter 23: XML (Web Only)


23.1 XML Tags and Documents
23.2 Parsing XML Documents
23.3 Creating XML Documents
23.4 Validating XML Documents

18
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

CONTENTS

⚫ Chapter 24: Web Applications (Web Only)


24.1 The Architecture of a Web Application
24.2 The Architecture of a JSF Application
24.3 JavaBeans Components
24.4 Navigation Between Pages
24.5 JSF Components
24.6 A Three-Tier Applications

19
3.10.2023 18:27 ©ÇELİK
Object Oriented
Programming
Chapter 1: Introduction
1.1 Computer Programs
1.2 The Anatomy of a Computer
1.3 The Java Programming Language
1.4 Becoming Familiar with Your Programming Environment
1.5 Analyzing Your First Program
1.6 Errors
1.7 Problem Solving: Algorithm Design

20
3.10.2023 18:27 ©ÇELİK
1.1 COMPUTER PROGRAMS

Chapter Goals

❑ To learn about computers and programming


❑ To compile and run your first Java program
❑ To recognize compile-time and run-time
errors
❑ To describe an algorithm with pseudocode

21
3.10.2023 18:27 ©ÇELİK
1.1 Computer Programs
Definitions

❑ A Computer Program is a sequence of


instructions and decisions
❑ Computers execute very basic instructions in
rapid succession
❑ Programming is the act of designing and
implementing computer programs
❑ Algorithm is a process or set of rules to be
followed in calculations or other problem-
solving operations, especially by a computer.
22
3.10.2023 18:27 ©ÇELİK
1.2 The Anatomy of a Computer
Anatomy

❑ The central processing unit (CPU)


performs program control and data
processing
❑ Storage devices include memory
(RAM) and secondary storage
▪ Hard disk
▪ Flash drives
▪ CD/DVD drives
❑ Input/Output devices allow the user to
interact with the computer
23 ▪ Mouse, keyboard, printer, screen…
3.10.2023 18:27 ©ÇELİK
1.2 The Anatomy of a Computer
Schematic Design of a PC

24
3.10.2023 18:27 ©ÇELİK
1.2 The Anatomy of a Computer
When you ‘run’ a program

❑ Program instructions and data (such as text,


numbers, audio, or video) are stored on the hard
disk, on a compact disk (or DVD), or elsewhere on
the network.
❑ When a program is started, it is brought into
memory, where the CPU can read it.
❑ The CPU runs the program one instruction at a
time. The program may react to user input
❑ As directed by these instructions and the user, the
CPU reads data, modifies it, and writes it back to
25 memory, the screen or secondary storage.
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
History

❑ In 1991, James Gosling of Sun


Microsystems designed what
would become the Java NOTICE : Applets are are no
longer supported by many
programming language browsers
As applets were available
before HTML5,
❑ Java was originally designed for modern CSS and JavaScript interface
DOM were standard, they were also

programming consumer devices, widely used for trivial effects such


as mouseover and navigation buttons.
This approach, which posed major
but it was first successfully used problems for accessibility and misused
system resources, is no longer in use
to write Internet applets and was strongly discouraged even at
the time.

▪ An applet is typically embedded Instead, new Java Web Tech’s


such as spring framework , Java
inside a web page and runs in the Server Faces-JSF, Java Server Pages
–JSP’s etc are encouraged.
context of a browser
26
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
History

❑ Java Design Goals


▪ Safe: Can be run inside a browser and will not
attack your computer
▪ Portable: Run on many Operating Systems
• Windows
• Mac OS
❑ Java programs are distributed as instructions for a
‘virtual machine,’ making them platform-
independent
▪ Virtual machines are available for most Operating
27 Systems. The iPhone is a notable exception
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
Java Virtual Machines

❑ Source code

❑ Portable ‘byte code’


▪ The compiler generates
byte code in a ‘class’ file
which can be run on any
Java Virtual Machine
❑ Oracle Tutorials
28 ▪ https://docs.oracle.com/javase/tutorial/

3.10.2023 18:27 ©ÇELİK


1.3 The Java Programming Language
Java Timeline

❑ Oracle purchased Sun (along with Java) in 2010


▪ There are still quite a few references and links to Sun Microsystems
29
which are now re-directed to Oracle
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
The Java API

❑ The Java Platform consists of two parts:


1) Java Virtual Machine
2) Java API
-- also called libraries
❑ The Application Programming Interface
(API) is a huge collection of handy software
packages that programmers can use:
▪ Graphics, user interface, networking, sound,
database, math, and many more
30
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
The Java SDK

❑ You need to install the Java SDK (Software Development


Kit) to create Java programs
▪ We will use java 21 as last version JDK from oracle site
• https://www.oracle.com/tr/java/technologies/downloads/#java21
• For Windows select windows tab and download and install x64
Installer
▪ Google ‘Java JDK download,’ Get SE version
▪ Location after installed on Windows will be:
• C:\Program Files\Java\jdk21.x
• The last few numbers may vary with releases
❑ The JDK includes programs such as:
▪ java.exe (Executes Java applications)
31 ▪ javac.exe (Java compiler)
3.10.2023 18:27 ▪ javadoc.exe (Javadoc generator) ©ÇELİK
1.3 The Java Programming Language
Additional slides
Introduction to Java - Key Benefits of Java
❑ Object-oriented
▪ An object is an identity that has data attributes, plus a set of functions that is used to manipulate
objects. The main exceptions is the primitive types such as integers and characters.
❑ Interpreted and platform independent
▪ Java programs are interpreted to the native machine’s instruction set at run time. Because Java
executes under the control of a Java Virtual Machine-JVM. Java programs can run on any
operating system that provide JVM.
❑ Dynamic and Distrubuted
▪ Java classes can be downloaded dynamically over the network when required. In addition, Java
provides extensive support for client-server and distrubuted programming.
❑ Multithreaded
▪ Java program can contain multiple threads to carry out many tasks in parallel. Multithreading
capability is built into Java and is under control of the platform-dependent JVM
❑ Robust and Secure
▪ Java has built in capabilities to prevent memory corruption. Java automatically manages the
process of memory allocation. It prohibits pointer arithmetic, and restricts objects to named
spaces in memory

32
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
Additional slides
Introduction to Java - Java Virtual Machine-JVM

❑ Java code is stored as a .java file


❑ The .java program is compiled into .class files
▪ Each .java file is compiled into a corresponding .class file with the same name.
For example, Movie.java will be compiled into Movie.class. These .class files
contain bytcodes, which are platform independent machine instructions.
❑ Bytcodes are interpreted at run time
▪ JVM provides the environment for running java programs. Just-in-Time (JIT)
compiler interprets Java bytecodes into the native instruction set for the
machine on which platform (ex. Ios, Android, Windows, Linux, Unix) the
programs is currently running. java Helloworld
public class Helloworld T?j???A?B?C? ?m?n? setLong?(IJ)V
{ T?j???A?B?C? ?m?n?
public static void main(String[] args) Compile setLong?(IJ)VT?j???A?B?C? ?m?n?
{
setLong?(IJ)V T?j???A?B?C? ?m?n? JVM
System.out.println("Hello World");
} (javac) setLong?(IJ)
} (java)
T?j???A?B?C? ?m?n? setLong?(IJ)V T?j???A?B?C? ?m?n?

33 setLong?(IJ)V

3.10.2023 18:27
Helloworld.java javac Helloworld.java Helloworld.class Running program
©ÇELİK
1.3 The Java Programming Language
Additional slides
Introduction to Java - Platform Independence

Operating System ❑ The JVM interprets the java program


and converts it into platform specific
machine instructions.
❑ It then runs the program beginning
JVM
with the static method called main
(….) in a stand-alone application.
Application

34
3.10.2023 18:27 ©ÇELİK
1.3 The Java Programming Language
Additional slides
Introduction to Java - Java and Enterprise Internet Computing – (full scale capability)

Web Application Database


Server Server Server
Presentation Bussiness Logic
Client

 ☕ ☕
• Servlets • Enterprise
• Java Server Java Beans
Pages (JSP) (EJB)
• CORBA

35
3.10.2023 18:27 ©ÇELİK

You might also like