PLC Session 9

This sessions was brought by our friend’s group that talked about Object oriented programming, This session is divided into some topics.

  • Introduction
  • Object-Oriented Programming
  • Design Issues for Object-Oriented Languages
  • Support for Object-Oriented Programming in C++
  • Implementation of Object-Oriented Constructs

Languages that support object-oriented programming now are firmly entrenched in the mainstream.Some of the newer languages that were designed to support object-oriented programming do not support other programming paradigms but still employ some of the basic imperative structures and have the appearance of the older imperative languages. Among these are Java and C#. Let’s move on to the next topic which is Object-Oriented Programming.The concept of object-oriented programming had its roots in SIMULA 67 but was not fully developed until the evolution of Smalltalk resulted in Smalltalk 80. We also knew that A language that is object oriented must provide support for three key language features: abstract data types, inheritance, and dynamic binding of method calls to methods. We will discuss inheritance first and pass the abstract data type remembering that we have discussed the topic before. Inheritance offers a solution to both the modification problem posed by abstract data type reuse and the program organization problem .The following are the most common differences between a parent class and its subclasses :
1. The parent class can define some of its variables or methods to have private access, which means they will not be visible in the subclass.
2. The subclass can add variables and/or methods to those inherited from the parent class.
3. The subclass can modify the behavior of one or more of its inherited methods. A modified method has the same name, and often the same protocol, as the one of which it is a modification.

If a new class is a subclass of a single parent class, then the derivation process is called single inheritance. If a class has more than one parent class, the process is called multiple inheritance. When a number of classes are related through single inheritance, their relationships to each other can be shown in a derivation tree. The third characteristic (after abstract data types and inheritance) of object oriented programming languages is a kind of polymorphism provided by the dynamic binding of messages to method definitions. This is sometimes called dynamic dispatch. If a client of A and B has a variable that is a reference to class A’s objects, that reference also could point at class B’s objects, making it a polymorphic reference. One purpose of dynamic binding is to allow software systems to be more easily extended during both development and maintenance. There are some design issues with Object oriented programming that will shown below

  • The Exclusivity of Objects
  • Question regarding subclass and subtype
  • Single and Multiple Inheritance
  • Allocation and Deallocation of Objects
  • Dynamic and Static Binding
  • Nested Classes
  • Initialization of Objects

Next topic is about Support for Object-Oriented Programming in C++ . C++ was the first widely used object-oriented programming language, and is still among the most popular. So, naturally, it is the one with which other languages are often compared. We learned that All C++ objects must be initialized before they are used. Therefore, all C++classes include at least one constructor method that initializes the data members of the new object. Constructor methods are implicitly called when an object is created. If a class has a parent, the inherited data members must be initialized when the subclass object is created. To do this, the parent constructor is implicitly called. A C++ object could be manipulated through a value variable, rather than a pointer or a reference. (Such an object would be static or stack dynamic.) However, in that case, the object’s type is known and static, so dynamic binding is not needed. Also C++ does not allow value variables (as opposed to pointers or references) to be polymorphic. When a polymorphic variable is used to call a member function overridden in one of the derived classes, the call must be dynamically bound to the correct member function definition. And the last topic is Implementation of Object-Oriented Constructs.In C++, classes are defined as extensions of C’s record structures—structs. This similarity suggests a storage structure for the instance variables of class instances—that of a record. This form of this structure is called a class instance record (CIR). The structure of a CIR is static, so it is built at compile time and used as a template for the creation of the data of class instances. Also, methods in a class that are statically bound need not be involved in the CIR for the class. However, methods that will be dynamically bound must have entries in this structure. Such entries could simply have a pointer to the code of the method, which must be set at object creation time. Calls to a method could then be connected to the corresponding code through this pointer in the CIR

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *