Wednesday, 5 June 2019

What is programming language and algorithms.



Programming Language : 
        We use native languages like English, Marathi, Hindi etc. to communicate 🗣 with each other. but how we can communicate with computer ? 🤔  How we can accomplish our work from computer ? 🤔
   
        Computer 💻 is just a mechanical device and has no intelligence like human have. It works accordingly to the algorithm provided by computer programmer. 🤓

        As we understand native languages; computer understands programming languages. There are many programming languages and the popular among them are C, C++, Java, Python etc.

        Programming language consists of set of instructions; 📝 with these instructions computer program produces output.
         Programming languages are mainly classified into two types, low level languages and high level languages.

Low level languages :
        Did you ever think why we use decimal number system in our daily life? 🤔 It's because we all have 10 fingers. 😊 Our ancestors used fingers for counting and calculating. so it's natural to adopt this number system in our daily life.
        In a same way computer have transistors with two states (ON or OFF). Computer is made up of electronic circuits and those circuits can do nothing more than passing electricity. 😮 This electricity have two states ON and OFF (presence and absence of electricity). These two states are represented by 0 and 1 and known as binary language or machine language of computer.
        Machine code (stream of 0's and 1's) is directly implemented on CPU (Central Processing Unit). that's why time taken by machine code to execute is very small as compared to other languages; but machine code is difficult to understand and write. 😧
        Assembly language is also type of low level language in which programmers work only with operations. Assembly language have set of commands like ADD, MOV etc. Assembly language is still useful when speed is necessary or when we need to carry out an operation which is not possible in high level languages.

High level languages :
        Do you ever think why we invent things ? 🤔 We invent because we want to make things easier. for example we invented bicycle 🚲 or bike 🏍 because we want to go faster from one destination to another than walking 🚶or running 🏃‍. but we didn't stop there we again invented car 🚗 because we wanted more comfort while travelling. So making thing easier is in the nature of the human being. In a same way we developed high-level programming languages for the ease of writing programs.
        High level programming language is generally written using English keywords and that's why it's easy to understand and write. High-level languages takes more time 🕰 to produce output than low level languages because high level languages need to be converted into low level languages using compiler or interpreter. (I will make a separate post on compiler and interpreter)



Algorithm :  
        An algorithm is a set of instructions designed to perform specific task.
        In our daily life we also use algorithms to do specific task to get desired output. You may know how to make a tea, ☕ for making a tea we use following algorithm :


  • Step 1 : Turn on burner. 🔥
  • Step 2 : Take a pan and add water, tea leaves and sugar to it. 
  • Step 3 : Heat the tea until it turns a reddish brown colour. ♨
  • Step 4 : Add milk to the mixture. 🍼
  • Step 5 : Stop the burner when the milk rises to the top of the pan.
  • Step 6 : Filter all the solid out (tea leaves).
  • Step 7 : Serve Kadakk chai (hot tea). ☕😋

In a same way we can have algorithm (step-by-step procedure) to perform addition of two numbers given by user :

  • Step 1 : Start
  • Step 2 : read two numbers.
  • Step 3 : Perform addition of numbers given by user.
  • Step 4 : Display addition.
  • Step 5 : Stop.
Next post will be on "Introduction to Python" 🤗


Click here 👈 to add yourself to the Google group so you don't miss any updates.

3 comments: