OOPS Basics

Procedural Programming is based upon the concept of the procedure call. Procedures, also known as routines, subroutines, methods, or functions (not to be confused with mathematical functions, but similar to those used in functional programming) simply contain a series of computational steps to be carried out. Any given procedure might be called at any point during a program's execution, including by other procedures or itself. 
The focus of procedural programming is to break down a programming task into a collection of variables, data structures, and subroutines, whereas in object-oriented programming it is to break down a programming task into classes with each "class" encapsulating its own methods (subroutines). The most important distinction is whereas procedural programming uses procedures to operate on data structures, object-oriented programming bundles the two together so an "object", which is an instance of a class, operates on its "own" data structure. OOP uses objects as its fundamental building blocks. Each object is an instance of some class. Classes allow the mechanism of data abstraction for creating new data types. Inheritance allows building of new classes from existing classes. Hence if any of these elements are missing in a program we cannot consider that program as objected oriented program.

Object-oriented programming is a programming methodology that associates data structures with a set of operators which act upon it. In OOP’s terminology an instance of such an entity is known as an object. It gives importance to relationships between objects rather than implementation details. Hiding the implementation details within an object results in the user being more concerned with an objects relationship to the rest of the system, than the implementation of the object’s behavior.

Objects: Objects are the basic run-time entities in an object-oriented system. Every object is associated with data and functions which define meaningful operations on that object.

Important features and concepts of OOPs are listed below;
  • Encapsulation: It is a mechanism that associates the code and the data it manipulates into a single unit to and keeps them safe from external interference and misuse. In C++ this is supported by construct called class. An instance of a class is known as an object which represents a real world entity.
  • Abstraction: A data abstraction is a simplified view of an object that includes only features one is interested in while hides away the unnecessary details. In programming languages, a data abstraction becomes an abstract data type or a user-defined type. In OOP, it is implemented as a class.
  • Inheritance: Inheritance is a means of specifying hierarchical relationships between types C++ classes can inherit both data and function members from other (parent) classes. Terminology: "the child (or derived) class inherits (or is derived from) the parent (or base) class".
  • Polymorphism: Polymorphism is in short the ability to create a variable, a function, or an object that has more than one form. It is a lot useful since it can group classes and their functions together. Polymorphism means that the same thing can exist in two forms. This is an important characteristic of true object oriented design - which means that one could develop good OO design with data abstraction and inheritance, but the real power of object oriented design seems to surface when polymorphism is used.
  • Message passing: It is the process of invoking an operation on an object. In response to a message the corresponding method is executed in the object.
  • Extensibility: C++ allows the extension of the functionality of the existing software components. In C++ this is achieved through abstract classes and inheritance.
  • Persistence: The phenomenon where the object (data) outlives the program execution time and exists between executions of a program is known as persistence. All data base systems support persistence. In C++ it is not supported. However the user can build it explicitly using file streams in a program.
  • Genericity: It is technique for defining software components that have more than one interpretation depending on the data type of parameters. Thus it allows the declaration of data items without specifying their exact data type.
  • Multiple Inheritance: The mechanism by which a class is derived from more than one base class is known as multiple inheritance. Instances of classes with multiple inheritance have instance variables for each of the inherited base classes. C++ supports multiple inheritance.

An Object-oriented programming language is a programming language that represents the elements of a problem as objects, which contain data and behavior. Real-world objects are used to model the state and behavior of real-world entities in your application. Object-oriented languages can be subdivided into categories depending on their particular type of system, also referred to as static or dynamic typing.

  • Java is one of the oldest, most popular, and well-known object-oriented languages. It was designed to be platform-independent and easy to learn, and it has become the primary language used for Android app development. Java also enjoys a strong following in the business world, thanks to its robustness and security features. This is a great programming language for beginners because it is simple to learn, but it can also be used for large projects where reliability is key. Since its release in 1995, Java has gained immense popularity. It is part of the CPU on Mac OS X and every Android device, it powers most websites that use content management systems like WordPress or Drupal, and it’s used to code everything from iPhone apps to video game consoles.
  • C# is a multi-paradigm language developed by Microsoft. It is an object-oriented programming language that also supports functional, imperative, and generic programming paradigms. C# was developed in the early 2000s. It’s very similar to the first language - Java, but it has been designed with the .NET framework, making it a little easier to code for Microsoft platforms like ASP. C# has been gaining importance in the OOP community due to its interoperability with .NET Framework. Furthermore, it can be used to develop Windows desktop applications and Android mobile apps. C# is a good choice for beginners because it’s easy to learn and has strong support from the industry. However, due to its popularity, many online resources can make learning this OOP language easier than other languages.
  • Python: This is a high-level object-oriented programming language that is easy to learn and enables developers to work faster and integrate systems more effectively. It’s a dynamic, interpreted language that emphasizes code readability and supports multiple programming paradigms, including functional, object-oriented, procedural, and imperative. Python is a multi-paradigm programming language built by Guido van Rossum. Python is a good choice for beginners because it is easy to learn and read. It also has a strong community that produces a lot of great resources. It’s a versatile language that can be used for scripting, web development, scientific computing, and more.
  • Ruby is a dynamic, open-source programming language focusing on productivity and simplicity. Developed in the 1990s by Yukihiro Matsumoto, Ruby has an elegant syntax that is natural to read and easy to write. Ruby has an extensive and comprehensive standard library, and its simple design makes it very reliable and portable. One of the best things about this OOP language is its community. The Ruby community is very active, and there are a lot of great resources available online. Safe, object-oriented, and expressive, Ruby is a powerful scripting language that feels natural to program in.
  • PHP is one of the object-oriented programming languages most commonly used to create dynamic web pages and is also a popular programming language in general. Developed by Rasmus Lerdorf in 1995, PHP was designed for web development and is commonly used in conjunction with HTML and CSS. PHP is a good choice for beginners because it’s also easy to learn and has a strong community that produces great resources.

Visit My Blog: http://vinay-kumar-saini.blogspot.in/