Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.

Slides:



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

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Chapter 8 Inheritance Part 2. © 2004 Pearson Addison-Wesley. All rights reserved8-2 Outline Creating Subclasses Overriding Methods Class Hierarchies Inheritance.
Object-Oriented PHP (1)
Liang,Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 10 Object-Oriented Modeling.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Object Oriented System Development with VB .NET
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
IEG 3080 Tutorial 1 Wilson Ip. Outline Lecture reviews: Some basics of Software Engineering principle Some basics of OOP How to use Visual Studio.NET.
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
Programming Languages and Paradigms Object-Oriented Programming.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
Introduction to Object-oriented programming and software development Lecture 1.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
CS 350 – Software Design The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
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.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
CSC 211 Introduction to Design Patterns. Intro to the course Syllabus About the textbook – Read the introduction and Chapter 1 Good attendance is the.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Introduction to Java Programming with Forte Y. Daniel Liang.
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
C++ and Ubuntu Linux Review and Practice CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
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.
Object-Oriented Programming Chapter Chapter
M1G Introduction to Programming 2 5. Completing the program.
Object Oriented Programming
Final Review. From ArrayLists to Arrays The ArrayList : used to organize a list of objects –It is a class in the Java API –the ArrayList class uses an.
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Creating a Java Application and Applet
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Classes, Interfaces and Packages
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
OOP Basics Classes & Methods (c) IDMS/SQL News
ITP 109 Week 2 Trina Gregory Introduction to Java.
Chapter 3 Implementing Classes
6.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
Object-Oriented Design
Programming paradigms
Inheritance ITI1121 Nour El Kadri.
Objects First with Java A Practical Introduction using BlueJ
CSC 222: Object-Oriented Programming
Object-Orientated Programming
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Objects First with Java A Practical Introduction using BlueJ
The Object-Oriented Thought Process Chapter 05
Week 6 Object-Oriented Programming (2): Polymorphism
COS 260 DAY 2 Tony Gauvin.
Objects First with Java A Practical Introduction using BlueJ
Review CSE116 2/21/2019 B.Ramamurthy.
Objects First with Java A Practical Introduction using BlueJ
Introducing Java.
Object-Oriented PHP (1)
Presentation transcript:

Starting Chapter 4 Starting

1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming How it is implemented in Java. Why we use Java some strengths of the language. some history. How can I write and run Java Programmes. editor, SDK, compiler, java tools Java is a very simple language: course requirement is some familiarity with an OO language. Will review the grammar and syntax – a handful of slides – you should be able to get what you need from a suitable text book Concentrate on Java core libraries How to structure code solutions in Java Patterns and anti-Patterns Java collections and generics But not in detail Assume familiar with an OO language. Except for …. Not so trivial and worth giving you an introduction What they are an why you need to be familiar with them. Starting

2 Course Outcomes You will be able to write, compile and run a simple helloworld programme. You will have the intellectual tool kit to turn yourself into a first rate programmer. If you are already a first rate programmer. well 1 st rate programmers are always looking to improve their skills and develop their toolkits I hope I will introduce you to some new ideas, which you can use Starting

3 Java & OO* JAVA and OO: Objects are a software method of modelling an object in the problem domain. The object may be concrete and relate a real object car, person, book It may be abstract and relate to a construct in the solution domain. It will typically have a state : a description of the object, which may include the properties which distinguish the object from others of the same type It will have methods : these change state and/or perform operations and calculations. Methods are accessed by sending messages to the objects. Once created objects have an existence independent of the other objects in the programme. Objects are created by the programmer defining a class and instantiating objects of that class. Object State Methods Messages Class : Instantiation Starting

4 Classes Class: A class is a recipe or blueprint for an object A class may be used to create many objects An object is a coherent bundle of methods and data. It is the dynamic realisation of a class. Only exists while the programme is running An object is easy to think about and talk about Well designed classes are good for implementation good for design and communicating ideas The set of methods is called the interface A message is sent to the method to perform a sequence of operations ( normally on the data) How these operations are achieved is of interest only to the author. Irrelevant to the user – called encapsulation Eases use – no need to understand implementation Eases development – implementation can be altered as often as required with no impact on the user. Implementation is flexible, interface should be fixed Class Persistance Useful throughout the process Encapsulation core part of OO Other meanings Persistance Design to the Interfacce 3 Principles Starting

5 OO description 3 Principles Starting

6 … 3 Principles Starting

7 Object creation* Objects are created. Once created they have an independent existance. And the objects themselves may create further objects or groups of objects Instantiated from classes Starting

8 Object communication(i) They send messages to each other The messages may simply change the state of another class, or a response may be elicited. They may return data or output data. Starting

9 Java & OO(i)* JAVA and OO : Design A java object should exhibit high coherence and weak coupling. All the information about that “object” should reside in one place : coherence One object should be (as far as possible) completely independent of all others. Independence promotes development and reuse. Use the object in another context. Develop the object with no reference to users. Encapsulation ( data hiding) the internals of an object should not be visible to the outside world. Inheritance all the methods and state of an class can be used as the basis of a new class. Inheritance allows us to use an old class simply without disturbing the operation of the base class benefitting from improvements in the base class Need to make clear these concepts and we will start by using BlueJ Object isolation Encapsulation Inheritance Starting

10 BlueJ* JAVA and OO : Programme creation and execution A number of ways to create, develop and execute java code. Simple editor and the command line SDK – eclipse, netbeans, ….. BlueJ BlueJ a beginners development environment. Graphical representation of the programme. Environment is free to download Quite sophisticated development is possible Simple debugger Standalone running of the programmes which have been developed Easy migration to netbeans. Starting

11 Creating Objects* Classes and Objects A class may contain almost nothing. Javadoc may be used to create documentation To create an object a constructor method is used. Provided by the JVM if not present public class car() { } Constructor public car(){ } Add some state Always put a default constructor in explicitly. Minimum class JAVADOC – tool shipped as part of the SDK Starting

12 Documentation* Using JAVADOC Comments in a java file are //single line /* everything between */ Comments with special format are picked up by javadoc and put in a suitable place in the documentation. Javadoc comments are about the interface – the only thing the user of a class cares about. Comments internal to the code are ignored. Constructors return only a pointer to the object created. One primitive data type is double Let us add a method. double Starting

13 Outputting* output Can be done using System.out.println():puts out strings Lets look at creating a object inside another object When a object is created if you want to refer to it you need to create a pointer of a suitable type to refer to it. System.out.println() of an object actually prints out the string from toString(). For useful output we need to override the toString method. The ability to replace the method of a superclass with a method of the subclass is crucial to OO programming. Relevant to sub class without messing up superclass JVM takes care of turning doubles to strings Here it is the same type Overriding Starting