OOP - Chapter 01.pdf
Document Details
Uploaded by Deleted User
Tags
Related
- Topic 1.2 Objects_ CS 002-CS21S1 - Advanced Object-Oriented Programming.pdf
- Introduction to Java Programming and Data Structures (2019) by Y. Daniel Liang - PDF
- Java Programming Concepts (Lesson Plan)
- Object-Oriented Programming using Java PDF
- Object-Oriented Programming Concepts - Chapter 10 Abstraction (PDF)
- CP213 Lesson 7: Object-Oriented Programming Concepts (PDF)
Full Transcript
OBJECT ORIENTED PROGRAMMING IT 2306 / CS 2306 Chapter 01 Dhanushka Jayasinghe Course Outcomes On the successful completion of this course you will be able to – Understand the concepts of object-oriented design and development technologies Develop a mini project by usin...
OBJECT ORIENTED PROGRAMMING IT 2306 / CS 2306 Chapter 01 Dhanushka Jayasinghe Course Outcomes On the successful completion of this course you will be able to – Understand the concepts of object-oriented design and development technologies Develop a mini project by using the OOP concepts References & Recommendations Java - How To Program 9th Edition - By Paul Deitel & Harvey Deitel Evaluation Criteria Continuous assessment - 40% Mini project - 20% Assignments - 10% Class tests - 10% End semester examination - 60% Lesson Plan Introduction to programming Low Level Language Middle Level Language High Level Language Compilers and Interpreters Introduction to Java JDK , JRE , JVM Operators Methods Lesson Plan Introduction to OOP Class Object OOP Concepts Inheritance Polymorphism Abstraction Encapsulation Instances Overriding , Overloading Access Modifiers Pre-requisites 1. Basic knowledge in programming. 2. We will be using Java programming language throughout this lecture sessions. Introduction to Programming Languages A Layered view Implemented using programming languages What is a program? A program is a set of instructions that tell a computer what to do. Instructions are described using programming languages. E.g.: a = a + 10 print(a) = is the assignment operator Why Programming? Programming is the path to create software applications that supports in daily use Thus this involves to automate, collect, manage, calculate and analyze processing of data and information accurately Programming In Industry and Research Do you know?? Most successful business run in the world are IT companies. (Microsoft, Facebook, Apple, Google, Dell, Cisco, Motorolla) Computing collaborates to the industry and research in vast scope In Health Science (Medical Imaging) In using GPS Robots and Game applications Program vs. Software Program is a set of instructions that perform a specific task that it is made for. Program vs. Software Software consists of computer program with all associated documents, configurations, user interfaces to make program operate correctly. Simple view of running a program The input to a computer consisting of two parts, a program and some data. The data is the input to the program. E.g.: if the program adds two numbers, then the two numbers are the data. The computer follows the instructions in the program, and in that way, performs some process and outputs the results. What is a programming language? Language: For human–human communication Consisting of the use of words in a structured way. What is a programming language? Programming language: For human-computer interaction. A vocabulary and a set of grammatical rules for instructing a computer to perform specific tasks. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions. Why do we have many programming languages? Why do people speak different languages? Different programming languages are designed for different purposes / types of programs. Programming languages have evolved over time as better ways have been developed to design them. First programming language was developed in the 1950s In 1954, FORTRAN language was invented by IBM; it was the first widely used high level general purpose programming language (https://en.wikipedia.org/wiki/History_of_programming_languages) Since then thousands of languages have been developed Computer Languages Use 0’s and 1’s to Use symbols (registers) Similar to human languages. generate instructions to generate instructions E.g. Java, C++ E.g. MIPS, ARM 0001001011110…111 add $s1, $s1, $s2 a = a + b Levels of Programming Languages High-level Programming Languages They are designed to be easy for human beings to write programs and they are closer to human languages The main advantage of high-level languages over low-level languages is that they are easier to read, write, and maintain. a = a + b + 10 E.g. : Python, Java, C, C++, C#, Visual Basic, Pascal, Delphi, FORTRAN, and COBOL. They are more or less independent of a particular type of computer. High-level language code does not get executed on a computer directly. Translator programs called Compilers/Interprters converted high level languages to machine language Middle Level (Assembly) languages A symbolic representation of machine instructions. Use English-like abbreviations to represent the elementary operations Are considered low-level because they are very close to machine languages. Translator programs called Assemblers are used to convert assembly language programs into machine language Low Level (Machine) language A binary representation of machine instructions. Very hard for human to understand. Computers understand only machine language instructions. All the high and low-level instructions should be converted to machine language instructions for the computer to understand. These are machine dependent where can be used on only one type of machine. High-level language code to Machine Language code We generally write a computer program using a high-level language. A high-level language is one which is understandable by human. It contains words and phrases from the English (or other) language. But a computer does not understand high-level language. It only understands program written in 0's and 1's in binary, called the machine code. High-level programming languages Two broad groups Procedural programming languages Sequences of instructions E.g. FORTRAN, BASIC, C, COBOL, Pascal Object-oriented languages Objects are created rather than sequences of instructions E.g. JAVA, C++, C#, Python, PHP, JavaScript Compilers and Interpreters A program written in high-level language is called the source code. We need to convert the source code into machine code and this is accomplished by compilers and interpreters. Compiler or an interpreter is a program that converts program written in high-level language into machine code understood by the computer. Compilers and Interpreters Interpreter Compiler Translates program one statement at a Scans the entire program and translates it time. as a whole into machine code. It takes less amount of time to analyse It takes large amount of time to analyse the source code but the overall execution the source code but the overall execution time is slower. time is comparatively faster. No intermediate object code is Generates intermediate object code, generated, hence are memory efficient. hence requires more memory. Continues translating the program until It generates the error message only after the first error is met, in which case it scanning the whole program. Hence stops. Hence debugging is easy. debugging is comparatively hard. Programming language like Python, Ruby Programming language like C, C++, Java use interpreters. use compilers. Compiler and Assembler Compilers - are used to convert high level languages (like C, C++ ) into machine code. Example : gcc , javac Assemblers - are compilers, used to convert assembly language code into machine code. Compiler and Assembler Hybrid mode