OOPs

OOPs

As the name suggests,?Object-Oriented Programming?or OOPs refers to languages that use objects in programming, they use objects as a primary source to implement what is to happen in the code. Objects are seen by the viewer or user, performing tasks assigned by you. Object-oriented programming aims to implement real-world entities like inheritance, hiding, polymorphism etc. in programming. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.?

Let us discuss prerequisites by polishing concepts of method declaration and message passing. Starting off with the method declaration, it consists of six components:?

  • Access Modifier: Defines the?access type?of the method i.e. from where it can be accessed in your application. In Java, there are 4 types of access specifiers:?
  • public:?Accessible in all classes in your application.
  • protected:?Accessible within the package in which it is defined and in its?subclass(es) (including subclasses declared outside the package).
  • private:?Accessible only within the class in which it is defined.
  • default (declared/defined without using any modifier):?Accessible within the same class and package within which its class is defined.
  • The return type: The data type of the value returned by the method or void if it does not return a value.
  • Method Name: The rules for field names apply to method names as well, but the convention is a little different.
  • Parameter list: Comma-separated list of the input parameters that are defined, preceded by their data type, within the enclosed parentheses. If there are no parameters, you must use empty parentheses ().
  • Exception list: The exceptions you expect the method to throw. You can specify these exception(s).
  • Method body: It is the block of code, enclosed between braces, that you need to execute to perform your intended operations.

Message Passing:?Objects communicate with one another by sending and receiving information to each other. A message for an object is a request for execution of a procedure and therefore will invoke a function in the receiving object that generates the desired results. Message passing involves specifying the name of the object, the name of the function and the information to be sent.

Object-oriented programming?(OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic.

Object-oriented programming?has a sweeping impact because it appeals at multiple levels and promises faster and cheaper development and maintenance. It follows a bottom-up approach to develop applications.

An object is referred to as a data field that has unique attributes and behavior. Everything in OOP is grouped as self-sustainable objects.

It is the most popular programming model among developers. It is well suited for programs that are large, complex, and actively updated or maintained. It simplifies software development and maintenance by providing major concepts such as?abstraction, inheritance, polymorphism, and?encapsulation. These core concepts support OOP.

Pillars of OOPs

The major concepts that we have discussed above are known as?pillars of OOPs. There are?four?pillars on which OOP rests.

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

要查看或添加评论,请登录

Anjali Kumari的更多文章

  • Blockchain Technology

    Blockchain Technology

    For all you’ve probably heard about Bitcoin, Ethereum, and other cryptocurrencies lately, many financial experts say…

  • Apache Airflow

    Apache Airflow

  • STLC

    STLC

  • DBI SQL

    DBI SQL

  • Azure Data Factory

    Azure Data Factory

  • Backend Developer

    Backend Developer

    What Is The Role Of A Back-End Developer The back-end developers generally work along with the front-end developers as…

  • DAX

    DAX

    What is DAX DAX stands for Data Analysis Expressions, it is language developed by Microsoft to interact with data in a…

  • GitHub

    GitHub

    GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on…

  • JIRA

    JIRA

    A Jira 'issue' refers to a single work item of any type or size that is tracked from creation to completion. For…

  • Data Repository

    Data Repository

    Data Repository: Types, Challenges, and Best Practice The importance of data is growing as everyone uses data to make…

社区洞察

其他会员也浏览了