Overview Of Java Object-Oriented Programming Language

Transcription

Overview of Java Object-OrientedProgramming Language ConceptsDouglas C. edu/ schmidtProfessor of Computer ScienceInstitute for SoftwareIntegrated SystemsVanderbilt UniversityNashville, Tennessee, USA

Learning Objectives of this Lesson Understand the key object-oriented conceptssupported in JavaAbstractionOOPPolymorphismInheritanceSee en.wikipedia.org/wiki/Java (programming language)2

Overview of KeyObject-Oriented ConceptsSupported by Java3

Key Object-Oriented Concepts Supported by Java Java was originally an object-oriented programming languageSee en.wikipedia.org/wiki/Object-oriented programming4

Key Object-Oriented Concepts Supported by Java Java was originally an object-oriented programming language Thus, Java apps were organized in terms of structural elementsSee en.wikipedia.org/wiki/Object-oriented programming5

Key Object-Oriented Concepts Supported by Java Java was originally an object-oriented programming language Thus, Java apps were organized in terms of structural elements e.g., classes, interfaces, & packagesSee en.wikipedia.org/wiki/Software design pattern6

Key Object-Oriented Concepts Supported by Java An object is an instance of a classthat performs certain operations &interacts with other objectsSee s.html7

Key Object-Oriented Concepts Supported by Java An object is an instance of a classthat performs certain operations &interacts with other objects An object in Java resides in amemory location of a computerSimpleSet T Object[] mElementDataint mSizeint mEnd.boolean add(E element)boolean contains(Object o)int size().See x/ImageCounter/src/main/java/utils/SimpleSet.java8

Key Object-Oriented Concepts Supported by Java An object is an instance of a classthat performs certain operations &interacts with other objects An object in Java resides in amemory location of a computer It consists of State – represented via data fieldsSimpleSet T Object[] mElementDataint mSizeint mEnd.boolean add(E element)boolean contains(Object o)int size().See les.html9

Key Object-Oriented Concepts Supported by Java An object is an instance of a classthat performs certain operations &interacts with other objects An object in Java resides in amemory location of a computer It consists of State – represented via data fields Behavior – represented viamethodsSimpleSet T Object[] mElementDataint mSizeint mEnd.boolean add(E element)boolean contains(Object o)int size().See s.html10

Key Object-Oriented Concepts Supported by Java Objects often correspond to real-worldentitiesanAccount : AccountMoney mCurrentBalanceboolean mOverdraftProtection.void deposit(Money amount)void withdrawl(Money amount)Money checkCurrentBalance().11

Key Object-Oriented Concepts Supported by Java Objects often correspond to real-worldentitiesanAccount : AccountMoney mCurrentBalanceboolean mOverdraftProtection.void deposit(Money amount)void withdrawl(Money amount)Money checkCurrentBalance().12

Key Object-Oriented Concepts Supported by Java Objects often correspond to real-worldentitiesanAccount : AccountMoney mCurrentBalanceboolean mOverdraftProtection.void deposit(Money amount)void withdrawl(Money amount)Money checkCurrentBalance().13

Key Object-Oriented Concepts Supported by Java Objects often correspond to real-worldentitiesanAccount : AccountMoney mCurrentBalanceboolean mOverdraftProtection.void deposit(Money amount)void withdrawl(Money amount)Money checkCurrentBalance().14

Key Object-Oriented Concepts Supported by Java Many non-object-oriented programming languages organizeapps in terms of functional elementsSee en.wikipedia.org/wiki/Procedural programming15

Key Object-Oriented Concepts Supported by Java Many non-object-oriented programming languages organizeapps in terms of functional elements e.g., actions & logic16

Key Object-Oriented Concepts Supported by Java Object-oriented Java programs alsoperform actions & contain logicAccountMoney mCurrentBalanceboolean mOverdraftProtection.void deposit(Money amount)void withdrawl(Money amount)Money checkCurrentBalance().17

Key Object-Oriented Concepts Supported by Java Object-oriented Java programs alsoperform actions & contain logic However, these functional elementsdon’t constitute main focus in theobject-oriented parts of Java18

Key Object-Oriented Concepts Supported by Java Object-oriented Java programs alsoperform actions & contain logic However, these functional elementsdon’t constitute main focus in theobject-oriented parts of JavaJava 8 does focus heavily19on functional programming

Key Object-Oriented Concepts Supported by Java Java supports key object-oriented conceptsAbstractionOOPPolymorphismSee www.stroustrup.com/whatis.pdf20Inheritance

Key Object-Oriented Concepts Supported by Java Java supports key object-oriented concepts, e.g. Data & control ee en.wikipedia.org/wiki/Abstraction (computer science)21

Key Object-Oriented Concepts Supported by Java Java supports key object-oriented concepts, e.g. Data & control abstractions e en.wikipedia.org/wiki/Inheritance (object-oriented programming)22

Key Object-Oriented Concepts Supported by Java Java supports key object-oriented concepts, e.g. Data & control abstractions Inheritance ee en.wikipedia.org/wiki/Polymorphism (computer science)23

Key Object-Oriented Concepts Supported by Java There are many other object-oriented languagesAbstractionOOPPolymorphismInheritanceSee en.wikipedia.org/wiki/List of object-oriented programming languages24

Key Object-Oriented Concepts Supported by Java These are (arguably) the most popular todayAbstractionOOPPolymorphismInheritanceSee en.wikipedia.org/wiki/List of object-oriented programming languages25

Key Object-Oriented Concepts Supported by Java Learning other object-oriented languagesis much easier once you know JavaAbstractionOOPPolymorphism26Inheritance

Key Object-Oriented Concepts Supported by Java If you already know Java well you’ll be bored by some parts of this material!27

Key Object-Oriented Concepts Supported by Java If you already know Java well you’ll be bored by some parts of this material! We will therefore move through this material fairly quicklyPlease ask any questions about this materialsince other lessons depend on it.28

End of Overview of JavaObject-Oriented ProgrammingLanguage Concepts29

Object-oriented Java programs also perform actions & contain logic However, these functional elements don’t constitute main focus in the object-oriented parts of Java. Key Object-Oriented Concepts Supported by Java. Ja