Friday, October 20, 2023

Introduction to Object Oriented Programming

Introduction to Object Oriented Programming

     








Programming Paradigm

Programming paradigms are different ways or styles in which a given program or programming language can be organized. Each paradigm consists of certain structures, features, and opinions about how common programming problems should be tackled.       

You can gain more idea through the given resource >> https://www.freecodecamp.org/news/an-introduction-to-programming-paradigms/ 

There are some popular paradigms 

  •     Object Oriented
  •     Procedural
  •     Event-Driven
  •     Functional
  •     Logic 
  •     Aspect Oriented
    

  There are some languages which support only for one paradigm. ex: SmallTalk
  As well as there are languages which support multi paradigms. ex: Java, Python,                 JavaScript, Ruby. 

  Multi paradigm support language codes can be implemented using two or more            paradigm for a single program. 

  In here, we focus on Object Oriented Programming Paradigm.

  We can't say what is the best paradigm. It depends on our problem, budget and many other   things. So, based on our work we have to choose what is the best paradigm. 

  What is an Object ????

   Object is a combination of Data (State) and Methods (Behavior).

  Benefits Of OOP 

  •     Reduced Complexity
  •    Easier Maintenance
  •    Code Reuse
  •    Faster Development

    Class and Object ???

    


   Class is a blueprint for creating objects.
   Object is an instance of a class

   Let's say car is a class. We can create some car object using that car    class. 

   Class = Car
   Objects = Car1, Car2, Car3, ....

   Every class has fields and methods. Fields means data of the class.    Methods means behavior of the class.

    
   If we think car class, it can be included a color, year, brand,              currentGear, currentSpeed etc. Those data can be called as data or    states. 

   ex: Let's think Car1 object has color:red, year:2023, brand:BMW,             currentGear:2, currentSpeed:90. 

   changeGear(), changeSpeed() are methods which means behavior.

   ex: When we call a method, the data will be changed. If we call             changeGear() method, then the gear can be changed from 2 to             other.
    
   
   If you enjoy my article, Share your ideas in the comment section..
   Thank You!!
    
    

   

   





  








Introduction to Object Oriented Programming

Introduction to Object Oriented Programming       Programming Paradigm Programming paradigms are different ways or styles in which a given p...