Table of Contents
what is a computer program?
what is a computer program? Computer programs can be interpreted as a set of commands that can be used to direct computer to perform a certain task. There are many types of software or programs but the major category includes operating system utilities and application software. Modules and sub modules are used to develop a program and these modules are typically stored in the form or files. A big software usually contains thousands of files and each of them performs a particular task for example a window base software usually contains below mentioned files:
• Executable files
• Dynamic link library files
• Initialization files
• Help files
• Batch files
A software is mainly used to run hardware people buy software to run their hardware for performing various activities.
The instructions writing in the software’s by computer programmer is called code. A computer code is written in one of the high-level languages that are available in market like:
• C language
• C++ language
• Java script
• PHP etc.
2. Machine Code:
Actually, computer only understands the language of 1 and 0 which are also called binary digits but to handle the binary digits by humans is very difficult and sometimes seems to be impossible so the computer scientists develop translators which converts human readable instruction to the machine understandable instructions and vice versa.
3. Programming languages:
The human readable instructions are called high level languages and binary format instructions are called as low-level language and to translate we use compilers that are of two type:
• Interpreter which converts the code in to machine language line by line in to object code file it is slow in speed and errors are reported one by one it means we have to solve first error in order to check if the next one exists or not.
• And compiler which converts the whole set of instructions at once in to executable file which is also called object code and all the errors are reported at once it is faster in speed.
How to plan a Computer program?
Writing a computer program is extremely difficult task to do and if the developer has no basic plan about what to do leads to the failure of written code or a bad program so to tackle this situation programmers use different techniques to make their efforts productive.
1. Program control flow:
There are two methods to solve the program that are following:
1. IPO charts.
2. Flow charts.
IPO charts (input processing output):
The chart has three parts or we can say it has 3 columns in the sequence of input, processing, output as suggested in its name.
• In the first column the inputs that are required are written the programmer filters out all the extra amount of inputs in order to make code writing efficient in leads to cost effectiveness.
• The second part is processing part which is the most difficult one because programmer has to converts the raw input data in to useful output products for this purpose, he/she has to utilize their skills fully and have to implement different types of data structures, algorithms and other programming techniques.
• The last part is output which is the actual product and for which all the effort is done.
What is a flow chart?
The other method of writing an efficient code is flow chart. A flow chart is graphical or picturized format of a program in which the flow of data input output required and processing needed is explained. Flow chart has to be made before the code writing process it basically tells that how that how the instructions are needed to be executed in the accurate order and then the programmer maps the same thing in his code different types of symbols are used in making a flow chart.
After making pictorial representation the next step needed is to make exact and efficient algorithms. Algorithms are the set of instructions that may be finite or infinite to accomplish a fixed task in computer coding algorithms are used in the form of functions and classes that not only reduces the code length but also make it simple to read and understand as well as make the code east to debug if errors are encountered Algorithms can be used to make data structure. Some most common algorithms that we used in c++ programming are:
• Selection sort
• Insertion sort
• Bubble sort
The above-mentioned algorithms are user to sort arrays in ascending and descending order.
• Binary search
• Breadth First Search (BFS)
• Depth First Search (DFS)
The above-mentioned algorithm is used to extract or search data in array and trees.
1. Basic programming:
To understand the OOP concept, we first have to understand the basic programming like basic input output and art hematic operations in which simple mathematical operations can be performed and messages can be displayed on the screen after knowing the basics then we shift towards the functional programming
2. Functional programming:
In functional programming any task can be accomplished by dividing a major problem in to small sub problems and solving those sub-problems individually by making a special function and then integrating all things to have a useful output.
Functions are to be made outside the main body of the programs and can be used anywhere in the program when needed by simply calling them
3. Object oriented programming:
The POP is simply writing the procedure that performs required logical operations on set of data but in object-oriented programming we try to map real life objects in code that contains both data and function that are used to process them. This concept not only reduces the length of code but also ensure the chance of reputation of same code again.
The Object-oriented programming concept makes code faster and easy to execute
Classes and objects are 2 important sides of object-oriented programming
Following pictures describe the difference between classes and object
Also read here