What is programming?
Computer programming is a method or process in which you write instructions for a computer. A computer performs a task by following these instructions. That is, the way you teach something to a child and the child understands those things and acts on it. So you can say you programmed the child. I am giving the example of a child because a child does not understand things beforehand. Then gradually we teach him and explain. In the same way, the computer is also a child who does not understand anything. It is just a box of iron and plastic. This will teach you things. After that he will be able to do any work. It is generally seen that we do not teach the computer anything. We get a brand new computer and everything is already there. But it is not so. Those pre-existing things are also taught to computers by humans. These people are called software developers.
And the things that are taught to the computer are called programs or software.
But now the question arises that how to teach the computer? This is called programming.
Look at how we humans talk to each other and share information with each other.
Similarly, we can talk to the computer and tell it what to do. how to do
How to put two and two together. How to display an image How to play video How to connect with internet etc.
These are the things we write (code) in the computer. And the computer reads it and acts accordingly.
Computers do not understand human languages. Urdu, Arabic, English etc. Special languages have been created for this. This means that computer experts or software engineers have come up with code words in which the computer can understand and follow by writing words. These code words are called programming languages.
Many programming languages have been created. Each programming language has its own scope and purpose. Meaning the mobile app will have a separate language. Website Kale Alag etc
However, some languages are also general purpose. which can have more than one function.
Following are some of the top programming languages in the world.
Java, python, javascript, C, C++, C#, swip, kotlin, dart ... etc
Your mobile has a calculator app or a video player or a game. Behind all these are the same programming languages which your mobile follows to run calculus, video or any game.
Below is a simple program that is basically written like this in all programming languages. There will be a slight change in the writing style but you can get an idea of a program from it
This program adds two numbers and displays them on the screen.
number1 = 10;
number2 =20;
result = number1 + number2;
Print(result)
Then let's look at some different programming. Meaning, as many programming languages exist, programming is also done in different ways.
For example, there is a problem and you want to solve it with a computer, that is, if you want to create a software solution for it, then different programming methods are used for it.
۔1۔ Procedural Programming
Codes are written in procedural programming. For example, if you want to write a program that adds two numbers and displays the result on the screen. So the code for this would be something like this.
number1 = 10;
number2 = 20;
result = number1 + number2;
Print(result)
This code will work like this.
The first line will take a number and put the value of 10 in it
will take the second number in the second line and put a value of 20 in it
In the third line, a third number will be taken as the result, in which the sum of number 1 and number 2 will be added.
The value of the result name number in the touching line will print on the screen.
In this type of programming we write a series of codes which the computer follows step by step to solve the problem. This is one of the old ways of programming. We can also call it straight forward programming. This is good for problems where the work is done in a simple and straightforward sequence. But as the problem gets bigger, procedural programming becomes difficult and managing the code is also very difficult. Therefore, procedural programming is rarely used in large software development.
For procedural programming
C, Pascal, BASIC
Programming languages are used.
۔2۔ Functional Programming
The problem in programming is that in some places a task has to be repeated. For example, take the above example. If you are in a situation where you have to add these two numbers repeatedly, you will have to write the same code over and over again. Which will take more time and effort. So functional programming for this is a method in which we will create a separate block of code and give it a name. This block is called a function. Then whenever we need this code, instead of writing the entire code, we will just write the name of the function
In the above example we can do something like this using a function.
addNumbers(num1, num2)
result = num1 + num2;
Print(result)
It became a function. Now whenever we want to add two numbers, we just write the name of the function along with the name and tell it the two numbers to be added. The rest collection and display function will handle.
addNumbers(10, 20)
addNumbers(7, 2)
addNumbers(11, 28)
Now we don't need to write a lot of code again and again to compile. Just one line can do the same thing.
For functional programming
Haskell, Scala, Clojure
As languages are used. But you
java, python, C,
Can also do functional programming in other languages.
۔3۔ Object Oriented Programming OOP
In this type of programming, we treat objects like real-world objects. This style of programming is used to create large software. This method is used in almost every major software nowadays. Be it a mobile app or a website or a game.
A separate block of code is created in it. What we call class. Then the object data within that class is taken. Then functions are created according to the object in the same class. We can do the above example in object and class form something like this. It will add addition as well as multiplication functionality to understand little objects.
class Calculator
Number1 = 10;
Number2 = 20;
addNumbers()
result = number1 + number2;
Print(result)
multiplyNumbers(){
result = number1 * number2;
Print(result)
Here we have created a calculator class. Calculator is a real object. Thus we create an object of it in programming. In the code below we create its object.
Calculator calcObj = Calculator();
now
calcObj
We can use addition or multiplication function by using .
calcObj.addNumbers();
calcObj.multiplyNumbers();
Anyway
Object oriented programming
It's a huge concept and difficult to explain in the form of a post. But hopefully you got a bit of an idea.
Apart from this, there are other programs. Like
Event Driven Programming, Declarative Programming ... etc
Finally, there is more than one paradigm used in today's software development. Procedural, object oriented, functional and event driven are used side by side in the same software.
Comments
Post a Comment