2.1 Introduction to Object-Oriented Programming

Slides:



Advertisements
Similar presentations
Based on Java Software Development, 5th Ed. By Lewis &Loftus
Advertisements

Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley STARTING OUT WITH Python Python First Edition by Tony Gaddis Chapter 9 Classes.
Road Map Introduction to object oriented programming. Classes
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Basic OOP Concepts and Terms
Terms and Rules Professor Evan Korth New York University (All rights reserved)
ASP.NET Programming with C# and SQL Server First Edition
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
Introduction to Object Oriented Design. Topics Designing Your Own Classes Attributes and Behaviors Class Diagrams.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Centre for Computer Technology ICT115 Object Oriented Design and Programming Week 2 Intro to Classes Richard Salomon and Umesh Patel Centre for Information.
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
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.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
An Introduction to the Unified Modeling Language
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Overview The Basics – Python classes and objects Procedural vs OO Programming Entity modelling Operations / methods Program flow OOP Concepts and user-defined.
1.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Object-Oriented Programming (OOP) What we did was: (Procedural Programming) a logical procedure that takes input data, processes it, and produces output.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
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.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object-Oriented Programming: Classes and Objects.
Computer Programming II Lecture 5. Introduction to Object Oriented Programming (OOP) - There are two common programming methods : procedural programming.
Introduction to Object-oriented Programming
Programming Logic and Design Seventh Edition
Chapter 3: Using Methods, Classes, and Objects
Object Oriented Concepts -I
Introduction to Classes
Object-Orientated Programming
Object Based Programming
Introduction to Classes
Chapter 3 Introduction to Classes, Objects Methods and Strings
Corresponds with Chapter 7
Defining Classes and Methods
Object-Oriented Programming: Classes and Objects
Basics of OOP A class is the blueprint of an object.
By Rajanikanth B OOP Concepts By Rajanikanth B
Basic OOP Concepts and Terms
Chapter 22 Object-Oriented Systems Analysis and Design and UML
Lecture 8 Object Oriented Programming (OOP)
Presentation transcript:

2.1 Introduction to Object-Oriented Programming

2.1.1 Procedural versus OOP languages Procedural programming involves creating a sequence of instructions OOP uses a collection of interacting objects Functions are logically grouped, making enhancements easy OOP can model human problem-solving

2.1.2 Basic Java terminology Object. contains data and instructions Class. blueprint for an object Attribute. describe the state of objects Data Type. describes what kind of information a certain attribute is Behavior. describe what objects can do Method. a set of instructions Inheritance. Some objects derive attributes and behaviors from other objects Encapsulation. Combining data and methods together

2.2 What are Objects? 2.2.1 Introduction to objects Anything tangible or abstract that is relevent Objects can have attributes and behaviors Attributes describe the object Behaviors describe what the object can do

2.2.2 Classification of objects User Interface objects Objects that the user interacts directly with Operating environment objects Provide services to other components Task Related objects Documents, multimedia, problem domain

2.2.3 Objects - identifying, defining, creating and operating on Identifying – Requires needs assessment Defining – Classification, relationships, operations. The class keyword Creating – The constructor and the new keyword Operating – Using an object’s methods

2.2.7 Encapsulation To hide the details, package together Access modifiers – public, private and protected

2.2.8 Object relationships Association Whole-part Inheritance Objects know about each other Whole-part Existance of an object relies on another Inheritance Attributes & behaviors can be inherited

2.2.9 Inheritance

2.2.10 Object mutability and destruction Some object attributes should be immutable, or unchangable To make an item immutable, use the final keyword The JVM automatically releases memory when objects are no longer required The garbage collector will reclaim memory by objects that are no longer referenced Garage collection is not controllable

2.3.1 Modeling languages and symbols Unified Modeling Language (UML) standardizes symbols & terminology for diagramming objects

2.3.2 Basic Class symbol Rectangle represents a class of objects 3 compartments: Name, attributes , and operations or methods Symbols indicate accessibility

2.4.1 Class definition Defined by using the class keyword Public classes defined in separate files Filename must be the same as the class name public class Person { private String name; public Person(String theName) { name = theName; }

2.4.2 Creating objects Constructor methods are called when an object is created All object data is stored in memory Variables are a reference to the memory location

2.4.3 Object methods Mutator – Changes object data Accessor – Retrieves object data Methods with no arguments Methods that require arguments Method return values – Provide a result to the caller

2.5.1 System class Data stored by an object is member data Data present in an object’s methods is called local or temporary data Java.lang.System is a pre-defined object that can be used to perform system tasks System.out.println(“Hello World!”);