7 Programming Concepts Everyone should Know
Hi Folks , Hope you all programming geeks are doing good. Today, we will discuss about the basic programming design principles and concepts that everyone should be aware about while developing a software . Well, Software Development ain?t easy. Programming/coding can be a real daunting task if not done in the right way. Hope you guys will like this post . So, without wasting time lets get started . [ i will be using JavaScript in here but you can use whatever language you are comfortable with ! ]
In this post, we will discuss about :
- Classes and Objects
- Constructors
- Static Methods
- Recursion
- Loops
- OOPS
- Libraries/Modules/Packages (All mean the same thing)
Classes and Object:
A class is a blueprint for creating objects . It has member functions and member variables . and an object is an instance of class . One can access class member functions and variables with the help of object .
Constructor :
It is a special method that is used to initialize the newly created object and is called just after the memory is allocated by the object.
source : https://gist.github.com/karanjagota/3fbbb2e8fdc28d5231d9fd3194fa7ac1
Static Methods / Static Functions
They are indeed one of the most important methods that i use . They belong to the class itself. They can be used without the instance (object) of a class. They don?t modify the behaviour of our class but is very powerful when want to view certain data etc Just add static in-front of a function .
Recursion :
Recursion is a technique where a function calls itself . Their is a termination condition called the base condition which stops the recursive action .
source : https://gist.github.com/karanjagota/96efdd7351812fd568cd219951f2d0c8
Loops :
Loops in programming languages is a feature which facilitates the execution of a set of instructions repeatedly while some condition evaluates to true.
source :https://gist.github.com/karanjagota/a70b86d24b30d41e8283a5569305f3ea
OOPS (Object Oriented Design)
It is a methodology or paradigm to design a program using classes and objects. Main Components of OOPS are Encapsulation , Abstraction , Inheritance and Polymorphism . Lets look at them closely ?
Encapsulation: Encapsulating every thing about an entity inside a class. ie. Putting functions and data members inside a class.
Abstraction: Abstraction is a very important concept in oops . It simply means that you are hiding the important things inside the class and provides only the necessary or relevant information that you want to show through a object . (It hides the details of implementation)
Inheritance : It is a concept where a class acquire properties of a child class . We can extend this child class and use already defined methods that are in the base class / Parent class . The main purpose of inheritance is to provide reusable code and help you achieve DRY
source : https://gist.github.com/karanjagota/1811a5e29eea42cb0d8af38db1996634
Polymorphism: It generally means ability to take many forms . There are generally 2 types of Polymorphism ? compile time and run time .
- Compile time : Function Overloading is an example of compile time polymorphism. Same function name different parameter data types .
- Run time : Function Overriding is an example of run time polymorphism . Let?s look at an example.
source : https://gist.github.com/karanjagota/9f780c9deed338ae1f8504577f895cc8
Library / Package / Module (All mean the same thing ):
It is just a function or list of functions that are wrapped around or are written for repetitive work . Generally, SDE either worked with libraries or they create their own . Automating the boiler plated code .[ Most Important ]. Every programmer should know how to create a library else he would spent a lot of time in writing same code again and again and again and again ?.
JavaScript Essentials (concepts + code) for frontend and backend developers
JavaScript was-is&-will always be the first language of choice for developing front-end of any web application. We all?
medium.com
That?s it for this post. I hope you liked it . Once again, thank you for taking your time and reading this post. Good bye | Take Care | and keep coding ..
and Don?t forget to Clap Share and Follow .