Showing posts with label what is computer language. Show all posts
Showing posts with label what is computer language. Show all posts

Sunday, December 29, 2013

Basic definitions and setup

This section will cover following topics:-
1.What is programming?
2.What is a algorithm?
3.Why learn a Computer Language?
4.What skills programming require?
5.How can you start programming in C?

Skip to 5. if you already know about computer programming.

1. What is programming?
Programming simply means to tell a computer what to do and also how to do it.

2. What is algorithm?
Algorithm  is steps or methods the computer needs to be told to do something. Although there is huge difference between when you teach something to a computer or you teach something to a kid.
Many might argue that computers can accomplish wide variety of daunting tasks without error. So computer is more intelligent than a kid. But sadly it is not. It has to be told everything  (EVERYTHING). If you tell your kid to eat, he will eat, but if you want to tell a Programmable-Robot to eat you will have to tell him to eat through mouth, how to chew, how to gulp, etc, etc. Although computer has no capability to exhibit natural intelligence it successfully does whatever told. It wont tire doing long repetitive tasks all day long and night and wont even ask for salary given you have taught (programmed) it well.

3. Why learn computer language?
Computer do not understand the language of any human being (no english, spanish or french). Although  I am writing this blog, it does not mean computer understands what I write. Although a person who does not know much about computer might argue that whenever he spell a word wrong or make grammatical error computer word processors and editors indicate these flaws and suggest the correct usage. But it does not comes naturally to a computer, it has been programmed to do this.
Computer only understands language of two states or alphabets:the Binary Language of 0 and 1. In terms of electrical signal the flow of current is indicated by 1(up or high signal) and the restriction in flow of current is represented by 0(down or low signal). This language is also known as Low Level Programming Language or machine language.
But it will be tedious task to instruct a computer by remembering and writing long series of  0 or 1 for various instructions. Therefore computer programmers thought of solutions to make life simpler for themselves and other programmers through compilers and interpreters. Suppose you want to communicate to a polish guy and you don't know the polish language. You will hire a interpreter to communicate who is well versed in both english and polish. Voila! Problem sovled.
Similarly compilers and interpreters are programs which convert source code written into machine language. You write PRINT("Hello") which when converted into machine code say 1010101010 and basically prints Hello on monitor.
High level Languages consist of variables, symbols and special keywords resembling to common english words (for example print, if else) and a proper defined way of usage of keywords which are converted into machine language by compilers or interpreters. If the guidelines are not followed in usage of keywords then syntax error occurs. So, learning a High Level Language simplifies our task of  instructing a computer but we do need to remember its grammar/syntax.

4. What skills programming require?
Programming requires knowledge of programming language and algorithms. There are loads of programming languages which are suited for variety of work for example- Fortran was developed for Scientific Calculation purpose Lisp is a language designed for ease of writing AI(Artificial Intelligence) Programs. There can be million solutions to a problem but there will definitely be a "good" solution. There can be variety of parameters on which you can call a solution good. A solution can be good if it requires less resources. Resource can means less storage space, less lines in programs(less line of code), or less time to give result. Through programming one can find a solution to problem and then enhance the solution to form a better one.

5.  How can you start programming in C?
There are variety of compilers for C but i would be using GCC compiler.
If you are using Linux operating system (such as ubuntu), it already has a GCC compiler.
If you are using Windows then i would recommend  downloading MinGW.http://sourceforge.net/projects/mingw/
 A text editor will also be required for writing the code(program). One can use built-in Text Editor Notepad of Windows. But the editor is very basic. It will be more convenient to download Notepad++ http://notepad-plus-plus.org/download/v6.5.2.html 
Most developer use Linux platform native editor called "Vim" which is bit complex and requires some learning.Vim can be downloaded for Windows at  http://www.vim.org/download.php

I will be using gcc compiler and Vim Editor on Windows OS.

Setting Up MinGW
1.Download the MinGW from the address provided http://sourceforge.net/projects/mingw/
2.Extract the files to a folder say - C:\Program Files\CodeBlocks\MinGW
3.Now set the path in Environment Variables to C:\Program Files\CodeBlocks\MinGW\bin
Left click on My Computer>Properties>Advanced System Setting>Environment Variables
Click on Path under System Variables and append this to the already existing paths after adding a semicolon(;) C:\Program Files\CodeBlocks\MinGW\bin;