Download presentation
Presentation is loading. Please wait.
Published byVirginia Nichols Modified over 8 years ago
1
Copyright ©2005 Department of Computer & Information Science Object Oriented Concepts
2
Copyright ©2005 Department of Computer & Information Science Goals Understand objects, their attributes and their methods.Understand objects, their attributes and their methods. Understand the pillars of object- oriented programming as encapsulation, inheritance & polymorphism.Understand the pillars of object- oriented programming as encapsulation, inheritance & polymorphism.
3
Copyright ©2005 Department of Computer & Information Science OOP Concepts ObjectsObjects AttributesAttributes MethodsMethods EventsEvents Abstraction & ClassesAbstraction & Classes ConstructorsConstructors
4
Copyright ©2005 Department of Computer & Information Science What is an object? An object is a unique programming entity that has attributes to describe it (like adjectives in grammar) and methods to retrieve/set attribute values (like verbs in grammar).An object is a unique programming entity that has attributes to describe it (like adjectives in grammar) and methods to retrieve/set attribute values (like verbs in grammar).
5
Copyright ©2005 Department of Computer & Information Science Attributes Programmers store an object’s data in attributes, also called properties.Programmers store an object’s data in attributes, also called properties. Attributes provide us a way to describe an object, similar to adjectives in grammar.Attributes provide us a way to describe an object, similar to adjectives in grammar. We can read property values or change properties, assigning values.We can read property values or change properties, assigning values.
6
Copyright ©2005 Department of Computer & Information Science Methods Whereas attributes describe an object, methods allow us to access object data. Methods are like verbs in grammar.Whereas attributes describe an object, methods allow us to access object data. Methods are like verbs in grammar. We can manipulate object data, stored in attributes, using methods.We can manipulate object data, stored in attributes, using methods.
7
Copyright ©2005 Department of Computer & Information Science Events Object-oriented programming is inherently tied to user interaction. Programs record interaction in the form of events.Object-oriented programming is inherently tied to user interaction. Programs record interaction in the form of events. Events are changes in an object’s environment to which it can react.Events are changes in an object’s environment to which it can react.
8
Copyright ©2005 Department of Computer & Information Science Abstraction One of the chief advantages of object-oriented programming is the idea that programmers can essentially focus on the “big picture” and ignore specific details regarding the inner- workings of an object. This concept is called abstraction.One of the chief advantages of object-oriented programming is the idea that programmers can essentially focus on the “big picture” and ignore specific details regarding the inner- workings of an object. This concept is called abstraction.
9
Copyright ©2005 Department of Computer & Information Science Classes How do programmers get by implementing abstraction? They use a programming structure called a class.How do programmers get by implementing abstraction? They use a programming structure called a class. A class presents a blueprint of an object, its properties and its methods.A class presents a blueprint of an object, its properties and its methods.
10
Copyright ©2005 Department of Computer & Information Science Instantiation To create an object based on a class, we create an instance of that class. This process is called instantiation.To create an object based on a class, we create an instance of that class. This process is called instantiation. In Java, JavaScript and other languages, we use a special method called a constructor method to create an instance of an object.In Java, JavaScript and other languages, we use a special method called a constructor method to create an instance of an object.
11
Copyright ©2005 Department of Computer & Information Science Encapsulation Abstraction in OOP is closely related to a concept called encapsulation.Abstraction in OOP is closely related to a concept called encapsulation. Data and the ways to get at that data are wrapped in a single package, a class. The only way to access such data is through that package. This idea translates to information hiding.Data and the ways to get at that data are wrapped in a single package, a class. The only way to access such data is through that package. This idea translates to information hiding.
12
Copyright ©2005 Department of Computer & Information Science Inheritance Another of the main tenets of OOP is inheritance. Inheritance allows programmers to create new classes from existing ones.Another of the main tenets of OOP is inheritance. Inheritance allows programmers to create new classes from existing ones. A child class inherits its properties and attributes from its parents, which programmers can change.A child class inherits its properties and attributes from its parents, which programmers can change.
13
Copyright ©2005 Department of Computer & Information Science Polymorphism Polymorphism describes how programmers write methods to do some general purpose function.Polymorphism describes how programmers write methods to do some general purpose function. Different objects might perform polymorphic methods differently.Different objects might perform polymorphic methods differently.
14
Copyright ©2005 Department of Computer & Information Science Summary Programming objects are comprised of attributes and methods.Programming objects are comprised of attributes and methods. Classes provide programmers with blueprints of objects.Classes provide programmers with blueprints of objects. To create an object from a class, we use constructor methods to create a class instance.To create an object from a class, we use constructor methods to create a class instance.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.