Eclipse – making OOP Easy

Slides:



Advertisements
Similar presentations
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Advertisements

Based on Java Software Development, 5th Ed. By Lewis &Loftus
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Session 07: C# OOP 4 Review of: Inheritance and Polymorphism. Static and dynamic type of an object. Abstract Classes. Interfaces. FEN AK - IT:
Object-Oriented PHP (1)
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Object-oriented Programming Concepts
Liang, Introduction to Programming with C++, Second Edition, (c) 2010 Pearson Education, Inc. All rights reserved Chapter 9 Objects and Classes.
CS 2511 Fall  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance  Polymorphism.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
CSSE501 Object-Oriented Development
BACS 287 Basics of Object-Oriented Programming 1.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Introduction to Object-oriented programming and software development Lecture 1.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
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.
1 Chapter 10: Data Abstraction and Object Orientation Aaron Bloomfield CS 415 Fall 2005.
Object Oriented Programming: Java Edition By: Samuel Robinson.
1. 2 Object-Oriented Concept Class & Object Object-Oriented Characteristics How does it work? Relationships Between Classes Development Tools Advantage.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Programming Languages and Paradigms Object-Oriented Programming.
Introduction to Object Oriented Programming CMSC 331.
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.
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.
CSSE501 Object-Oriented Development. Chapter 4: Classes and Methods  Chapters 4 and 5 present two sides of OOP: Chapter 4 discusses the static, compile.
Programming in Java CSCI-2220 Object Oriented Programming.
Object Oriented Software Development
11/28/2015B.Ramamurthy1 Object-Oriented Design and Java B.Ramamurthy.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
08 Encapsulation and Abstraction. 2 Contents Defining Abstraction Levels of Abstraction Class as Abstraction Defining a Java Class Instantiating a Class.
Object-Oriented Programming Chapter Chapter
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Object Oriented Programming
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
ISBN Object-Oriented Programming Chapter Chapter
Session 6 Comments on Lab 3 & Implications of Inheritance.
OOP Review CS 124.
Refactoring1 Improving the structure of existing code.
Subclassing, pt. 2 Method overriding, virtual methods, abstract classes/methods COMP 401, Fall 2014 Lecture 9 9/16/2014.
Object-Oriented Programming (Review) CS 123 Key OOP Concepts zObject, Class zInstantiation, Constructors zEncapsulation zInheritance and Subclasses zAbstraction.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
CSCI 171 Presentation 15 Introduction to Object–Oriented Programming (OOP) in C++
COP 4331 – OOD&P Lecture 7 Object Concepts. What is an Object Programming language definition: An instance of a class Design perspective is different.
ISBN Chapter 12 Support for Object-Oriented Programming.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 3- Introduction to Object Oriented Programming concepts Topic 3.1 Fundamental Concepts.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Object-Oriented Design
Inheritance and Polymorphism
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Section 11.1 Class Variables and Methods
SNSCT_CSE_PROGRAMMING PARADIGM_CS206
Object-Oriented Programming
DEV-08: Exploring Object-oriented Programming
Object-Oriented Programming
Object-Oriented Programming
CSG2H3 Object Oriented Programming
Presentation transcript:

Eclipse – making OOP Easy

Object-Oriented Programming Revisited Key OOP Concepts Object, Class Instantiation, Constructors Encapsulation Inheritance and Subclasses Abstraction Reuse Polymorphism, Dynamic Binding Object-Oriented Design and Modeling

Object Definition: a thing that has identity, state, and behavior identity: a distinguished instance of a class state: collection of values for its variables behavior: capability to execute methods * variables and methods are defined in a class

Class Definition: a collection of data (fields/ variables) and methods that operate on that data define the contents/capabilities of the instances (objects) of the class a class can be viewed as a factory for objects a class defines a recipe for its objects

POJO and JavaBeans POJO Naming Conventions Stands for Plain Old Java Object Naming Conventions Class name - Start with a capital letter Private fields + getters and setters Fields start with small letter Camel case Singular form

POJO and JavaBeans JavaBean A POJO that follows the following criteria Has a blank constructor Has a get/set method for all private fields E.g. a field int count has a int getCount() setCount(int)

Instantiation Object creation Memory is allocated for the object’s fields as defined in the class Initialization is specified through a constructor a special method invoked when objects are created

Encapsulation A key OO concept: “Information Hiding” Key points The user of an object should have access only to those methods (or data) that are essential Unnecessary implementation details should be hidden from the user In Java/C++, use classes and access modifiers (public, private, protected)

Inheritance Inheritance: Subclass relationship programming language feature that allows for the implicit definition of variables/methods for a class through an existing class Subclass relationship B is a subclass of A B inherits all definitions (variables/methods) in A

Abstraction OOP is about abstraction Encapsulation and Inheritance are examples of abstraction What does the verb “abstract” mean?

Polymorphism “Many forms” Example: Dynamic binding: allow several definitions under a single method name Example: “move” means something for a person object but means something else for a car object Dynamic binding: capability of an implementation to distinguish between the different forms during run-time

Interfaces Essentially a “contract” stating a list of methods e.g. ActionListener -> require actionPerformed(ActionEvent e) Implementing an interface tells the world that you have the methods defined in the interface

Eclipse – refactoring tools

Eclipse Tools One of the main problem with OOP development is maintaining classes with there are changes Eclipse has several automated tools that greatly aid OOP development Source generation – Source Menu Refactor – Refactor Menu

Source tools Source tools can help add boilerplate code Generate getter/setter Delegate methods Override/implement methods Automatically creates stubs for interface/abstract methods Several Misc tools Surrounding with try-catch, loops, etc.

Refactor tools Refactor tools are used to do large scale code editing Things that would have normally been done using cut-and-paste Much more reliable, you can’t forget anything

Examples General OOP specific Renaming variables Extracting local variables or constants Inlining OOP specific Encapsulate field Extract interface/superclass Introducing “parameter objects” Moving methods around an inheritance hierarchy Moving inner classes

Some things to remember: Java for-each List<DataType> objects = new ArrayList<DataType>(); for(DataType o : objects ) { }

Packages package com.foo.datawarehouse; E.g. edu.admu.cs1192 Convention: com → commercial foo → company name datawarehouse → project name E.g. edu.admu.cs1192