Computer Science

Object orientated programming

Object-oriented programming (OOP) is a programming paradigm that organizes software design around data, or objects, rather than functions and logic. It emphasizes the concept of "objects" that encapsulate data and behavior, allowing for modularity and reusability in software development. OOP languages, such as Java and C++, enable the creation of classes and objects to represent real-world entities and their interactions.

Written by Perlego with AI-assistance

10 Key excerpts on "Object orientated programming"

  • Book cover image for: IT Interview Guide for Freshers
    eBook - ePub

    IT Interview Guide for Freshers

    Crack your IT interview with confidence

    C HAPTER 6 Object-oriented Programming (OOPs) O bject-oriented programming also known as OOP is a paradigm which is usually cantered around the concept of classes and objects and which includes data, known as attributes; and functions, known as methods. In the OOP paradigm, the object's methods can access and change the data fields. In the OOP paradigm, applications are designed by creating objects that interact with each other. There is usually a considerable variety of OOP languages, but many widespread ones are structured around the class, that is, objects are instances of classes, which also govern their type. This chapter covers the OOPs aspects and provides the question bank which includes topics for core concepts, encapsulation, composition and inheritance, and polymorphism. Concepts What is object-oriented programming (OOPs)? What are classes and objects? Object-oriented programming (OOPs) is a model to create logical modules known as classes consisting of properties, fields, methods, and events. An object is usually created by the program from a class definition. This object encapsulates the features such as behavior and data. OOP facilitates developing modular applications and assembles them as software programs. Class: A class explains the attributes and functions that define the behavior. A class is a template for an object. A class is a complete data type, which represents a template for the objects. A class is the fundamental building block of the OOPs application. This is usually a template that defines the properties, behaviors, events for a particular group of objects. The class consists of behavior and data. For example, the aircraft class contains data such as category, model number, color, and behavior such as length of the flight time, speed, and total number of passengers
  • Book cover image for: Introduction to Programming Languages
    403 C H A P T E R 11 Object-Oriented Programming Paradigm BACKGROUND CONCEPTS Abstract concepts in computation (Section 2.4); Abstractions and information exchange (Chapter 4); Abstract implementation and low level behavior (Chapter 5); Data structure concepts (Section 2.3); Dynamic memory management (Chapter 6); Distributed computing (Section 8.4); Polymorphism (Section 7.5) . Object-oriented programming was born out of need to develop large-scale software. Object-oriented programming has been applied to the development of large databases including multi-media databases and major commercial software. In order to develop large-scale software, one has to build upon software developed earlier to avoid duplication, make it robust, and main-tain it. Software reusability and maintainability is a major factor for the large-scale software development to (1) reduce the cost of development and evolution and (2) keep the number of bugs relatively low. Major interrelated components of object-oriented programming are modu-larity, reusability, and information-hiding of the implementation-level details of modules. Modularity means breaking up large software into smaller modules that can be placed as a class library and loaded in other modules when needed. This supports better reuse and maintainability. Only a limited public part of a module is visible outside. This public part is necessary for an object to communicate with other objects. Hidden parts of the module are needed for the implementation and can change with time to incorporate new technol-ogy or redesigned software to improve the execution efficiency. Reusability means that proven debugged and robust software is used again to avoid the time and cost overhead of development and maintenance. Information hiding means that the details of implement-ing various entities declared in one module is invisible to other modules unless exported intentionally by the programmer and intentionally imported in other modules.
  • Book cover image for: Object-Oriented Programming under Windows
    Object-oriented program-ming is only a convenience for software developers; behind it is a set of CASE statements and other structures that provide a simplified front-end for the programmer. Ultimately, all executable code exists within computer memory in the tangle of JMP statements that are the only things the chip at the core of the PC can understand. ENCAPSULATION Perhaps the most important distinction to make between object-oriented programming and traditional procedural programming is that an object is an independent program segment that, in a sense, has a life of its own, separate from other objects in the program; procedures, on the other hand, are merely sets of instructions, possibly with their own local data, that have been created for convenience. Whether you combine procedures or split them up is a matter of personal preference. Objects, on the other hand, will usually represent some real concept: a dialogue box, a button or a list for example. The boundaries of the object are usually much more intuitively defined. (Because of this link between programming objects and real concepts, object-oriented programs are sometimes referred to as simulations.) An object contains all that is needed to make a particular aspect of the program carry out its tasks: • The procedures that are needed to respond to incoming instructions • The data that is needed by these procedures Introduction to Object-Oriented Programming 19 Object Data Caption: OK Width: 25 Height: 8 Default: True Methods Click DragOver GotFocus LostFocus Figure 1 .2 Data and procedures for command button object Figure 1.2 shows a simple object - a command button - with some of its data and procedures. This process of bundling together procedures and data is referred to as encapsulation and is central to object-oriented programming. In this way, each object is insulated from the rest of the application.
  • Book cover image for: Extreme C
    No longer available |Learn more

    Extreme C

    Taking you to the limit in Concurrency, OOP, and the most advanced capabilities of C

    It is usually said that OOP is another programming paradigm together with procedural and functional paradigms. But OOP is more than that. OOP is more like a way of thinking about and analyzing a problem. It is an attitude towards the universe and the hierarchy of objects within it. It is part of our ancient, intrinsic, and inherited method for comprehending and analyzing the physical and abstract entities around us. It is so fundamental to our understanding of nature.
    We've always thought about every problem from an object-oriented point of view. OOP is just about applying the same point of view that humans have always adopted, but this time using a programming language to solve a computational problem. All this explains why OOP is the most common programming paradigm used for writing software.
    This chapter, together with the following three chapters, are going to show that any concept within OOP can be implemented in C – even though it might be complex to do. We know we can have OOP with C because some people have already done it, especially when they created C++ on top of C, and since they have built many complex and successful programs in C in an object-oriented fashion.
    What these chapters are not going to suggest is a certain library or set of macros that you should use for declaring a class or establishing an inheritance relation or working with other OOP concepts. In addition, we won't impose any methodology or discipline such as specific naming conventions. We will simply use raw C to implement OOP concepts.
    The reason why we're dedicating four whole chapters to OOP with C is because of the heavy theory behind object orientation and the various examples that are necessary to be explored in order to demonstrate all of it. Most of the essential theory behind OOP is going to be explained in this chapter, while the more practical topics will be dealt with in the following chapters. With all that said, we need to discuss the theory because the OOP concepts are usually new to most skilled C programmers, even those with many years of experience.
    The upcoming four chapters together cover almost anything that you might come across in OOP. In this chapter, we are going to discuss the following:
    • First of all, we'll give definitions for the most fundamental terms used in OOP literature. We'll define classes, objects, attributes, behaviors, methods, domains, and more. These terms will be used heavily throughout these four chapters. They are also vital to your understanding of other OOP-related resources because they are a staple part of the accepted language of OOP.
  • Book cover image for: Object-Oriented Programming with SIMOTION
    eBook - PDF

    Object-Oriented Programming with SIMOTION

    Fundamentals, Program Examples and Software Concepts According to IEC 61131-3

    • Michael Braun, Wolfgang Horn(Authors)
    • 2017(Publication Date)
    • Publicis
      (Publisher)
    In some situations, a procedural programming solution might be simpler and more efficient. The OOP programming language is not a panacea and does not speed up the software development process. It does however ensure that the software is better organized and easier to manage. When the OOP concept is applied correctly, it offers a number of advantages that can result in time savings. As with all forms of expression (programming languages) in software engineering, poor program code can also be written in the OOP language. This problem can only be avoided by sensible planning of software. Programmers who work according to “straight from brain to terminal” should not bother with OOP. 45 2.2 General principles of OOP 2.2.7 Advantages of using OOP ◼ The encapsulation of objects is a feature of object-oriented programming that ensures highly reliable program execution. ◼ When the OOP method is used, it becomes significantly easier to design modularized software. ◼ Thanks to the encapsulation, inheritance and overriding mechanisms associated with OOP, the software is simpler to manage and easier to modify overall. ◼ When OOP is utilized in appropriate program modules or libraries, the degree to which the software can be standardized and reused is increased considerably. ◼ The amount of time and effort involved in programming can be reduced thanks to the inheritance principle (because program code does not need to be copied or adapted again). ◼ Larger-scale software projects are easier to implement with substantially fewer errors. ◼ By comparison with procedural programming, object-oriented program- ming makes it far simpler to develop software components independently. This can be achieved by consistently applying the principles of encapsula- tion and clear interface definition. ◼ Interfaces support generic programming, helping to reduce the time and effort involved in adapting software and making it significantly easier to combine objects of different types.
  • Book cover image for: Object-Oriented Information Engineering
    eBook - PDF

    Object-Oriented Information Engineering

    Analysis, Design, and Implementation

    • Stephen Montgomery(Author)
    • 2012(Publication Date)
    • Academic Press
      (Publisher)
    Object-oriented programs are built by stringing objects together in the order dictated by an application. The result is greatly simplified applica-tion development. In many cases, end users can actually build their own applications because the details are hidden inside the confines of object capsules. Software systems are becoming increasingly complex. Numerous applica-tion systems of increasing size and complexity need to be connected and managed as a network of cohesive subsystems, not as the stand-alone systems of today. Tomorrow's systems must be understood at a high enough level to allow business planners and managers to grasp the systems as an integrated whole. These same systems must be modeled in enough detail to describe robust functionality at a conceptual rather than physical level. As structured software engineering enthusiasts have long known, building models often takes longer during up-front analysis and design but saves much more time during system maintenance. Objects provide for not only greater simplicity but greater modeling power for system maintenance and growth. Object models tend to closely reflect natural systems in the real world. Rather than modeling static data structures separate from dynamic system behaviors, object-based systems incorporate processing logic along with static data structures. Software reliability is becoming a real problem for older, often obsolete systems as well as the more complex new systems being developed today. Vendors of packaged software routinely send corrected upgrades to their users to repair problem software. System developers often make disclaimers about the software that they maintain or create. Object concepts can be used to model and implement much more complex but reliable systems via various levels of abstraction. A significant opportunity exists for incorporating useful object concepts into older systems in order to evolve to object-based systems.
  • Book cover image for: Understanding C++ for MFC
    • Richard Raposa(Author)
    • 2001(Publication Date)
    • CRC Press
      (Publisher)
    Chapter 3 Fundamentals of Object-Oriented Programming Object-oriented programming involves a different way of thinking. Instead of focusing on the functions and tasks of a program, you design an object-oriented program around the objects in the problem domain. Once you determine these objects, a class is written to define the attributes and behaviors for each object. This chapter will discuss the details of writing classes in C++ and instantiating those classes to create objects. A well-written class can ensure that its objects have valid and consis-tent data in them, and you will see how this is accomplished using encapsulation. Encapsula-tion involves adding member functions to a class. Classes can contain a function called a constructor that initializes an object when it is instantiated. A similar function called a destructor is invoked when the object is destroyed. You will see how to implement construc-tors and destructors and discover their uses and benefits. I will finish this chapter with a discussion of the CSt ring class -a utility class in MFC that can be used to represent strings. There are many useful methods in the CStri ng class, which makes it a preferred alternative to using an array of characters for strings. 53 54 Chapter 3: Fundamentals of Object-Oriented Programming Classes vs. Objects Before I begin our discussion on object-oriented programming, you need to understand the difference between a class and an object. I have used both words frequently -most notice-ably in the terms object-oriented and Microsoft Foundation Classes. But what exactly is an object? This section defines both terms and how they are related. A class is often described as a blueprint of an object. The analogy works well if you com-pare classes and objects to blueprints and houses. Before a house is built, the building con-tractor needs a blueprint, i.e., a detailed description of exactly what the house is going to look like.
  • Book cover image for: Programming language theory
    • Alvin Albuero De Luna(Author)
    • 2023(Publication Date)
    • Arcler Press
      (Publisher)
    Support for Object-Oriented Programming 207 this chapter. Examples of such languages include (Stroustrup, 1987; Sanders and Dorn, 2003). 8.2. OBJECT-ORIENTED PROGRAMMING 8.2.1. Introduction The idea of object-oriented computing was first introduced in SIMULA 67, but it wasn’t completely explored until the growth of Smalltalk led to the creation of Smalltalk 80 (in 1980, of course). Many people believe that Smalltalk should serve as the foundation for an entirely object-oriented computer language. Support for these three important language elements is required for just a language to be considered object-oriented. These features include inheritance, abstraction types of data, and dynamic typing of system calls to procedures (Wilde and Huitt, 1992; Kölling, 1999). 8.2.2. Inheritance Software engineers have always faced pressure to work more efficiently. The ongoing decrease in the cost of computer equipment has increased this strain. Many software engineers realized either by mid to end of the 1980s that one of the most range of applications for boosting professional productivity included software reuse. With their containment and access constraints, data structures are a logical option for reuse. The issue with reusing abstractions is that almost often, their capabilities and properties are not exactly appropriate for the new usage. The old type needs at least a few little adjustments. Such updates might be challenging since they need a thorough understanding of the current code on the side of the individual modifying. The individual making the change is often not the network’s original creator. Additionally, the updates often need modifying all client applications. The fact that perhaps the category definitions for abstractions are all independently and of the same level presents a second issue. Because of this architecture, it is often hard to structure a program to correspond to the problem domain being treated more by the program.
  • Book cover image for: From COBOL to OOP
    We can identify three important characteristics of object-oriented programming: Data abstraction Inheritance (type extension) Dynamic binding A system is a set of independent data and operations Important characteristics of object-oriented programming 154 Chapter 5 True Object-Oriented Programming The term data abstraction was discussed extensively in Section 4.1, and the two other terms are explained in Section 5.2. An important advantage of object-oriented programming is reusability, which the following tutorial sections discuss in detail. 5.1.5 Terminology Class: A class corresponds roughly to an abstract data type—one for which variables can be declared that will then dispose of attributes and operations. Object: An object is an instance of a class. Considering that this always concerns dynamic data structures, an object not only has to be declared but also created. Attribute: This is a data component of an object and is often called an instance variable or member . Method: A method is an operation (procedure) provided by a class. Message: A message is a dynamically bound procedure call. Inheritance: This type of extension can be used to specialize a class (see Section 5.2). 5.1.6 Exercises Task 1 (180 minutes): Queue Use the information from task 1 in Section 4.2.4. Then modify this task so that a class Queue is defined instead of a simple dynamic data structure Queue . 5.2 Inheritance and Dynamic Binding Inheritance is one of the major advantages of object-oriented program-ming. Inheritance uses the fact that we often have to code similar but not Terms used in object-oriented programming 5.2 Inheritance and Dynamic Binding 155 entirely identical classes. When starting to work on the solution of a new task, we often find that a similar task has already been solved. For example, we may find a class that can process the name, address, employee number, and salary of an employee of a company.
  • Book cover image for: Computer Programming NQF4 Student's Book
    • S Sasti D Sasti(Author)
    • 2020(Publication Date)
    • Troupant
      (Publisher)
    1 Module 1 Topic 1: Object-oriented programming Basics of object-oriented programming Module 1 Overview At the end of this module, you will be able to: • Unit 1.1: Differentiate between object-oriented programming and procedure-oriented programming. • Unit 1.2: Explain the basic principles of a class and an object. • Unit 1.3: Differentiate between the different types of methods in a class. • Unit 1.4: Explain the basic principles of information hiding, inheritance, polymorphism, encapsulation and abstract data types. • Unit 1.5: Design UML class diagrams to solve simple problems. Introduction In PCP Levels 2 and 3, we briefly introduced you to object-oriented programming (OOP). You also learned that VB.Net is a 4GL programming language which uses OOP. In this module, we will introduce you to OOP in greater detail, explain how it works and what the benefits are of using it in programming. In Module 2, you will learn how to implement OOP in VB.Net to solve problems. Unit 1.1: OOP versus procedure-oriented programming Programming uses logic skills to create applications which solve problems. There are many approaches a developer can use to create these applications. In PCP L2 and L3, you learned about structural and procedural programming techniques. This year, you will learn about object-oriented programming and scripting. Figure 1.1 shows different programming techniques. Functional Programming techniques Procedural Logic-based Scripting Structural Object-oriented Figure 1.1: Programming techniques 2 Topic 1 1.1.1 Procedure-oriented programming (POP) Definition: Procedure-oriented programming (POP) Procedure-oriented programming (POP) focuses on processes that we apply to the data to produce the required outcomes from the given inputs. Procedure-oriented programming was developed in the 1970s and is still in use today. This is a structured approach that works well for small stand-alone applications.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.