1. Programming – Basics
This is Part 2: Computer Programming…
In this Article We Will discuss about below topics:
1.1. Basic of Programming.
1.2. Programming Environment.
I assume you are well aware of English Language, which is a well-known Human Interface Language. English has a predefined grammar, which needs to be followed to write English statements in a correct way. Likewise, most of the Human Interface Languages (Hindi, English, Spanish, French, etc.) are made of several elements like verbs, nouns, adjectives, adverbs, propositions, and conjunctions, etc. Similar to Human Interface Languages, Computer Programming Languages are also made of several elements. I will take you through the basics of those elements and put some effort to make you comfortable to use them in various programming languages. These basic elements are:
• Programming Environment
• Basic Syntax
• Data Types
• Variables
• Keywords
• Basic Operators
• Decision Making
• Loops
• Numbers
• Characters
• Arrays
• Strings
• Functions
• File I/O
I will explain all these elements in subsequent chapters with examples using different programming languages. First we will try to understand meaning of all these terms in general and then we will see how these terms can be used in different programming language.
I believe if you understood above-mentioned elements related to any programming language, then you are almost ready to write big enough programs in that programming language.
I designed this article to give you an idea about the following most popular programming languages:
• C Programming
• Java Programming
• Python Programming
Major part of the article has been explained by taking C as programming language and then I tried to show how similar concepts work in Java and Python. So after completion of this article, you will find yourself familiar with these popular programming languages.
2. Programming - Environment
Though Environment Setup is not an element of any Programming Language,
it is the first thing we need to start programming with any Programming Language.
When we are saying Environment Setup, it simply means we need to have a base on top of which we can do our programming. Thus, we need to have required software setup, i.e., installation on our PC which will be used to write our Computer Program, Compile and Execute it. For example, if you need to browse Internet, then you need the following setup on your machine:
1. A working Internet Connection to connect to the Internet.
2. Web Browser like Internet Explorer, Chrome, or Safari, etc.
Similar way, you will need following setup to start with programming using any programming language.
1. A text editor to create computer program.
2. A compiler to compile program into binary format.
3. An interpreter to execute program directly.
If you are new to the computer, you yourself will not be able to set up either of these Softwares. So, I suggest you take help from any technical person around you to set up programming environment on your machine from where you can start. But for you, this is important to understand what are these items.
* Start Icon → All Programs → Accessories → Notepad → Mouse Click on Notepad *
You can use this software to type your computer program and save it in a file at any location.
You can download and install other good editors like Notepad++, which is freely available.
If you are Mac user, then you will have TextEdit or you can install some other commercial editor likeBBEdit, etc., to start with.
3. What is Compiler?
You write your computer program using your favorite programming language and save it in a text file called program file.
3.1 What is next?
Let's try to get a little more detail on how computer understands a program written by you using a programming language. Actually, computer cannot understand your program directly given in the text format, so we need to convert this program in a binary format, which can be understood by the computer. The conversion from text program to binary file is done by another software called Compiler and this process of conversion from text formatted program to binary format file is called program compilation.
Finally, you can execute binary file to perform the programmed task. We are not going into detail of different constituents of a compiler and different phases of compilation. Following flow diagram gives an illustration of the process:
So,So, if you are going to write your program in any such language, which needs compilation like C, C++, Java and Pascal, etc.,
take then you will need to install their compilers before you start programming in such languages.
4. What is Interpreter?
We just discussed about Compiler and Compilation Process. This is required in case you are going to write your program in a programming language, which needs compilation into binary format before its execution.
Few examples of such programming languages are C, C++, Java.
There are programming languages like Python, PHP and Perl, which do not need any compilation into binary format, rather an interpreter can be used to read such program line by line and execute it directly without any further conversion
So, if you are going to write your program in any such language, which does not need compilation like PHP, Python, Perl, and Ruby, etc., then you will need to install install their interpreters before you start programming in such languages.
5. Online Compilation If you are not able to set up any editor, compiler or interpreter on your machine, then tutorialspoint.comprovides a facility to compile and run almost all the programs online with an ease of a single click. So do not worry and let’s proceed further to have thrilling experience to become a computer programmer in simple and easy steps.