03-object-oriented-concepts

03-object-oriented-concepts - Object-Oriented Concepts CSE...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Object-Oriented Concepts CSE 114: Computer Science I SUNY at Stony Brook 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Modeling Information Model : simpliFed description Used to make decisions, make predictions, and simulate processes Models are an abstraction They reduce complexity by only considering relevant data 2
Background image of page 2
Models and Software Models are used to maintain information and answer queries about something We can implement models using software An object is a block of code that represents one element of a model Objects track information about some part of the problem 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Programming An object-oriented program uses objects to model the problem domain (the things we have to work with) Objects are constructed from data and program code Topics to consider: Designing objects Implementing objects Advanced concepts: access modiFers and static 4
Background image of page 4
What is an Object, Anyway? Objects are a very natural way to view the world around us Ex. People, things, even non-physical stuff (i.e., a bank account) Objects are deFned in terms of attributes and behaviors Attribute: properties that an object has (e.g., eye color, height, weight) Behavior: actions that an object can perform (e.g., walk, speak, pick up) An object is an entity that contains both data and behavior 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object Queries Query: question to which an object can respond Queries are always directed to a specifc object, and answered by that object Answers are based on the object’s attributes Answers can take any Form: T/±, integer, etc. An object can only respond to pre-programmed queries 6
Background image of page 6
Objects Are Self-Managing An object contains all of the functions (methods, representing “behavior”) that need to operate on its data (“attributes”) This is called encapsulation , which means that an object is responsible for managing its own data An object may hide its contents from the rest of the program This protects our data from mischief and can conceal how we represent and manipulate data inside an object 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Classes and Objects Every object is defned by a class A class is a template For objects oF that type — it describes the types oF data and the behaviors that each
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

03-object-oriented-concepts - Object-Oriented Concepts CSE...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online