IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.

Slides:



Advertisements
Similar presentations
Data Structures Static and Dynamic.
Advertisements

CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
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
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.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Lecture #4 Agenda Announcements Review Questions? Classes and objects UML class diagrams Creating.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
UML class diagrams (1) UML = Unified Modeling Language We use only class diagrams, not other UML diagrams Purpose: –keep OO concepts separate from implementation.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Fall 2005CSE 115/503 Introduction to Computer Science I1 Composition details Recall, composition involves 3 things: –Declaration of instance variable of.
The different types of variables in a Java program.
OOP Languages: Java vs C++
Programming Languages and Paradigms Object-Oriented Programming.
1 Chapter 3 and 6– Classes, Objects and Methods Object-Oriented Programming Concepts – Read it from Java TutorialJava Tutorial Definition: A class is a.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
Lecture 8 February 29, Topics Questions about Exercise 4, due Thursday? Object Based Programming (Chapter 8) –Basic Principles –Methods –Fields.
CS442: ADVANCED PROGRAMMING USING JAVA Lab 6: Classes and objects Computer Science Department.
1 Chapter Four Creating and Using Classes. 2 Objectives Learn about class concepts How to create a class from which objects can be instantiated Learn.
8. Inheritance “Is-a” Relationship. Topics Creating Subclasses Overriding Methods Class Hierarchies Abstract Class Inheritance and GUIs The Timer Class.
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.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept.
IB Economics assessment objectives and command terms.
IB Computer Science Content developed by Dartford Grammar School Computer Science Department UML.
Chapter Goals Describe the application development process and the role of methodologies, models, and tools Compare and contrast programming language generations.
Chapter 10 Application Development
Computer Organisation
Component 1.6.
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Objects as a programming concept
Planning & System installation
Resource Management IB Computer Science.
Planning & System Installation
Objects as a programming concept
Planning & System installation
Computer Organisation
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
System Backup IB Computer Science.
Objects as a programming concept
Computational Thinking, Problem-solving and Programming: General Principals IB Computer Science.
Planning & System Installation
Objects as a programming concept
System Design Basics IB Computer Science.
Computer Organisation
Planning & System installation
ENERGY 211 / CME 211 Lecture 25 November 17, 2008.
Planning & System Installation
Chapter 3: Using Methods, Classes, and Objects
System Design Basics IB Computer Science.
CompSci 230 Software Construction
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
IB Computer Science Topic 2.1.1
Haidong Xue Summer 2011, at GSU
Basic C++ What’s a declaration? What’s a definition?
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Inheritance, Polymorphism, and Interfaces. Oh My
Cs212: Data Structures Computer Science Department Lecture 2: Arrays.
Metadata Framework as the basis for Metadata-driven Architecture
An Introduction to Object Orientated Programming
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Outline Anatomy of a Class Encapsulation Anatomy of a Method
Inheritance and Polymorphism
Water Quality of Watershed
(C) 2010 Pearson Education, Inc. All rights reserved.
Classes and Objects CGS3416 Spring 2019.
Presentation transcript:

IB Computer Science Content developed by Dartford Grammar School Computer Science Department Objects as a programming concept

Content developed by Dartford Grammar School Computer Science Department HL Topics 1-7, D1-4

Content developed by Dartford Grammar School Computer Science Department HL & SL D.1 Overview 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

Content developed by Dartford Grammar School Computer Science Department Topic D.1.2 Distinguish between an object (definition, template or class) and instantiation

Content developed by Dartford Grammar School Computer Science Department Class vs. Object

Content developed by Dartford Grammar School Computer Science Department Reminder: 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.

Content developed by Dartford Grammar School Computer Science Department Declare > Instantiate > Initialize Point for discussion

Content developed by Dartford Grammar School Computer Science Department Instantiating objects uses RAM Every time a new object is instantiated from a base class, a space equivalent to the WHOLE object is reserved in RAM. Depending on the number of states in the object, a lot of RAM can be wasted / reserved but not used. Therefore, it is best to use the most memory efficient variable types.

Content developed by Dartford Grammar School Computer Science Department Variable in RAM vs. Object in RAM The more RAM being used by a program, the more processor time is needed to read/write/process the data. The more processor cycles being used, the more ‘sluggish’ the computer would be to the user. Basic point: More RAM used = slower response

Content developed by Dartford Grammar School Computer Science Department Good idea Creating a linked list (dynamic data type) of objects Why is this good? Only memory actually being used is reserved Bad idea Creating an array (static data type) of objects Why is this bad? Potential memory could be wasted in reserving space that might not be needed.