Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 03 – Class Design, Object Discovery and Use Richard Salomon Centre for.

Slides:



Advertisements
Similar presentations
When is Orientated Programming NOT? Mike Fitzpatrick.
Advertisements

Python Mini-Course University of Oklahoma Department of Psychology Lesson 26 Classes and Objects 6/16/09 Python Mini-Course: Lesson 26 1.
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 11 Classes and Object- Oriented Programming.
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
ECE122 L6: Problem Definition and Implementation February 15, 2007 ECE 122 Engineering Problem Solving with Java Lecture 6 Problem Definition and Implementation.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 15 – Digital Clock Application: Building Your.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
More C++ Bryce Boe 2013/07/18 CS24, Summer 2013 C.
IT PUTS THE ++ IN C++ Object Oriented Programming.
Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 2 Intro to Classes Richard Salomon and Umesh Patel Centre for Information.
© 2008 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Writing Classes (Chapter 4)
Chapter 5 - Writing a Problem Domain Class Definition1 Chapter 5 Writing a Problem Domain Class Definition.
Chapter 11 Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
CSC 212 – Data Structures Lecture 12: Java Review.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: Early Objects Third Edition by Tony Gaddis Chapter.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Mason Vail.  A data type definition – “blueprint for objects”  Includes properties and/or methods ◦ “instance” data / methods – specific to one object.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CH 8 : Enhancing Classes - Review QUICK REVIEW : A Class defines an entity’s (Object’s) data and the actions or behaviors (Methods) associated with that.
CET203 SOFTWARE DEVELOPMENT Session 1A Revision of Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Chapter 13. Procedural programming vs OOP  Procedural programming focuses on accomplishing tasks (“verbs” are important).  Object-oriented programming.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
Java Classes Chapter 1. 2 Chapter Contents Objects and Classes Using Methods in a Java Class References and Aliases Arguments and Parameters Defining.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
© 2004 Pearson Addison-Wesley. All rights reserved September 12, 2007 Encapsulation ComS 207: Programming I (in Java) Iowa State University, FALL 2007.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
CS0007: Introduction to Computer Programming Classes: Documentation, Method Overloading, Scope, Packages, and “Finding the Classes”
Introduction to Classes and Objects. Real Life When a design engineer needs an electrical motor he doesn’t need to worry about –How a foundry will cast.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
Designing Classes CS239 – Jan 26, Key points from yesterday’s lab  Enumerated types are abstract data types that define a set of values.  They.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
IT108 Objects and Classes Part I George Mason University Revised 4/3/2012.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
5.1 Basics of defining and using classes A review of class and object definitions A class is a template or blueprint for an object A class defines.
Unified Modeling Language (UML)
Outline Anatomy of a Class Encapsulation Anatomy of a Method Copyright © 2014 Pearson Education, Inc.
Mr H Kandjimi 2016/01/03Mr Kandjimi1 Week 3 –Modularity in C++
Class Definitions and Writing Methods Chapter 3 3/31/16 & 4/4/16.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Copyright © 2012 Pearson Education, Inc. Chapter 4 Writing Classes : Review Java Software Solutions Foundations of Program Design Seventh Edition John.
Andrew(amwallis) Classes!
Objects as a programming concept
Programming Logic and Design Seventh Edition
University of Central Florida COP 3330 Object Oriented Programming
Chapter 3: Using Methods, Classes, and Objects
About the Presentations
OBJECT ORIENTED CONCEPTS
Nouns Nouns not noun noun noun not not
Classes In C#.
Object-Oriented Design
Object Oriented Programming in Python
Outline Anatomy of a Class Encapsulation Anatomy of a Method
CIS16 Application Development and Programming using Visual Basic.net
Object-Oriented Programming
Dr. R Z Khan Handout-3 Classes
Programming For Big Data
Classes and Objects CGS3416 Spring 2019.
Lecture 8 Object Oriented Programming (OOP)
Presentation transcript:

Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 03 – Class Design, Object Discovery and Use Richard Salomon Centre for Information and Communication Technology Box Hill Institute of TAFE

January 29, 2016January 29, 2016January 29, 2016Slide2 Copyright Box Hill Institute Contents at a Glance Steps in Creating an Object Steps in Creating an Object Discovery of Objects Discovery of Objects Class Definition Class Definition Use of Objects Use of Objects Pass by value Pass by value

January 29, 2016January 29, 2016January 29, 2016Slide3 Copyright Box Hill Institute Steps in Creating an Object 1. Design the object attributes and behaviours 2. Define the object and create a class definition (blueprint for the object) 3. Create an object – instantiate 4. Use the object

January 29, 2016January 29, 2016January 29, 2016Slide4 Copyright Box Hill Institute Discovery of Objects Write a simple description of the what your program is about, including its purpose and intended usage Write a simple description of the what your program is about, including its purpose and intended usage Underline all nouns and adjectives in one colour. The nouns and adjectives are potential objects and fields, but not all make sense to be used. Underline all nouns and adjectives in one colour. The nouns and adjectives are potential objects and fields, but not all make sense to be used.

January 29, 2016January 29, 2016January 29, 2016Slide5 Copyright Box Hill Institute Discovery of Objects Next underline al the verbs and adverbs in another colour. Next underline al the verbs and adverbs in another colour. The verbs and adverbs are your potential methods The verbs and adverbs are your potential methods Now define the classes, using the appropriate nouns and adjectives for attributes and the appropriate verbs and adverbs for the methods Now define the classes, using the appropriate nouns and adjectives for attributes and the appropriate verbs and adverbs for the methods

January 29, 2016January 29, 2016January 29, 2016Slide6 Copyright Box Hill Institute Class Definition Don’t make the class too broad Don’t make the class too broad You may have many classes You may have many classes It is better to have more tightly defined classes than fewer broad classes It is better to have more tightly defined classes than fewer broad classes A constructor method is required to create an object. A constructor method is required to create an object.

January 29, 2016January 29, 2016January 29, 2016Slide7 Copyright Box Hill Institute A programmer may choose not to define a constructor. In such a case, just use a null constructor. A programmer may choose not to define a constructor. In such a case, just use a null constructor. Standard methods are setters (mutators) and getters (accessors). Standard methods are setters (mutators) and getters (accessors). Custom methods are used to implement the application rules. Custom methods are used to implement the application rules. Class Definition

January 29, 2016January 29, 2016January 29, 2016Slide8 Copyright Box Hill Institute Use of Objects Objects interact with each other to accomplish different tasks Objects interact with each other to accomplish different tasks This interaction occurs when one object uses the public methods of the other object This interaction occurs when one object uses the public methods of the other object The dot operator is used to gain access to these methods. The dot operator is used to gain access to these methods. Object instance data is accessed through the reference variable of the object Object instance data is accessed through the reference variable of the object

January 29, 2016January 29, 2016January 29, 2016Slide9 Copyright Box Hill Institute Use of Objects Class data is accessed through the use of the class name Class data is accessed through the use of the class name Only non-private data or methods are accessible to other objects Only non-private data or methods are accessible to other objects Python treats all classes and attributes (data and methods) as public by default Python treats all classes and attributes (data and methods) as public by default

January 29, 2016January 29, 2016January 29, 2016Slide10 Copyright Box Hill Institute Pass by value A copy of the variable value is passed. The original variable value remains unchanged A copy of the variable value is passed. The original variable value remains unchanged Return value is a copy of the local variable value NB the data type of the return value must match the data type of the method Return value is a copy of the local variable value NB the data type of the return value must match the data type of the method