Computer programming also known as programming, is a process that leads from an original formulation of a computing problem to executable computer programs.
Computer programming is the designing and writing of computer programs, which includes a wide variety of different tasks and techniques.
Programming involves activities such as analysis, developing understanding, generating algorithms, verification of requirements of algorithms including their correctness and resources consumption, and implementation commonly referred to as coding of algorithms in a target programming language.
Just like human languages, programming languages also follow grammar called syntax. There are certain basic program code elements which are common for all the programming languages.
We will be outlining the important basic elements for programming languages:
Variable
In programming, we have a way of storing values so that we can reuse them throughout our program or change them, if necessary. This concept is known as a variable.
Variables are containers for storing data values, a memory location for a data type. Variables are created using a declaration or keyword that varies across languages.
Variable names are usually alphanumeric, that is, they contain a-z and 0-9. They can also include special characters like underscore or the dollar sign.
Variables can hold values of any data type supported by the programming language. This value may change during program execution.
Basic Syntax
Syntax refers to the set of rules that define the structure of a language. It is almost impossible to read or understand a programming language without its syntax.
Every programming language has its syntax, and you must learn the fundamental syntax of the language you are learning.
Data Types And Structures.
Data types refer to the classification of data. The most common data types include: String, Boolean (true or false), Numbers which includes integers and floating-point numbers, characters which includes single alphabets or numbers, arrays, a collection of data, usually of the same data type.
A Data Structure is a collection of data values. These structures include operations that can be applied to that data. Data structures are important in computer programming for organizing, managing, and storing data quickly and efficiently.
Some common types of data structures include: Linked lists, heaps, stacks, queues, graphs, tables, trees, arrays, etc.
Flow Control Structures
Flow Control Structures are the fundamental components of computer programs. They are commands that allow a program to decide, to take one direction or another.
There are three basic types of control structures: sequential, selection, and iteration.
1. Sequential
The most basic control flow is sequential control flow. It involves the execution of code statements one after the other. A real-world example is following a cooking recipe.
2. Selection
The basic premise of selection flow control is, the computer decides what action to perform based on the result of a test or condition equalling true or false.
3. Iteration or Loops
A loop is a programming structure that allows a statement or block of code to be run repeatedly until a specified condition is no longer true (will return Boolean, true or false). It is one of the most powerful and fundamental programming concepts.
Functional Programming
Functions are containers that take in a set of inputs and return an output. It is not required for a function to return a value. Pure functions will always give the same result for the same set of inputs.
Functional Programming is a straightforward method of building software that involves using pure functions. This method eliminates the occurrence of data mutation or side effects.
Object-oriented Programming
Object-Oriented Programming (OOP) is a programming concept that revolves around ‘objects’ and ‘methods’.
There are four principles of OOP which includes Inheritance, Abstraction, Encapsulation and Polymorphism.
Debugging
Debugging is a crucial skill. It involves detecting and removing existing and potential errors, defects, or ‘loopholes’ in one’s code.
IDEs And Coding Environments
IDE stands for Integrated Development Environment – they are applications programmers use to write code and organize text groups. It increases a programmer’s efficiency and productivity, and has added features like code completion, code compilation, debugging, syntax highlighting, etc.
Some common examples of IDE’s are Visual Studio code, Eclipse, IntelliJ IDEA, NetBeans
Always remember to write clean, readable codes.
The Different Programming Paradigms That Exist
We don’t just have different programming languages, we have different programming paradigms, and the most popular and well known ones today are procedural programming, functional programming and object oriented programming
Procedural programming
In procedural programming, the name comes from “procedure”, Which literally means doing something, using specific instructions, executed in order. Procedural programming, code is executed in a linear way from the beginning to the end. You tell the computer what to do, from start to finish, and it does.
This is the most familiar kind of programming, thinking about it from a beginner’s perspective. We all imagine code being something like a list of things you tell the computer to do. C is a good example of a procedural programming language.
Functional programming
Functional programming takes an approach to programming that derives from math functions. It’s the simplest way to tackle a complex problem and get to a solution. And JavaScript is perfectly equipped to perform functional programming (FP). In FP, you organize code in little functions, and every function returns a result that is always the same, given the same inputs. Same inputs = same outputs. This is an essential point. Functions can be composed, passed as arguments, and function operations like recursion allow us to solve all the problems without creating complex structures for our abstractions.
Object oriented programming
Object oriented programming is a different beast. We try to model the domain of the problem at hand using objects. Objects have a type, which is called class. Object oriented programming, or OOP, was made popular by Smalltalk and later by Java. Programs written using an OOP methodology are more abstract than a list of things the computer must do. We think in terms of objects, and the interactions between them