OBJECT ORIENTED PROGRAMMING. Loredana STANCIU Room B613

Similar documents
Chapter 1 Fundamentals of Java Programming

Section 1.4. Java s Magic: Bytecode, Java Virtual Machine, JIT,

Characteristics of Java (Optional) Y. Daniel Liang Supplement for Introduction to Java Programming

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

INTRODUCTION TO JAVA PROGRAMMING LANGUAGE

CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution

CS 209 Programming in Java #1

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

System Structures. Services Interface Structure

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Multi-core Programming System Overview

Contents. Java - An Introduction. Java Milestones. Java and its Evolution

1. Overview of the Java Language

Introduction to Virtual Machines

picojava TM : A Hardware Implementation of the Java Virtual Machine

Programming Languages

2 Introduction to Java. Introduction to Programming 1 1

Glossary of Object Oriented Terms

language 1 (source) compiler language 2 (target) Figure 1: Compiling a program

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

02 B The Java Virtual Machine

Crash Course in Java

CPS221 Lecture: Operating System Structure; Virtual Machines

Java in Education. Choosing appropriate tool for creating multimedia is the first step in multimedia design

General Introduction

Virtualization Technologies and Blackboard: The Future of Blackboard Software on Multi-Core Technologies

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Fundamentals of Java Programming

Mobile Application Languages XML, Java, J2ME and JavaCard Lesson 04 Java

Chapter 3 Operating-System Structures

Agent Languages. Overview. Requirements. Java. Tcl/Tk. Telescript. Evaluation. Artificial Intelligence Intelligent Agents

Mobile Operating Systems. Week I

Example of Standard API

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

CSC 551: Web Programming. Spring 2004

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Connect Here. Go Anywhere.

An Overview of Java. overview-1

Cloud Computing. Up until now

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

An Easier Way for Cross-Platform Data Acquisition Application Development

Java CPD (I) Frans Coenen Department of Computer Science

The Java Virtual Machine and Mobile Devices. John Buford, Ph.D. Oct 2003 Presented to Gordon College CS 311

Instrumentation Software Profiling

Restraining Execution Environments

9/11/15. What is Programming? CSCI 209: Software Development. Discussion: What Is Good Software? Characteristics of Good Software?

Operating System Structures

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

Java Garbage Collection Basics

CS420: Operating Systems OS Services & System Calls

Java and Real Time Storage Applications

Jonathan Worthington Scarborough Linux User Group

Java Programming. Binnur Kurt Istanbul Technical University Computer Engineering Department. Java Programming. Version 0.0.

Layering a computing infrastructure. Middleware. The new infrastructure: middleware. Spanning layer. Middleware objectives. The new infrastructure

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

Antonio Kung, Trialog. HIJA technical coordinator. Scott Hansen, The Open Group. HIJA coordinator

Holly Cummins IBM Hursley Labs. Java performance not so scary after all

Virtual Machines. Virtual Machines

Manjrasoft Market Oriented Cloud Computing Platform

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

CSCI 253. Object Oriented Programming (OOP) Overview. George Blankenship 1. Object Oriented Design: Java Review OOP George Blankenship.

Java Card TM Open Platform for Smart Cards

The Art of Virtualization with Free Software

Lecture 1: Introduction

Managing Variability in Software Architectures 1 Felix Bachmann*

Chapter 2 System Structures

An Overview of Virtual Machine Architectures

Study of Realized Mehtod on a Java Web Server Monitoring System

Building Applications Using Micro Focus COBOL

Chapter 2: OS Overview

A Modular Approach to Teaching Mobile APPS Development

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Effective Java Programming. efficient software development

Fachbereich Informatik und Elektrotechnik SunSPOT. Ubiquitous Computing. Ubiquitous Computing, Helmut Dispert

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

The Hotspot Java Virtual Machine: Memory and Architecture

The Fastest Way to Parallel Programming for Multicore, Clusters, Supercomputers and the Cloud.

25 May Code 3C3 Peeling the Layers of the 'Performance Onion John Murphy, Andrew Lee and Liam Murphy

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Kernel comparison of OpenSolaris, Windows Vista and. Linux 2.6

Introduction to Object-Oriented Programming

JPURE - A PURIFIED JAVA EXECUTION ENVIRONMENT FOR CONTROLLER NETWORKS 1

Java Virtual Machine: the key for accurated memory prefetching

How To Write Portable Programs In C

Implementing Java Distributed Objects with JDBC

Tool - 1: Health Center

Real-time Java Processor for Monitoring and Test

Language Based Virtual Machines... or why speed matters. by Lars Bak, Google Inc

C# and Other Languages

Java Application Developer Certificate Program Competencies

Virtual Machines. Adapted from J.S. Smith and R. Nair, VIRTUAL MACHINES, Morgan-Kaufmann Teodor Rus.

A Layered Architecture based on Java for Internet and Intranet Information Systems

Ahsay BackupBox v1.0. Deployment Guide. Ahsay TM Online Backup - Development Department

On Performance of Delegation in Java

Monitoring Java enviroment / applications

ELEC 377. Operating Systems. Week 1 Class 3

Transcription:

OBJECT ORIENTED PROGRAMMING Course 1 Loredana STANCIU loredana.stanciu@aut.upt.ro Room B613

A SURVEY OF PROGRAMMING TECHNIQUES Unstructured programming

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

UNSTRUCTURED PROGRAMMING Disadvantage: in large programs using the same statement sequence Idea to extract these sequences, name them and offering a technique to call and return from these procedures

A SURVEY OF PROGRAMMING TECHNIQUES Unstructured programming Procedural programming

PROCEDURAL PROGRAMMING To combine 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

PROCEDURAL PROGRAMMING A single program divided into small pieces called procedures To enable usage of general procedures or groups of procedures in other programs, they must be separately available

A SURVEY OF PROGRAMMING TECHNIQUES Unstructured programming Procedural programming Modular programming g

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

EXAMPLE HANDLING SINGLE LISTS To program a list in a modular programming language: the interface definition the implementation ti file

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 List Hiding information

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 t this); BOOL list_isempty(list_handle_t this); END Singly-Linked-List-2; List List objects

MODULAR PROGRAMMING PROBLEMS 1) Explicit Creation and Destruction PROCEDURE foo() BEGIN list_handle_t t mylist; mylist <- list_create(); /* Do something with mylist */... list_destroy(mylist); END

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

MODULAR PROGRAMMING PROBLEMS 3) Missing Type Safety the compiler cannot guarantee for type safety a mechanism which h 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 */

MODULAR PROGRAMMING PROBLEMS 4) Strategies and Representation a cursor is used to point to the current element a traversing strategy t which h defines the order in which the elements of the data structure are to be visited to separate the actual representation or shape of the data structure from its traversing strategy

A SURVEY OF PROGRAMMING TECHNIQUES Unstructured programming Procedural programming Modular programming g Object-oriented programming

OBJECT-ORIENTED ORIENTED PROGRAMMING solves some of the mentioned problems a web of interacting objects, each house-keeping its own state

OBJECT-ORIENTED ORIENTED PROGRAMMING HANDLING PROBLEMS to obtain ones own abstract view, or model, of the problem abstraction

OBJECT-ORIENTED ORIENTED PROGRAMMING HANDLING PROBLEMS to 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, size, date of birth, shape, social number, room number, hair colour, hobbies problem specific properties p data the abstract employees operations

OBJECT-ORIENTED ORIENTED PROGRAMMING HANDLING PROBLEMS abstraction ti is the structuring t of a nebulous problem into well-defined entities by defining their data and operations combine data and operations which are not decoupled from each other

OBJECT-ORIENTED ORIENTED PROGRAMMING PROPERTIES OF ABSTRACT DATA TYPES with abstraction ti one can create a welldefined 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

OBJECT-ORIENTED 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

OBJECT-ORIENTED 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

OBJECT-ORIENTED 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). ( ) p yp ( ) It defines attributes and methods which implement the data structure and operations of the ADT, respectively.

OBJECT-ORIENTED 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 d by its name and ditd defines a state t which h 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.

OBJECT-ORIENTED 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 fthe method and the arguments of the method. Definition (Method) A method is associated with a class. An object invokes ( ) j a method as a reaction to receipt of a message.

OBJECT-ORIENTED ORIENTED PROGRAMMING Relationships between two similar classes Is-A relationship Between objects Part-Of relationship

OBJECT-ORIENTED 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

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

WHAT IS JAVA? Late 1980s C++ was widely used to write OOP: not a platform independent needed d d to be recompiled for each different CPUs 1991 a team of Sun Microsystems make a platform independent software and named it Oak 1995 Java

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

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.

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

THE JAVA LANGUAGE

THE JAVA PLATFORM A platform the hardware or software environment in which a program runs. Java a software-only 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 a large collection of ready-made software components that provide many useful capabilities grouped in packages

THE JAVA PLATFORM

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

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 run-time system Java technology constructs applications that can't be invaded from outside

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

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 lowpriority background thread

JAVA CHARACTERISTICS Interpreted, Threaded, and Dynamic The Java interpreter can execute Java bytecodes directly on any machine to which the interpreter and run-time system have been ported Java technology's multithreading capability yprovides 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

REFERENCES Peter Muller, Introduction to Object-Oriented Programming Using C++, Chapters 1, 2, 3 and 4, http://www.desy.de/gna/html/cc/tutorial/tutorial.html The Java Tutorials. Getting Started. http://java.sun.com/docs/books/tutorial/getstarted/i ndex.html

SCHEDULER C o u r s W W W W W W W W W W W W W W 1 2 3 4 5 6 7 8 9 1 1 1 1 1 0 1 2 3 4 C C C C C E1 P1 C E1 P2 C C C E2 P1 L L1 L2 L3 L4 L5 L6 L7 T1 L8 L9 L10 L11 T2 L12 a b E2 P2