6 Reusability in Object Oriented programming æ There is a lot of redundancy in ëclassical" programs. The same algorithm is re-coded many times with very little changes. æ Common examples : sorting and searching algorithms, classical data structures such as linked lists and binary trees. æ The main objective of object oriented programming is to reuse existing code as much as possible. æ Consequence : the coding of algorithms must be as general ègeneric, parametrizedè as possible.

7 Inheritance in Java æ A class is deæned by extending a previously deæned class. æ The new class reuses the members èi.e., æelds, methodsè of the previously existing class. æ The new class may customize èi.e., modify, extend, specialize,... è the behaviour of the old one. æ The members of the old class can be redeæned èi.e., hidden, overriddenè in the new one.

8 Class types in Java æ A class type is the name of a class. æ The class hierarchy deænes an ordering on the types èspecializationè. æ A variable of type T may contain a reference to an instance of any class T' that is more specialized than T. You may write, for instance : T x = new T'èè; T y = x; T' z = new T'èè; T w = z; æ Hence, a very general type is similar to a parametric type.

9 Polymorphism in Java æ Parametric polymorphism You can write a method mèt 1 x 1,..., Tn xnè with very general parameter types T 1,..., Tn. The method can be applied to actual values of any types T' 1,..., T'n that are more specialized èor equal toè T 1,..., Tn. æ Dynamic dispatch Every time you extend a class, you can redeæne any method of it to specialize, extend, reæne,... its behaviour. The suitable version of the method will be determined at run type depending on the actual type of the object. For instance, class Af int mèèf return 1 ;gg class B extends Af int mèèf return 2 ;gg... A x ;...x = new Bèè ;...x.mèè; The last statement returns the value 2.

10 To ensure a clean separation between the speciæcation èof the interfaceè of a class and its implementation, access to the members of a class can be restricted. There are four accessibility levels : æ private Accessible to code of the class only. Pure implementation notion. æ package èdefaultè Accessible to the package of the class. A service available in the package of the class only. æ protected Accessible in the package of the class but also to other classes that extends this èpublicè class provided that this member is needed to complete the implementation. æ public Accessible everywhere. A public service provided by the class. A member cannot be redeæned with a lower accessibility level.

11 Abstract methods and abstract classes æ Abstract classes are classes whose implementation is incomplete. One cannot create instances of an abstract class. Abstract classes ènormallyè contains at least one abstract method. æ Abstract methods are methods whose implementation is not provided. Only the types of the result and parameters are provided èto allow type-checkingè. The actual implementation will be æxed later in the actual èconcreteè classes extending the abstract class. Abstract methods can be used by normal methods. However those methods will only be applied to instances of concrete classes. Thus the abstract methods will be replaced by their implementation in the concrete class thanks to dynamic dispatch.

13 Generic classes æ Intuitively, a generic class is a class that is parametrized on one èmaybe severalè typeèsè T associated with a number of operations op 1,..., op n. æ A generic class can be instantiated to an actual class by specifying an actual type T and actual operations. æ Generic classes are not provided in Java. æ Generic classes can be simulated in Java thanks to other mechanisms èi.e., inheritance, abstract methods, dynamic dispatchè. æ In the second lecture, we explain how this can be done.

Chapter 1 Object Oriented System Development with Objectives In this chapter, you will: Learn about OO development and Understand object-oriented concepts Recognize the benefits of OO development Preview

2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

Sun Educational Services Instructor-Led Course Description Fundamentals of Java SL-110 The Fundamentals of the Java course provides students, with little or no programming experience, with the basics of

CSE 303 Concepts and Tools for Software Development Magdalena Balazinska Winter 2010 Lecture 19 Inheritance (virtual functions and abstract classes) Where We Are We have already covered the introduction

The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose

The Search Problem 1 Suppose we have a collection of records, say R 1, R 2,, R N, each of which contains a unique key value, say k i. Given a particular key value, K, the search problem is to locate the

Compiling Object Oriented Languages What is an Object-Oriented Programming Language? Last time Dynamic compilation Today Introduction to compiling object oriented languages What are the issues? Objects

The Software Development Life Cycle: An Overview Presented by Maxwell Drew and Dan Kaiser Southwest State University Computer Science Program Last Time The design process and design methods Design strategies

You are required to develop an automated Student Registration System (SRS). This system will enable students to register online for courses each semester. As part of the exercise you will have to perform

Programming and Software Development CTAG Alignments This document contains information about four Career-Technical Articulation Numbers (CTANs) for Programming and Software Development Career-Technical

Software Engineering Software Reuse Based on Software Engineering, 7 th Edition by Ian Sommerville Objectives To explain the benefits of software reuse and some reuse problems To discuss several different

Methods and Inheritance: Overriding We might want to require that every Person can dance. But the way a Lecturer dances is not likely to be the same as the way a Student dances... Student overrides the

Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

Division of Mathematical Sciences Chair: Mohammad Ladan, Ph.D. The Division of Mathematical Sciences at Haigazian University includes Computer Science and Mathematics. The Bachelor of Science (B.S.) degree

Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

Questions? Assignment Why is proper project management important? What is goal of domain analysis? What is the difference between functional and non- functional requirements? Why is it important for requirements

C++ for Game Programmers Course Description C++ has become one of the favourite programming language for game programmers. Reasons for wide spread acceptability of C++ are plenty, but primary reasons are,

One problem, many solutions 243 Week 3 Lecture - Interfaces Suppose we want to implement a set of classes to represent various shapes such as circles and rectangles. We want to be able to calculate the

Polymorphism Problems with switch statement Programmer may forget to test all possible cases in a switch. Tracking this down can be time consuming and error prone Solution - use virtual functions (polymorphism)

www.capspace.org (01/17/2015) Software Engineering Transfer Degree This program of study is designed for associate-degree students intending to transfer into baccalaureate programs awarding software engineering

Business Process Modeling and Workflow Automation Ivo Vondrak * ivo.vondrak@vsb.cz Abstract: Process modeling and workflow applications have become more an more important during last decade. The main reason

System Software Product Line 2 1 Introduction The concept of Software Product Lines has been developed for more than a decade. Being initially an academic topic, product lines are more and more incorporated

VCU 1 COMPUTER SCIENCE, BACHELOR OF SCIENCE (B.S.) The Bachelor of Science in Computer Science is built on a rigorous, highly concentrated, accredited curriculum of computer science courses. The program

JSD VERSION 2 AND AN OVERVIEW OF DEVELOPMENTS IN JSD J. R. Newport This paper provides a brief description of the JSD method as it was originally published in 1983 1 followed by a description of the enhancements

SYSTEMS INC. RTAP Database Lifecycle Management Abstract: This paper will describe the typical RTAP database lifecycle and how the tessernet Systems Inc. tools can make this process easier to manage and

Summary C++ Language is one of the approaches to provide object-oriented functionality with C like syntax. C++ adds greater typing strength, scoping and other tools useful in object-oriented programming

Chapter 7 Data Structures for Computer Graphics (This chapter was written for programmers - option in lecture course) Any computer model of an Object must comprise three different types of entities: 1.

Software Life Cycle Lecture Objectives What happens in the life of software To look at the life cycle of a software To understand the software process and its related elements To relate to the different

Design Patterns in Java 2004 by CRC Press LLC 2 BASIC PATTERNS The patterns discussed in this section are some of the most common, basic and important design patterns one can find in the areas of object-oriented

Object Technology Toolsets for LabVIEW OTT by Herbert Pichlik and Jens Vogel Abstract Products used: National Instruments LabVIEW 6i Since the eighties NIs LabVIEW proofed to be a powerful and versatile

Date: 7 th October 2010 Author: Guillaume FINANCE, Objet Direct Analyst & Consultant UML, the standard modelling language used in the field of software engineering, has been tailored to define a modelling

Length Five days About this Course The course focuses on C# program structure, language syntax, and implementation detailswith.net Framework 4.0. This course describes the new enhancements in the C# 4.0