GithubHelp home page GithubHelp logo

oop-essay's Introduction

Object Oriented Programming Write-Up

The point of Object Oriented Programming seems to be the ease with which it allows the user to store and manipulate large chunks of data. In the context of Javascript, this usually refers to classes, which are templates for how other similar objects, called instances, should be organized. Another reason to use OOP is what’s known as encapsulation; basically, by writing code in isolated chunks it prevents changes in one part of the code from breaking all the rest of it. Each object, or class of objects, is encapsulated within itself, allowing for cleaner and safer code to be written. Also allowing for clean and safe code is a process called abstraction. Abstraction takes all of the complicated and messy information and returns just the important and relevant data about an object to make everything easier to read and more efficient. It boils down a set of data to just the most important bits for the user to see, without all of the unnecessary details getting in the way. Object Oriented Programming has another benefit called polymorphism. Polymorphic code is code that allows many different types of code to ‘plug and play’. In other words, if code is written with a compatible interface, polymorphic code will accept it no matter what type of code you have. This is extremely useful for cutting down on the amount of code needed and for troubleshooting bugs, as you only have one set of code to test. 

One of the nice things about creating a class in OOP is that you can create subclasses or instances of that class with a process called inheritance. With the inheritance process you can pass on the ‘characteristics’ of the class to its instance so that you don’t have to redefine the same variables behaviors over and over in each instance of the class while still being able to create unique methods for that instance. All you have to do is define your shared variables within the constructor function of the class object, then define a super(variable) within the instance’s constructor function. A constructor function just takes in the shared variables and sets them to a default. Some of the methods unique to OOP are called getters and setters. Going back to idea of abstraction, these methods control exactly how abstraction is accomplished. They are functions that run discretely whenever an object is called on that work to hide the excess or private information. 

All of these things taken together, and specifically the ideas of encapsulation, abstraction, inheritance, and polymorphism, form the pillars of OOP. Without them the entire idea behind OOP falls apart, and we’re left with a mess of broken code and disorganized data. And no sane person wants that!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.