
Introduction to Programming
Programming is a process to communicate with electronic devices like computers, phones, etc. As a beginner, you might find programming a bit overwhelming.
But with consistent practice, you will learn programming, and you will find yourself creating your own applications, websites, and even solving real-world problems.
Table of Contents
Why do we need to learn Programming?
Suppose You want to communicate with other person in Real-Life then you need to speak in the language that other person can understand likewise if you want your computer to perform some task like adding two numbers then you need to give your computer a sets of instructions.
Now the problem is the computers only understands Binary Language (0 and 1). Because the computer works on electricity and uses electrical circuits inside. So when the power passes from Electrical circuits we represent it as 1 and when we don’t have any power passes from Electrical circuits we represent it as 0, That’s Why computers only understands binary language.
Suppose You want to communicate with another person in Real-Life then you need to speak in the language that the other person can understand.
likewise, if you want your computer to perform some task like adding two numbers then you need to give your computer sets of instructions.
Now the problem is the computers only understand Binary Language (0 and 1). Because the computer works on electricity and uses electrical circuits inside.
So when the power passes from Electrical circuits we represent it as 1 and when we don’t have any power passes from Electrical circuits we represent it as 0, That’s Why computers only understands binary language.
So the problem is for us humans it’s hard to understand Binary Language (100110011). So That’s to fulfill this gap between humans and computers We Introduce Programming Languages.
What is a Computer Program?
A program is a piece of code or set of instructions that tells a computer how to perform a task. Let’s understand it by an Analogy A Computer program is like a recipe that contains all the instructions on how to perform a specific task.
A computer is like a cook that reads all the instructions and a executes a task for us. A recipe is a list of instructions for a cook to follow and a program is a list of instructions for a computer to execute.
Programming Methods
Programming methods are approaches or techniques used to write, structure,
and manage code effectively. Below are some common programming methods:
- Procedural Programming:
- Definition : In Procedural programming, Problem is broken down into small blocks of code that perform one task each. These small blocks of code are also know as functions. So in Procedural Programming we use functions to reuse the code.
- Characteristics:
- Uses Functions to organize code
- Sequential code execution
- Reusability and Modularity
- Languages: C, PASCAL, BASIC
- Example:
#include
int main() {
int number1, number2, sum;
printf("Enter two integers: ");
scanf("%d %d", &number1, &number2);
// calculate the sum
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}
2. Object-Oriented Programming (OOP):
- Definition : Object-oriented programming (OOP) is defined as a programming paradigm built on the concept of objects, which contains properties and methods.
- Characteristics:
- Uses class and Object Concept
- Modularity
- Reusability
- Security
- Flexibility
- Languages: JAVA, Python, C++, etc.
- Example:
class Avenger {
String name;
int power;
}
public class Main {
public static void main(String[] args) {
Avenger ironMan = new Avenger();
ironMan.name = "Iron Man";
ironMan.power = 80;
}
}
3. Functional Programming:
- Definition : Functional programming is a programming paradigm in which we try to bind everything in pure mathematical functions. It is a declarative style. Treats computation as the evaluation of mathematical functions and avoids changing state or mutable data.
- Characteristics:
- Emphasizes immutability and stateless functions.
- Encourages concise, expressive code.
- Languages: Python, Haskell, Scala, etc.
- Example:
def square(x):
return x * x
numbers = [1, 2, 3, 4]
squares = map(square, numbers)
print(list(squares))
4. Declarative Programming:
- Definition: Declarative programming is a programming style that focuses on what a program should do, rather than how it should do it.
- Characteristics:
- Specifies the desired result without explicitly coding the control flow.
- Abstraction
- Context independence
- Concise
- Readable
- Maintainable
- Languages: SQL, Prolog.
- Example:
SELECT name FROM students WHERE grade > 95;
Popular Programming Language
- JavaScript
- Java
- Python
- Kotlin
- C++
- C#
- TypeScript
- Swift
- PHP
Benefits of Learning Programming Language
Learning anything new can be a bit difficult at starting but once you start doing it daily it will become easier, Same goes with programming at starting programming feels horrifying but once you start doing it daily it will become a fun process and over the period of time you can master The art of Programming. Here are some benefits of learning a programming language:
- It will improve your logical thinking and analyzing skill
- It will help you think out of the box by allowing you think about the problem from a different perspective
- It will help you professionally by learning programming language you can get increase in your salary
- It will help you to build your focus in such a way that small details will matter to you. You will pay attention to the small details.
What is Algorithm?
In Formal Words Algorithm is a set of steps to accomplish a task. In computer science an Algorithm is a finite sequence of steps to solve a coding problem, Like Here is an example of an Algorithm for adding two numbers.
What is Flowchart?
Flowchart is a graphical representation of an Algorithm Here is an Example of a flowchart for which number is greater:
If you find this content Helpful feel free to Enroll in our Android Development Course with Kotlin contact us for more information