Objects as a programming concept

Slides:



Advertisements
Similar presentations
AP Computer Science A – Healdsburg High School 1 Unit 3 - Classes and Objects - Example.
Advertisements

Computer Science Dept. Fall 2003 Object models Object models describe the system in terms of object classes An object class is an abstraction over a set.
Unified Modeling Language
Introduction to Information and Computer Science Computer Programming Lecture e This material (Comp4_Unit5e) was developed by Oregon Health and Science.
OBJECT-ORIENTED PROGRAMMING CONCEPTS (Review). What is an Object? What is an Object? Objects have states and behaviors. Example: A dog has states - color,
Lecture #5 Agenda Cell phones off & name signs out Review Questions? UML class diagram introduction Our first class definition!
Syntax & terminology review While the following slides are not exactly what we did on the board (object diagrams are not shown here) they cover most of.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
1 Composition A whole-part relationship (e.g. Dog-Tail) Whole and part objects have same lifetime –Whole creates instance of part in its constructor In.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
What is an object? Your dog, your desk, your television set, your bicycle. Real-world objects share two characteristics: They all have state and behavior;
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Introduction to Programming. To gain a sound knowledge of programming principles To gain a sound knowledge of object- orientation To be able to critically.
UML class diagrams (1) UML = Unified Modeling Language We use only class diagrams, not other UML diagrams Purpose: –keep OO concepts separate from implementation.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
BCS 2143 Introduction to Object Oriented and Software Development.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
SE-1010 Dr. Mark L. Hornick 1 Introduction to Object-Oriented Programming (OOP) Part 1.
1 Chapter 3 and 6– Classes, Objects and Methods Object-Oriented Programming Concepts – Read it from Java TutorialJava Tutorial Definition: A class is a.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Introduction to Java Programming. History F James Gosling and Sun Microsystems F Oak F Java, May 20, 1995, Sun World F HotJava –The first Java-enabled.
Lecture 1 Introduction to Java MIT-AITI Ethiopia 2004.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Classes 1 COMPSCI 105 S Principles of Computer Science.
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
1/26 On-demand Learning Series Software Engineering of Web Application - Object-Oriented Development & UML Hunan University, Software School.
Component 4: Introduction to Information and Computer Science Unit 5: Overview of Programming Languages, Including Basic Programming Concepts Lecture 5.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Programming. To gain a sound knowledge of programming principles To gain a sound knowledge of object- orientation To be able to critically assess the.
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
 An object is basically anything in the world that can be created and manipulated by a program.  Examples: dog, school, person, password, bank account,
IB Computer Science Content developed by Dartford Grammar School Computer Science Department UML.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
Introduction to Object-oriented Programming
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Unit II-Chapter No. : 5- design Patterns
Objects as a programming concept
Control Systems IB Computer Science.
Planning & System Installation
Objects as a programming concept
Computer Organisation
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Objects as a programming concept
Classes and OOP.
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Planning & System Installation
System Design Basics IB Computer Science.
GENERAL OOPs CONCEPTS.
Planning & System Installation
Table of Contents Class Objects.
Object Oriented Programming
Planning & System Installation
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
OBJECT ORIENTED CONCEPTS
Object Oriented Programming
What is an object? An object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the.
Your First Java Application
Teach A-Level Computer Science: Object-Oriented Programming in Python
Defining Classes and Methods
Which best describes the relationship between classes and objects?
Inheritance and Polymorphism
Presentation transcript:

Objects as a programming concept IB Computer Science

HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4: Computational thinking 5: Abstract data structures 6: Resource management 7: Control D: OOP

HL & SL D.1 Overview 1: System design 2: Computer Organisation 3: Networks D.1 Objects as a programming concept D.1.1 Outline the general nature of an object D.1.2 Distinguish between an object (definition, template or class) and instantiation D.1.3 Construct unified modelling language (UML) diagrams to represent object designs D.1.4 Interpret UML diagrams D.1.5 Describe the process of decomposition into several related objects D.1.6 Describe the relationships between objects for a given problem D.1.7 Outline the need to reduce dependencies between objects in a given problem D.1.8 Construct related objects for a given problem D.1.9 Explain the need for different data types to represent data items D.1.10 Describe how data items can be passed to and from actions as parameters 4: Computational thinking 5: Abstract data structures 6: Resource management 7: Control D: OOP

Topic D.1.1 Outline the general nature of an object

Definition: object An object is a ‘thing’. An object is an abstract entity. It has two components: data and actions.

Object & Class Object - Objects have states (variables) and behaviors (methods). Example: A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class. Class - A class can be defined as a template/blue print that describes the behaviors/states that object of its type support.

etc. All these objects have a state and behavior. Real world vs Software What are real-world objects? Cars, Dogs, Humans, etc. All these objects have a state and behavior. If we consider a dog, then its state is - name, breed, color, and the behavior is - barking, wagging, running Software objects also have a state and behavior. A software object's state is stored in fields and behavior is shown via methods.

Example: Fields States Methods Behaviours

Constructors Every class has a constructor. Each time a new object is created, at least one constructor will be invoked (called/run). The main rule of constructors is that they should have the same name as the class. A class can have more than one constructor.

Steps in object creation: A class provides the blueprints for objects. An object is created from a class. In Java, the new key word is used to create new objects. There are three steps when creating an object from a class: Declaration: A variable declaration with a variable name with an object type. Instantiation: The 'new' key word is used to create the object. Initialization: The 'new' keyword is followed by a call to a constructor. This call initializes the new object.

Example: Output:

Summary of code

Output:

We tend to split classes Many methods Object Class main() Running Class

Output:

Summary – key terms Think Pair Share Object Class State Behaviour Field Method Constructor Declaration Instantiation Initialization Think Pair Share