We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26
Chapter:1
Introduction to Object Oriented
Programming Concepts Evaluation of Software First-Generation Language • The first-generation languages are also called machine languages/ 1G language. This language is machine- dependent. The machine language statements are written in binary code (0/1 form) because the computer can understand only binary language. • Advantages : – Fast & efficient as statements are directly written in binary language. – No translator is required. • Disadvantages : – Difficult to learn binary codes. – Difficult to understand – both programs & where the error occurred. Second Generation Language • The second-generation languages are also called assembler languages/ 2G languages. Assembly language contains human-readable notations that can be further converted to machine language using an assembler. • Assembler – converts assembly level instructions to machine-level instructions. • Programmers can write the code using symbolic instruction codes that are meaningful abbreviations of mnemonics. It is also known as low- level language. • Advantages : – It is easier to understand if compared to machine language. – Modifications are easy. – Correction & location of errors are easy. • Disadvantages : – Assembler is required. – This language is architecture /machine-dependent, with a different instruction set for different machines. Third-Generation Language • The third generation is a programming language designed to be easier for human to understand. It consists of the use of a series of English- like words that humans can understand easily, to write instructions. It’s also called High-Level Programming Language. For execution, a program in this language needs to be translated into machine language using a Compiler/ Interpreter. PASCAL, FORTRAN and COBOL, are early examples of this sort of language. Most modern language (BASIC, C C++, Java etc.)are also third generation languages. • Advantages : – Use of English-like words makes it a human-understandable language. – Lesser number of lines of code as compared to the above 2 languages. – Same code can be copied to another machine & executed on that machine by using compiler-specific to that machine. • Disadvantages : – Compiler/ interpreter is needed. – Different compilers are needed for different machines. Fourth Generation Language • The fourth-generation language is designed to be closer to natural language than a 3GL language.4GL are non- procedural in nature. It enables users to access the database. Examples: SQL, Foxpro, Focus, etc. • These languages are also human-friendly to understand. • Advantages : – Easy to understand & learn. – Less time is required for application creation. – It is less prone to errors. • Disadvantages : – Memory consumption is high. – Has poor control over Hardware. FIFTH GENERATION LANGUAGE • The fifth-generation languages are also called 5GL. It is based on the concept of artificial intelligence. It uses the concept that rather than solving a problem algorithmically, an application can be built to solve it based on some constraints, i.e., we make computers learn to solve any problem. Parallel Processing & superconductors are used for this type of language to make real artificial intelligence. – Examples: PROLOG, LISP, etc. • Advantages : – Machines can make decisions. – Programmer effort reduces to solve a problem. – Easier than 3GL or 4GL to learn and use. • Disadvantages : – Complex and long code. Introduction of Programming Paradigms
Paradigm can also be termed as method to solve some
problem or do some task. Programming paradigm is an approach to solve problem using some programming language or also we can say it is a method to solve a problem using tools and techniques that are available to us following some approach. There are lots for programming language that are known but all of them need to follow some strategy when they are implemented and this methodology/strategy is paradigms. Apart from varieties of programming language there are lots of paradigms to fulfill each and every demand. Procedural programming paradigm • This paradigm emphasizes on procedure in terms of under lying machine model. There is no difference in between procedural and imperative approach. It has the ability to reuse the code and it was boon at that time when it was in use because of its reusability. • Examples of Procedural programming paradigm: C : developed by Dennis Ritchie and Ken Thompson C++ : developed by Bjarne Stroustrup Java : developed by James Gosling at Sun Microsystems ColdFusion : developed by J J Allaire Pascal : developed by Niklaus Wirth Object oriented programming – • The program is written as a collection of classes and object which are meant for communication. The smallest and basic entity is object and all kind of computation is performed on the objects only. More emphasis is on data rather procedure. It can handle almost all kind of real life problems which are today in scenario. • Advantages: – Data security – Inheritance – Code reusability – Flexible and abstraction is also present • Examples: – Simula : first OOP language – Java : developed by James Gosling at Sun Microsystems – C++ : developed by Bjarne Stroustrup – Objective-C : designed by Brad Cox – Visual Basic .NET : developed by Microsoft – Python : developed by Guido van Rossum – Ruby : developed by Yukihiro Matsumoto OOPs (Object-Oriented Programming System) • Object means a real-world entity such as a pen, chair, table, computer, watch, etc. • Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance by providing some concepts: Object • Any entity that has state and behavior is known as an object. For example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical. • An Object can be defined as an instance of a class. • An object contains an address and takes up some space in memory. • Objects can communicate without knowing the details of each other's data or code. • The only necessary thing is the type of message accepted and the type of response returned by the objects. • Example: A dog is an object because it has states like color, name, breed, etc. as well as behaviors like wagging the tail, barking, eating, etc. Class • Collection of objects is called class. It is a logical entity. • A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space. Inheritance • When one object acquires all the properties and behaviors of a parent object, it is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism. Polymorphism • If one task is performed in different ways, it is known as polymorphism. For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc. • In Java, we use method overloading and method overriding to achieve polymorphism. • Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc. Abstraction • Hiding internal details and showing functionality is known as abstraction. For example phone call, we don't know the internal processing. • In Java, we use abstract class and interface to achieve abstraction. Encapsulation • Binding (or wrapping) code and data together into a single unit are known as encapsulation. For example, a capsule, it is wrapped with different medicines. • A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here. Advantage of OOPs over Procedure-oriented programming language • OOPs makes development and maintenance easier, whereas, in a procedure-oriented programming language, it is not easy to manage if code grows as project size increases. • OOPs provides data hiding, whereas, in a procedure- oriented programming language, global data can be accessed from anywhere. • OOPs provides the ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using the Object-Oriented Programming language What is the difference between an object-oriented programming language and object-based programming language? Object-based programming language follows all the features of OOPs except Inheritance. JavaScript and VBScript are examples of object-based programming languages.