OBJECT ORIENTED PROGRAMMING

Size: px
Start display at page:

Download "OBJECT ORIENTED PROGRAMMING"

Transcription

1 OBJECT ORIENTED PROGRAMMING Course 1 Loredana STANCIU Associate Professor at Automation and Applied Informatics Department of Automation and Computer Science Faculty loredana.stanciu@upt.ro Room B616

2 About the course Every week: 3 hours of course Monday, 11:00-14:00 room A316 3 practical activities: Thursday 8:00-14:00, room B613

3 The examination Distributed evaluation several marks 2 written examinations (multiple choice written tests) you have the possibility to improve your marks at written tests the average of these two marks = 2/3 of the final mark 2 practical tests the mark from one practical test can be also improved the average of these two marks = 1/3 of the final mark

4 SCHEDULER W 1 W 2 W 3 W 4 W 5 W 6 W 7 W 8 W 9 W 1 0 W 1 1 W 1 2 W 1 3 W 1 4 C o u r s e C C C C C E1 P1 C E1 P2 C C C E2 P1 E2 P2 L a b L1 H W L2 CO L3 IOS L4 I&P L5 I L6 Ex L7 E L8 T1 L9 C L10 G L11 G L12 G L13 T2 R

5 A survey of programming techniques Unstructured programming

6 Unstructured programming Small and simple programs consisting only of one main program A sequence of commands or statements which modify data (global) throughout the whole program

7 Unstructured programming #include <stdio.h> #include <conio.h> void main(void){ int a; clrscr(); printf( a= ");scanf( %d,&a); printf( a= %d,a); }

8 Unstructured programming Disadvantage: large programs using the same statement sequences Idea Extract these sequences, name them and offer a technique to call and return from these procedures

9 A survey of programming techniques Unstructured programming Procedural programming

10 Procedural programming Combines returning sequences of statements into one single place A procedure call is used to invoke the procedure With parameters and subprocedures programs can now be written more structured and error free

11 Procedural programming #include <stdio.h> #include <conio.h> int add(int a, int b){ return a+b;} void main(void){ int a,b,c; clrscr(); printf( a= ");scanf( %d,&a); printf( b= ");scanf( %d,&b); c=add(a,b); printf( c= %d,c); }

12 Procedural programming A single program divided into small pieces called procedures Enable usage of general procedures or groups of procedures in other programs, they must be separately available

13 A survey of programming techniques Unstructured programming Procedural programming Modular programming

14 Modular programming Procedures of a common functionality are grouped together into separate modules A program is now divided into several smaller parts which interact through procedure calls and which form the whole program

15 Example handling single lists Programs use data structures to store data Characterized by their structure and their access methods To program a list in a modular programming language: the interface definition the implementation file

16 Example handling single lists /* * Interface definition for a module which implements * a singly linked list for storing data of any type. */ MODULE Singly-Linked-List-1 BOOL list_initialize(); BOOL list_append(any data); BOOL list_delete(); list_end(); ANY list_getfirst(); ANY list_getnext(); BOOL list_isempty(); END Singly-Linked-List-1 Hiding information

17 Example handling Multiple lists /* * A list module for more than one list. */ MODULE Singly-Linked-List-2 DECLARE TYPE list_handle_t; list_handle_t list_create(); list_destroy(list_handle_t this); BOOL list_append(list_handle_t this, ANY data); ANY list_getfirst(list_handle_t this); ANY list_getnext(list_handle_t this); BOOL list_isempty(list_handle_t this); END Singly-Linked-List-2; List objects

18 Modular programming problems 1) Explicit Creation and Destruction PROCEDURE exp() BEGIN list_handle_t mylist; int x; mylist <- list_create(); /* Do something with mylist */ x=3;... list_destroy(mylist); END

19 Modular programming problems 2) Decoupled Data and Operations A structure based on the operations rather than the data defined operations specify the data to be used In object-orientation, structure is organized by the data modules group data representations together

20 Modular programming problems 3) Missing Type Safety PROCEDURE exp() BEGIN SomeDataType data1; SomeOtherType data2; list_handle_t mylist; mylist <- list_create(); list_append(mylist, data1); list_append(mylist, data2); /* Oops */... list_destroy(mylist); END

21 Modular programming problems The compiler cannot guarantee for type safety a mechanism which allows to specify on which data type the list should be defined list_handle_t<apple> list1; /* a list of apples */ list_handle_t<car> list2; /* a list of cars */

22 Modular programming problems 4) Strategies and Representation A cursor is used to point to the current element a traversing strategy which defines the order in which the elements of the data structure are to be visited Separate the actual representation or shape of the data structure from its traversing strategy

23 A survey of programming techniques Unstructured programming Procedural programming Modular programming Object-oriented programming

24 Object Oriented Programming Solves some of the mentioned problems A web of interacting objects, each housekeeping its own state

25 Object Oriented Programming Each object implements its own module allowing for example many lists to coexist Each object is responsible to initialize and destroy itself correctly Some authors describe object-oriented programming as programming abstract data types and their relationships Real-life problems are nebulous and the first thing you have to do is to try to understand the problem

26 Object Oriented Programming HANDLING PROBLEMS Abstraction : It is an act of representing only the essential things without including background details Focuses on what not how Similar with a table of content Necessary for managing large, complex software projects

27 Object Oriented Programming HANDLING PROBLEMS Define properties of the problem: the data which are affected and the operations which are identified An example: the administration of employees in an institution: name, date of birth, shape, social number, room number, hair color, hobbies problem specific properties the abstract employees data operations

28 Object Oriented Programming

29 Object Oriented Programming PROPERTIES OF ABSTRACT DATA TYPES With abstraction one can create a well-defined entity: Define the data structure of a set of items The data structure can only be accessed with defined operations interface exported by the entity abstract data type (ADT)

30 Object Oriented Programming PROPERTIES OF ABSTRACT DATA TYPES 1) It exports a type 2) It exports a set of operations. This set is called interface 3) Operations of the interface are the one and only access mechanism to the type's data structure 4) Axioms and preconditions define the application domain of the type

31 Object Oriented Programming IMPORTANCE OF DATA STRUCTURE ENCAPSULATION Encapsulation: The principle of hiding the used data structure and to only provide a well-defined interface The separation of data structures and operations and the constraint to only access the data structure via a well-defined interface allows you to choose data structures appropriate for the application environment Encapsulation: Wrapping up of data and methods into a single unit Information Hiding: It is a concept that can be use for hiding data from external world. And that can be achieved using Encapsulation and Abstraction.

32 Object Oriented Programming EXAMPLE OF DATA STRUCTURE ENCAPSULATION Define an ADT for complex numbers Structure (real part and imaginary part) Operations (addition, subtraction, multiplication or division) Two ways of representing: An array: x=c[0], y=c[1] Two-valued record: x=c.x, y=c.y

33 Object Oriented Programming IMPLEMENTATION OF ABSTRACT DATA TYPES A class: an actual representation of an Abstract Data Type provides implementation details for the data structure used and operations class Integer { attributes: int i methods: setvalue(int n) Integer addvalue(integer j) } Definition (Class) A class is the implementation of an abstract data type (ADT). It defines attributes and methods which implement the data structure and operations of the ADT, respectively.

34 Object Oriented Programming An object: uniquely identifiable by a name the set of values at a particular time is the state of the object Definition (Object) An object is an instance of a class. It can be uniquely identified by its name and it defines a state which is represented by the values of its attributes at a particular time Definition (Behaviour) The behaviour of an object is defined by the set of methods which can be applied on it.

35 Object Oriented Programming

36 Object Oriented Programming A running program is a pool of objects where objects are created, destroyed and interacting through messages Integer i; /* Define a new integer object */ i.setvalue(1); /* Set its value to 1 */ Definition (Message) A message is a request to an object to invoke one of its methods. A message therefore contains: the name of the method and the arguments of the method. Definition (Method) A method is associated with a class. An object invokes a method as a reaction to receipt of a message.

37 Object Oriented Programming A program with interacting objects

38 Object Oriented Programming Problem: how a character appears on the screen when you type a key Procedural programming 1. wait, until a key is pressed. 2. get key value 3. write key value at current cursor position 4. advance cursor position Object oriented programming 1) the key receive a message to change its state to be pressed 2) its corresponding object sends a message to the screen object. 3) the screen object receive the message to display the associated key value

39 Object Oriented Programming Write a drawing program Various objects such as points, circles, rectangles, triangles and many more class Point { attributes: int x, y methods: setx(int newx) getx() sety(int newy) gety() } class Circle { attributes: int x, y, radius methods: setx(int newx) getx() sety(int newy) gety() setradius(int newy) getradius() }

40 Object Oriented Programming Relationships Between two similar classes A-Kind-Of relationship Between objects of classes in A-Kind-Of relationship Is-A relationship

41 Object Oriented Programming Build objects by combining them out of others class Logo { attributes: Circle circle Triangle triangle methods: set(point where) } Relationships: Part-Of relationship

42 Object Oriented Programming Inheritance able to make use of the a-kind-of and is-a relationship when the classes share properties class Circle inherits from Point { } attributes: int radius methods: setradius(int newradius) getradius() Circle acircle acircle.setx(1) /* Inherited from Point */ acircle.sety(2) acircle.setradius(3) /* Added by Circle */

43 Object Oriented Programming Definition (Inheritance) Inheritance is the mechanism which allows a class A to inherit properties of a class B. We say A inherits from B. Objects of class A thus have access to attributes and methods of class B without the need to redefine them. Definition (Superclass/Subclass) If class A inherits from class B, then B is called superclass of A. A is called subclass of B Superclasses are also called parent classes Subclasses may also be called child classes or just derived classes

44 Object Oriented Programming Static Binding In strongly typed programming languages you have to declare variables prior to their use int x, y float z x= a /* type mismatch Definition (Static Binding) If the type T of a variable is explicitly associated with its name N by declaration, we say, that N is statically bound to T. The association process is called static binding.

45 Object Oriented Programming Dynamic Binding Some languages allow to introduce variables once they are needed Definition (Dynamic Binding) If the type T of a variable with name N is implicitly associated by its content, we say, that N is dynamically bound to T. The association process is called dynamic binding

46 Object Oriented Programming Packaging Collections of classes and interfaces that are related to each other in some useful way Benefits: The ability to organize many class definitions into a single unit. The "friendly" instance variables and methods are available to all classes within the same package, but not to classes defined outside the package

47 Summary A fundamental principle in object oriented programming to view a program as a collection of interacting objects Objects in a collection: react upon receipt of messages, change their state according to invocation of methods which might cause other messages sent to other objects

48 What is java? Late 1980s C++ was widely used to write OOP: not a platform independent needed to be recompiled for each different CPUs 1991 a team of Sun Microsystems makes a platform independent software and named it Oak 1995 Java

49 What is java? Java influenced by C, C++, Smalltalk slogan named Write Once Run Anywhere it can develop and run on any device equipped with Java Virtual Machine (JVM). applicable in all kinds of operating systems associated with the World Wide Web a platform independent programming language can be found in a variety of devices like cell phones, e-commerce application, PCs and almost all network or computing devices

50 Why Java? 97% of Enterprise Desktops Run Java 89% of Desktops (or Computers) in the U.S. Run Java 9 Million Java Developers Worldwide #1 Choice for Developers #1 Development Platform 3 Billion Mobile Phones Run Java

51 Why Java? 100% of Blu-ray Disc Players Ship with Java 5 Billion Java Cards in Use 125 million TV devices run Java 5 of the Top 5 Original Equipment Manufacturers Ship Java ME

52 Why developers choose Java? Write software on one platform and run it on virtually any other platform Create programs that can run within a web browser and access available web services Develop server-side applications for online forums, stores, polls, HTML forms processing, and more

53 Why developers choose Java? Combine applications or services using the Java language to create highly customized applications or services Write powerful and efficient applications for mobile phones, remote processors, microcontrollers, wireless modules, sensors, gateways, consumer products, and practically any other electronic device

54 The java language All source code written in plain text files ending with the.java extension. Source files compiled into.class files by the javac compiler..class file contains bytecodes the machine language of the Java Virtual Machine. java launcher tool then runs your application with an instance of the Java Virtual Machine.

55 The java language Java VM available on many different operating systems, the same.class files are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS), Linux, or Mac OS

56 The java language

57 The java platform A platform the hardware or software environment in which a program runs. Java a software-only platform that runs on top of other hardware-based platforms: The Java Virtual Machine The Java Application Programming Interface (API) a large collection of ready-made software components that provide many useful capabilities grouped in packages

58 Java characteristics Simple, Object Oriented, and Familiar: Simple language, easy to learn Provides a clean and efficient object-based development platform Keeping the Java programming language looking like C++ as far as possible results in it being a familiar language

59 Java characteristics Robust and Secure Designed for creating highly reliable software The memory management model is extremely simple: objects are created with a new operator The system will find many errors quickly Security features designed into the language and runtime system Java technology constructs applications that can't be invaded from outside

60 Java characteristics Architecture Neutral and Portable The Java Compiler TM product generates bytecodes--an architecture neutral intermediate format designed to transport code efficiently to multiple hardware and software platforms Programs are the same on every platform. There are no data type incompatibilities across hardware and software architectures

61 Java characteristics High Performance The interpreter can run at full speed without needing to check the run-time environment The automatic garbage collector runs as a low-priority background thread

62 Java characteristics Interpreted, Threaded, and Dynamic The Java interpreter can execute Java bytecodes directly on any machine to which the interpreter and runtime system have been ported Java technology's multithreading capability provides the means to build applications with many concurrent threads of activity (results in a high degree of interactivity for the end user) The language and run-time system are dynamic in their linking stages

63 References Peter Muller, Introduction to Object-Oriented Programming Using C++, Chapters 1, 2, 3 and 4, ml The Java Tutorials. Getting Started. /index.html

Advanced Object-Oriented Programming Introduction to OOP and Java

Advanced Object-Oriented Programming Introduction to OOP and Java Advanced Object-Oriented Programming Introduction to OOP and Java Dr. Kulwadee Somboonviwat International College, KMITL kskulwad@kmitl.ac.th Course Objectives Solidify object-oriented programming skills

More information

Special Topics: Programming Languages

Special Topics: Programming Languages Lecture #23 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 23 Lecture #23 1 Slide 1 Java: History Spring 1990 April 1991: Naughton, Gosling and Sheridan (

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

Lecture 1. Abstraction

Lecture 1. Abstraction Lecture 1 Abstraction 1 Programming Techniques Unstructured Programming Procedural Programming Modular & Structural Programming Abstract Data Type Object-Oriented Programming 2 Unstructured Programming

More information

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini

1. Introduction. Java. Fall 2009 Instructor: Dr. Masoud Yaghini 1. Introduction Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline Introduction Introduction The Java Programming Language The Java Platform References Java technology Java is A high-level programming

More information

CS260 Intro to Java & Android 02.Java Technology

CS260 Intro to Java & Android 02.Java Technology CS260 Intro to Java & Android 02.Java Technology CS260 - Intro to Java & Android 1 Getting Started: http://docs.oracle.com/javase/tutorial/getstarted/index.html Java Technology is: (a) a programming language

More information

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc. Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE

CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE CS 6456 OBJCET ORIENTED PROGRAMMING IV SEMESTER/EEE PART A UNIT I 1. Differentiate object oriented programming from procedure oriented programming. 2. Define abstraction and encapsulation. 3. Differentiate

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn Introduction to Java Programming CPIT 202 WEWwwbvxnvbxmnhsgfkdjfcn b 1 WEEK 1 LECTURE 1 What is Java? 2 Background on Java First appear in 1995 Developed by Sun Microsystems Corp. Cross platform = platform

More information

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed CREATED BY: Muhammad Bilal Arslan Ahmad Shaad JAVA Chapter No 5 Instructor: Muhammad Naveed Muhammad Bilal Arslan Ahmad Shaad Chapter No 5 Object Oriented Programming Q: Explain subclass and inheritance?

More information

Introduction to Java

Introduction to Java Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn

More information

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2)

Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Software Paradigms (Lesson 3) Object-Oriented Paradigm (2) Table of Contents 1 Reusing Classes... 2 1.1 Composition... 2 1.2 Inheritance... 4 1.2.1 Extending Classes... 5 1.2.2 Method Overriding... 7 1.2.3

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract

More information

History Introduction to Java Characteristics of Java Data types

History Introduction to Java Characteristics of Java Data types Course Name: Advanced Java Lecture 1 Topics to be covered History Introduction to Java Characteristics of Java Data types What is Java? An Object-Oriented Programming Language developed at Sun Microsystems

More information

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview

Introduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple

More information

Objectives. INHERITANCE - Part 1. Using inheritance to promote software reusability. OOP Major Capabilities. When using Inheritance?

Objectives. INHERITANCE - Part 1. Using inheritance to promote software reusability. OOP Major Capabilities. When using Inheritance? INHERITANCE - Part 1 OOP Major Capabilities Introduction Basic Concepts and Syntax Protected Members Constructors and Destructors Under Inheritance Multiple Inheritance Common Programming Errors encapsulation

More information

Compaq Interview Questions And Answers

Compaq Interview Questions And Answers Part A: Q1. What are the difference between java and C++? Java adopts byte code whereas C++ does not C++ supports destructor whereas java does not support. Multiple inheritance possible in C++ but not

More information

Introduction to Java. Nihar Ranjan Roy. https://sites.google.com/site/niharranjanroy/

Introduction to Java. Nihar Ranjan Roy. https://sites.google.com/site/niharranjanroy/ Introduction to Java https://sites.google.com/site/niharranjanroy/ 1 The Java Programming Language According to sun Microsystems java is a 1. Simple 2. Object Oriented 3. Distributed 4. Multithreaded 5.

More information

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway

CT 229. CT229 Lecture Notes. Labs. Tutorials. Lecture Notes. Programming II CT229. Objectives for CT229. IT Department NUI Galway Lecture Notes CT 229 Programming II Lecture notes, Sample Programs, Lab Assignments and Tutorials will be available for download at: http://www.nuigalway.ie/staff/ted_scully/ct229/ Lecturer: Dr Ted Scully

More information

INHERITANCE - Part 1. CSC 330 OO Software Design 1

INHERITANCE - Part 1. CSC 330 OO Software Design 1 INHERITANCE - Part 1 Introduction Basic Concepts and Syntax Protected Members Constructors and Destructors Under Inheritance Multiple Inheritance Common Programming Errors CSC 330 OO Software Design 1

More information

Inheritance Motivation

Inheritance Motivation Inheritance Inheritance Motivation Inheritance in Java is achieved through extending classes Inheritance enables: Code re-use Grouping similar code Flexibility to customize Inheritance Concepts Many real-life

More information

Week 7. Statically-typed OO languages: C++ Closer look at subtyping

Week 7. Statically-typed OO languages: C++ Closer look at subtyping C++ & Subtyping Week 7 Statically-typed OO languages: C++ Closer look at subtyping Why talk about C++? C++ is an OO extension of C Efficiency and flexibility from C OO program organization from Simula

More information

Atelier Java - J1. Marwan Burelle. EPITA Première Année Cycle Ingénieur.

Atelier Java - J1. Marwan Burelle.  EPITA Première Année Cycle Ingénieur. marwan.burelle@lse.epita.fr http://wiki-prog.kh405.net Plan 1 2 Plan 3 4 Plan 1 2 3 4 A Bit of History JAVA was created in 1991 by James Gosling of SUN. The first public implementation (v1.0) in 1995.

More information

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci) Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci) Sung Hee Park Department of Mathematics and Computer Science Virginia State University September 18, 2012 The Object-Oriented Paradigm

More information

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions

Index. Course Outline. Grading Policy. Lab Time Distribution. Important Instructions Index Course Outline Grading Policy Lab Time Distribution Important Instructions 2 Course Outline Week Topics 1 - History and Evolution of Java - Overview of Java 2 - Datatypes - Variables 3 - Arrays 4

More information

From High Level to Machine Code. Compilation Overview. Computer Programs

From High Level to Machine Code. Compilation Overview. Computer Programs From High Level to Algorithm/Model Java, C++, VB Compilation Execution Cycle Hardware 27 October 2007 Ariel Shamir 1 Compilation Overview Algorithm vs. Programs From Algorithm to Compilers vs. Interpreters

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 21, 2013 Abstract

More information

Introduction to Java and OOP. Hendrik Speleers

Introduction to Java and OOP. Hendrik Speleers Introduction to Java and OOP Hendrik Speleers Introduction to Java Additional course material Thinking in JAVA (4th edition) by Bruce Eckel Free download of older editions: http://mindview.net/books/tij4

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 2: Review of Object Orientation

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 2: Review of Object Orientation Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 2: Review of Object Orientation 2.1 What is Object Orientation? Procedural paradigm: Software is organized

More information

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1

Object-Oriented Languages and Object-Oriented Design. Ghezzi&Jazayeri: OO Languages 1 Object-Oriented Languages and Object-Oriented Design Ghezzi&Jazayeri: OO Languages 1 What is an OO language? In Ada and Modula 2 one can define objects encapsulate a data structure and relevant operations

More information

An Introduction to Object Orientation

An Introduction to Object Orientation An Introduction to Object Orientation Rushikesh K Joshi Indian Institute of Technology Bombay rkj@cse.iitb.ac.in A talk given at Islampur Abstractions in Programming Control Abstractions Functions, function

More information

II. Compiling and launching from Command-Line, IDE A simple JAVA program

II. Compiling and launching from Command-Line, IDE A simple JAVA program Contents Topic 01 - Java Fundamentals I. Introducing JAVA II. Compiling and launching from Command-Line, IDE A simple JAVA program III. How does JAVA work IV. Review - Programming Style, Documentation,

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING 1. Programming Paradigms OBJECT ORIENTED PROGRAMMING A programming methodology defines the methodology of designing and implementing programs using the key features and other building blocks (such as key

More information

INHERITANCE - Part 1. CSC 330 OO Software Design 1

INHERITANCE - Part 1. CSC 330 OO Software Design 1 INHERITANCE - Part 1 Introduction Basic Concepts and Syntax Protected Members Constructors and Destructors Under Inheritance Multiple Inheritance Common Programming Errors CSC 330 OO Software Design 1

More information

Object-Oriented Programming Concepts

Object-Oriented Programming Concepts Object-Oriented Programming Concepts Real world objects include things like your car, TV etc. These objects share two characteristics: they all have state and they all have behavior. Software objects are

More information

Abstract Data Types (ADT) and C++ Classes

Abstract Data Types (ADT) and C++ Classes Abstract Data Types (ADT) and C++ Classes 1-15-2013 Abstract Data Types (ADT) & UML C++ Class definition & implementation constructors, accessors & modifiers overloading operators friend functions HW#1

More information

Introduction to Object-Oriented Programming

Introduction to Object-Oriented Programming Introduction to Object-Oriented Programming Objects and classes Abstract Data Types (ADT). Encapsulation OOP: Introduction 1 Pure Object-Oriented Languages Five rules [Source: Alan Kay]: Everything in

More information

CSE 421 Course Overview and Introduction to Java

CSE 421 Course Overview and Introduction to Java CSE 421 Course Overview and Introduction to Java Computer Science and Engineering College of Engineering The Ohio State University Lecture 1 Learning Objectives Knowledgeable in how sound software engineering

More information

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017

Inheritance. OOP components. Another Example. Is a Vs Has a. Virtual Destructor rule. Virtual Functions 4/13/2017 OOP components For : COP 3330. Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Data Abstraction Information Hiding, ADTs Encapsulation Type Extensibility Operator Overloading

More information

Notes of the course - Advanced Programming. Barbara Russo

Notes of the course - Advanced Programming. Barbara Russo Notes of the course - Advanced Programming Barbara Russo a.y. 2014-2015 Contents 1 Lecture 2 Lecture 2 - Compilation, Interpreting, and debugging........ 2 1.1 Compiling and interpreting...................

More information

Lecture 1: Introduction to Java

Lecture 1: Introduction to Java Lecture 1: Introduction to Java 1 Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty

More information

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1

CS250 Intro to CS II. Spring CS250 - Intro to CS II 1 CS250 Intro to CS II Spring 2017 CS250 - Intro to CS II 1 Topics Virtual Functions Pure Virtual Functions Abstract Classes Concrete Classes Binding Time, Static Binding, Dynamic Binding Overriding vs Redefining

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Subclasses, Superclasses, and Inheritance

Subclasses, Superclasses, and Inheritance Subclasses, Superclasses, and Inheritance To recap what you've seen before, classes can be derived from other classes. The derived class (the class that is derived from another class) is called a subclass.

More information

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017 Introduction to Java Lecture 1 COP 3252 Summer 2017 May 16, 2017 The Java Language Java is a programming language that evolved from C++ Both are object-oriented They both have much of the same syntax Began

More information

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation

Object-Oriented Software Engineering. Chapter 2: Review of Object Orientation Object-Oriented Software Engineering Chapter 2: Review of Object Orientation 2.1 What is Object Orientation? Procedural paradigm: Software is organized around the notion of procedures Procedural abstraction

More information

PROGRAMMING IN C++ COURSE CONTENT

PROGRAMMING IN C++ COURSE CONTENT PROGRAMMING IN C++ 1 COURSE CONTENT UNIT I PRINCIPLES OF OBJECT ORIENTED PROGRAMMING 2 1.1 Procedure oriented Programming 1.2 Object oriented programming paradigm 1.3 Basic concepts of Object Oriented

More information

Object Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani

Object Oriented Programming. C++ 6 th Sem, A Div Ms. Mouna M. Naravani Object Oriented Programming C++ 6 th Sem, A Div 2018-19 Ms. Mouna M. Naravani Object Oriented Programming (OOP) removes some of the flaws encountered in POP. In OOPs, the primary focus is on data rather

More information

Lecture 1: Overview of Java

Lecture 1: Overview of Java Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread

More information

Chapter 4: Threads. Operating System Concepts 9 th Edit9on

Chapter 4: Threads. Operating System Concepts 9 th Edit9on Chapter 4: Threads Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 4: Threads 1. Overview 2. Multicore Programming 3. Multithreading Models 4. Thread Libraries 5. Implicit

More information

Java Overview An introduction to the Java Programming Language

Java Overview An introduction to the Java Programming Language Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/

More information

VALLIAMMAI ENGINEERING COLLEGE

VALLIAMMAI ENGINEERING COLLEGE VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK B.E. - Electrical and Electronics Engineering IV SEMESTER CS6456 - OBJECT ORIENTED

More information

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا

Tutorial 1 CSC 201. Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا Tutorial 1 CSC 201 Java Programming Concepts عؾادئماظربجمةمبادؿكدامماجلاصا م- م- م- م- م- Chapter 1 1. What is Java? 2. Why Learn Java? a. Java Is Platform Independent b. Java is Easy to learn 3. Programming

More information

Answer1. Features of Java

Answer1. Features of Java Govt Engineering College Ajmer, Rajasthan Mid Term I (2017-18) Subject: PJ Class: 6 th Sem(IT) M.M:10 Time: 1 hr Q1) Explain the features of java and how java is different from C++. [2] Q2) Explain operators

More information

Certified Core Java Developer VS-1036

Certified Core Java Developer VS-1036 VS-1036 1. LANGUAGE FUNDAMENTALS The Java language's programming paradigm is implementation and improvement of Object Oriented Programming (OOP) concepts. The Java language has its own rules, syntax, structure

More information

An Introduction to Software Engineering. David Greenstein Monta Vista High School

An Introduction to Software Engineering. David Greenstein Monta Vista High School An Introduction to Software Engineering David Greenstein Monta Vista High School Software Today Software Development Pre-1970 s - Emphasis on efficiency Compact, fast algorithms on machines with limited

More information

StackVsHeap SPL/2010 SPL/20

StackVsHeap SPL/2010 SPL/20 StackVsHeap Objectives Memory management central shared resource in multiprocessing RTE memory models that are used in Java and C++ services for Java/C++ programmer from RTE (JVM / OS). Perspectives of

More information

Chapter 1: Introduction to Computers and Java

Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java Chapter 1: Introduction to Computers and Java Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 1 discusses the following main topics:

More information

Chapter 1 Introduction to Java

Chapter 1 Introduction to Java Chapter 1 Introduction to Java 1 Why Java? The answer is that Java enables users to develop and deploy applications on the Internet for servers, desktop computers, and small hand-held devices. The future

More information

COS226 - Spring 2018 Class Meeting # 13 March 26, 2018 Inheritance & Polymorphism

COS226 - Spring 2018 Class Meeting # 13 March 26, 2018 Inheritance & Polymorphism COS226 - Spring 2018 Class Meeting # 13 March 26, 2018 Inheritance & Polymorphism Ibrahim Albluwi Composition A GuitarString has a RingBuffer. A MarkovModel has a Symbol Table. A Symbol Table has a Binary

More information

Programming, numerics and optimization

Programming, numerics and optimization Programming, numerics and optimization Lecture A-4: Object-oriented programming Łukasz Jankowski ljank@ippt.pan.pl Institute of Fundamental Technological Research Room 4.32, Phone +22.8261281 ext. 428

More information

Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257

Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 Introduction Unit 1: Java Everywhere Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 1. Java background 2.

More information

Chapter 1 Introduction to Computers, Programs, and Java

Chapter 1 Introduction to Computers, Programs, and Java Chapter 1 Introduction to Computers, Programs, and Java 1 Objectives To understand computer basics, programs, and operating systems ( 1.2 1.4). To describe the relationship between Java and the World Wide

More information

The Java Programming Language

The Java Programming Language The Java Programming Language Slide by John Mitchell (http://www.stanford.edu/class/cs242/slides/) Outline Language Overview History and design goals Classes and Inheritance Object features Encapsulation

More information

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED

엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED 엄현상 (Eom, Hyeonsang) School of Computer Science and Engineering Seoul National University COPYRIGHTS 2017 EOM, HYEONSANG ALL RIGHTS RESERVED Outline - Questionnaire Results - Java Overview - Java Examples

More information

Chapter 4 Java Language Fundamentals

Chapter 4 Java Language Fundamentals Chapter 4 Java Language Fundamentals Develop code that declares classes, interfaces, and enums, and includes the appropriate use of package and import statements Explain the effect of modifiers Given an

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages CSE 307: Principles of Programming Languages Classes and Inheritance R. Sekar 1 / 52 Topics 1. OOP Introduction 2. Type & Subtype 3. Inheritance 4. Overloading and Overriding 2 / 52 Section 1 OOP Introduction

More information

Get Unique study materials from

Get Unique study materials from Downloaded from www.rejinpaul.com VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : IV Section : EEE - 1 & 2 Subject Code

More information

Making New instances of Classes

Making New instances of Classes Making New instances of Classes NOTE: revised from previous version of Lecture04 New Operator Classes are user defined datatypes in OOP languages How do we make instances of these new datatypes? Using

More information

Mobile Computing LECTURE # 2

Mobile Computing LECTURE # 2 Mobile Computing LECTURE # 2 The Course Course Code: IT-4545 Course Title: Mobile Computing Instructor: JAWAD AHMAD Email Address: jawadahmad@uoslahore.edu.pk Web Address: http://csandituoslahore.weebly.com/mc.html

More information

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved.

Introduction to OOP Using Java Pearson Education, Inc. All rights reserved. 1 1 Introduction to OOP Using Java 2 Introduction Sun s implementation called the Java Development Kit (JDK) Object-Oriented Programming Java is language of choice for networked applications Java Enterprise

More information

A Report on RMI and RPC Submitted by Sudharshan Reddy B

A Report on RMI and RPC Submitted by Sudharshan Reddy B A Report on RMI and RPC Submitted by Sudharshan Reddy B Abstract: This report mainly explains the RMI and RPC technologies. In the first part of the paper the RMI technology is briefly explained and in

More information

Seminar report Java Submitted in partial fulfillment of the requirement for the award of degree Of CSE

Seminar report Java Submitted in partial fulfillment of the requirement for the award of degree Of CSE A Seminar report On Java Submitted in partial fulfillment of the requirement for the award of degree Of CSE SUBMITTED TO: www.studymafia.org SUBMITTED BY: www.studymafia.org 1 Acknowledgement I would like

More information

2 rd class Department of Programming. OOP with Java Programming

2 rd class Department of Programming. OOP with Java Programming 1. Structured Programming and Object-Oriented Programming During the 1970s and into the 80s, the primary software engineering methodology was structured programming. The structured programming approach

More information

Binding and Variables

Binding and Variables Binding and Variables 1. DEFINITIONS... 2 2. VARIABLES... 3 3. TYPE... 4 4. SCOPE... 4 5. REFERENCES... 7 6. ROUTINES... 9 7. ALIASING AND OVERLOADING... 10 8. GENERICS AND TEMPLATES... 12 A. Bellaachia

More information

Grade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline

Grade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline Grade Weights Language Design and Overview of COOL CS143 Lecture 2 Project 0% I, II 10% each III, IV 1% each Midterm 1% Final 2% Written Assignments 10% 2.% each Prof. Aiken CS 143 Lecture 2 1 Prof. Aiken

More information

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1 Design Principles Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques 2-1 Data Structures Data Structure - A systematic way of organizing and accessing

More information

STRUCTURING OF PROGRAM

STRUCTURING OF PROGRAM Unit III MULTIPLE CHOICE QUESTIONS 1. Which of the following is the functionality of Data Abstraction? (a) Reduce Complexity (c) Parallelism Unit III 3.1 (b) Binds together code and data (d) None of the

More information

Introduction to Computers and Java

Introduction to Computers and Java Introduction to Computers and Java Chapter 1 Chapter 1 1 Objectives overview computer hardware and software introduce program design and object-oriented programming overview the Java programming language

More information

Distributed Systems Principles and Paradigms

Distributed Systems Principles and Paradigms Distributed Systems Principles and Paradigms Chapter 03 (version February 11, 2008) Maarten van Steen Vrije Universiteit Amsterdam, Faculty of Science Dept. Mathematics and Computer Science Room R4.20.

More information

1. Write two major differences between Object-oriented programming and procedural programming?

1. Write two major differences between Object-oriented programming and procedural programming? 1. Write two major differences between Object-oriented programming and procedural programming? A procedural program is written as a list of instructions, telling the computer, step-by-step, what to do:

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

More information

Inheritance & Polymorphism Recap. Inheritance & Polymorphism 1

Inheritance & Polymorphism Recap. Inheritance & Polymorphism 1 Inheritance & Polymorphism Recap Inheritance & Polymorphism 1 Introduction! Besides composition, another form of reuse is inheritance.! With inheritance, an object can inherit behavior from another object,

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

index.pdf January 21,

index.pdf January 21, index.pdf January 21, 2013 1 ITI 1121. Introduction to Computing II Circle Let s complete the implementation of the class Circle. Marcel Turcotte School of Electrical Engineering and Computer Science Version

More information

Core Java Syllabus. Overview

Core Java Syllabus. Overview Core Java Syllabus Overview Java programming language was originally developed by Sun Microsystems which was initiated by James Gosling and released in 1995 as core component of Sun Microsystems' Java

More information

OBJECT ORİENTATİON ENCAPSULATİON

OBJECT ORİENTATİON ENCAPSULATİON OBJECT ORİENTATİON Software development can be seen as a modeling activity. The first step in the software development is the modeling of the problem we are trying to solve and building the conceptual

More information

Inheritance and Polymorphism

Inheritance and Polymorphism Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg

More information

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people

The Computer System. Hardware = Physical Computer. Software = Computer Programs. People = End Users & Programmers. people The Computer System Hardware = Physical Computer The equipment associated with a computer system. hardware software people The set of instructions that tell a computer what to do. Use the power of the

More information

Inheritance (Deitel chapter 9)

Inheritance (Deitel chapter 9) Inheritance (Deitel chapter 9) 1 2 Plan Introduction Superclasses and Subclasses protected Members Constructors and Finalizers in Subclasses Software Engineering with Inheritance 3 Introduction Inheritance

More information

Structured Programming

Structured Programming CS 170 Java Programming 1 Objects and Variables A Little More History, Variables and Assignment, Objects, Classes, and Methods Structured Programming Ideas about how programs should be organized Functionally

More information

CS 11 java track: lecture 1

CS 11 java track: lecture 1 CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml

More information

Functions in C C Programming and Software Tools

Functions in C C Programming and Software Tools Functions in C C Programming and Software Tools N.C. State Department of Computer Science Functions in C Functions are also called subroutines or procedures One part of a program calls (or invokes the

More information

COSC252: Programming Languages: Abstraction and OOP. Jeremy Bolton, PhD Asst Teaching Professor. Copyright 2015 Pearson. All rights reserved.

COSC252: Programming Languages: Abstraction and OOP. Jeremy Bolton, PhD Asst Teaching Professor. Copyright 2015 Pearson. All rights reserved. COSC252: Programming Languages: Abstraction and OOP Jeremy Bolton, PhD Asst Teaching Professor Copyright 2015 Pearson. All rights reserved. Copyright 2015 Pearson. All rights reserved. Topics The Concept

More information

JAVA: A Primer. By: Amrita Rajagopal

JAVA: A Primer. By: Amrita Rajagopal JAVA: A Primer By: Amrita Rajagopal 1 Some facts about JAVA JAVA is an Object Oriented Programming language (OOP) Everything in Java is an object application-- a Java program that executes independently

More information