Interfaces, Classes & Objects

Slides:



Advertisements
Similar presentations
L3:CSC © Dr. Basheer M. Nasef Lecture #3 By Dr. Basheer M. Nasef.
Advertisements

1 Chapter 8 Objects and Classes Lecture 2 Prepared by Muhanad Alkhalisy.
Creating an OOED Application
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Programming with Objects: Class Libraries and Reusable Code.
1 Basic Object Oriented Concepts Overview l What is Object-Orientation about? l What is an Object? l What is a Class? l Constructing Objects from Classes.
Chapter 13: Object-Oriented Programming
Chapter 10 Classes Continued
UML class diagrams (1) UML = Unified Modeling Language We use only class diagrams, not other UML diagrams Purpose: –keep OO concepts separate from implementation.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
Java Objects and Classes. 3-2 Object Oriented Programming  An OO program models the application as a world of interacting objects.  A typical Java program.
Programming Task: Task 1 Controlled Assessment Practice.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 8: More About OOP and GUIs.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
An Object-Oriented Approach to Programming Logic and Design
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
Java Programming: From Problem Analysis to Program Design, Second Edition1  Learn about basic GUI components.  Explore how the GUI components JFrame,
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
JavaScript - A Web Script Language Fred Durao
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 6: Object-Oriented Programming.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 7: Methods & User Input.
Object Oriented Programming Examples: C++, Java Advantages: 1. reusibility of code 2. ability to adapt (extend) previously written code.
Chapter 8 Objects and Classes Object Oriented programming Instructor: Dr. Essam H. Houssein.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Graphical User Interface You will be used to using programs that have a graphical user interface (GUI). So far you have been writing programs that have.
School of Computer Science & Information Technology G6DICP - Lecture 11 Classes & Objects.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object-Oriented Programming: Inheritance and Polymorphism.
Object Oriented Programming Object and Classes Lecture 3 MBY.
Object Oriented Programming Lecture 3: Things OO.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Object and Classes อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 3.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
1 Section 11.4 Java Interfaces – The Implementation Perspective Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Object Oriented Programming Some Interesting Genes.
Introduction to Object-oriented Programming
Chapter 7 Objects and Classes
More Sophisticated Behavior
Objects as a programming concept
Objects First with Java A Practical Introduction using BlueJ
Chapter 8: More About OOP and GUIs
Understand the Fundamentals of Classes
Classes and OOP.
Introduction to Visual Basic 2008 Programming
Unified Modeling Language
Table of Contents Class Objects.
Java Programming: From Problem Analysis to Program Design,
Types of Programming Languages
Unit-2 Objects and Classes
C# Object Oriented Programming Concepts
Your First Java Application
Object-oriented Design in Processing
Java External Libraries & Case Study
Object-oriented Design in Processing
Object-Oriented Programming: Inheritance and Polymorphism
Outline Anatomy of a Class Encapsulation Anatomy of a Method
Building a program (Java libraries) - an example
Object-oriented Design in Processing
Classes and Objects B.Ramamurthy 5/9/2019 B.Ramamurthy.
Handout-2(a) Basic Object Oriented Concepts
Object-oriented Design in Processing
From Class Diagram to Contract Diagram
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

Interfaces, Classes & Objects 13 Interfaces, Classes & Objects

Previously Class Libraries Packages Using Core Java Classes Process Packages Views Javadoc Output – HTML View

Overview Classes Objects Instances Variables Methods Interfaces Principles of Object Orientation

Classes and OO Programming An OO program consists of at least one (usually many more) inter-dependent classes. A class is a user-defined data type that describes the properties and capabilities of the real-world objects with which the program has to deal. A class is a generic type of “thing”, whereas a specific “thing” (an instance of the class) is an Object. A class definition consists of both the properties (i.e. data) and the capabilities (i.e. program code) of that class.

An Analogy Consider the class Pen i.e. pens in general, not any one pen in particular. Properties (variables) Colour Thickness Type of Ink Capabilities (methods) Remove lid Draw line Draw circle Replace lid

An Analogy - Objects Instances of class Pen i.e. specific pens, belonging to specific people. Adam’s boardwriter Adam’s biro Amadeo’s pen Instances of the class Pen are called Objects.

Using Classes Definition Instantiation Declaration of variables Instance variables - specific to one instance of a class Class variables - shared by all instances of that class Definition of methods A method is the program code required to perform a specific task with the class. Methods consist of statements. Instantiation Usually an instance of a class needs to be created before it can be used. Some classes (especially utility classes) have methods and variables that can be used without instantiation.

Interfaces Interfaces allow you to declare the structure of a class They declare the variables and methods available To create an instance of an interface you would implement it

The Purpose of OO Programming Classes should model the real world - thus leading to efficient coding. Classes are reusable. Libraries of reusable classes (“class libraries”) make sophisticated functionality easily available. This is a “construction kit” approach to programming. For example - consider graphical programs: Window class Text box Button class