Learning to speak to computers!

Good to be back! Forgive me of my sins for I was occupied with interests of my own. 🙂

So apparently my girlfriend is now studying Linguistics and programming can become handy for large dataset analysis and automating some stuffs, so she (who never programmed anything ever) asked me to teach “programming”. I thought for a while and thought it would be fun to teach someone programming from scratch, think about it, it is a “language” too, albeit a “written” one, which is quite similar to the set of instructions that we are accustomed to process.

Someone writes to you,

Find the vowels in the sentence:   “Programming is simple conversation with the machine!”

The word “Find” is a trigger your brain processes to “narrow” down your “attention” to your prior knowledge of vowels, namely “AEIOU”. You can do the same thing to a computer, using its language! Now as humans have developed different language, you can talk to computer using various “languages” which it can understand.

BTW computers mother toungue is just True(1) and Flase(0).

I have been a great fan of the language “Python”, because of its simplicity and user friendliness, so I will stick to that. The main aim of these set of blog tutorials will be 2 fold. Recently I have been interested in NLP, which is Natural Language Processing, and its applications, these blog posts will apart from doing the basics of programming, move on to some basic language processing tools, which will be my own study journal. I might think to introduce some maths later on in this course for understanding some statistical properties of language.

So are you ready to talk to computer and explore the fascinating world?

Lets begin with the analogies, so that it isnt too “unfamiliar”. Your friend who speaks only German says to you :

Schreib “back”

Now I cant understand what Schreib means! because I dont know the language! Similarly a computer would not know any language, but you can teach him by installing a “software” ! I will write about Installing python in your computer in the next post, but till then hang on. So the basic thing to know speak to computer is to know its language. Specifically forget the adjectives there are only Names(nouns) and Commands(verbs) :p

BTW did you know ?

Guido van Rossum, the creator of the Python language, named the language after the BBC show “Monty Python’s Flying Circus”. He doesn’t particularly like snakes that kill animals for food by winding their long bodies around them and crushing them.

Now it is important that you learn a language by practicing it! So it applies same here, the next set of tutorials will be on my view about how one should see programming, well since i have said that, I believe that we are fast evolving into a world where humans and technology will be inseparable, and programming will be an intrinsic part of everyone’s life, there will be pet cyborgs and humanoids to make your life easier, so you better learn how to control them.

Ok, enough digression, so lets get back to our second example, Schreib in german means write, to do the same thing to a computer you can just say

print “HelloWorld”

and as you might have imagined, it does exactly as it is told 🙂 We will get to these details later. To have a formal understanding on how programming works, you must be really clear on what you want to do, and how exactly you want to do it!

This is the first and last thing one must worry about. Like if I said, “you Good  are ” (well its a odd fact that you could still make out the meaning, but believe me “computers” take things quite “Literally”), this doesnt make sense because  what exactly I want to ask is “Are you Good?” So structure is important in program too. Again in the first example, how would you count all vowels in a sentence?

1. recall what vowels are! {A,E,I,O,U} , wow !

2. Read the sentence “Programming is simple conversation with the machine!” letter by letter and note down vowels from it!

3.Naievely, you can also take a copy and write 1+1+1….. as soon as you encounter a vowel in the sentence.

4. To be sane enough, start reading from left to right!

Simple isnt it? You see how I broke a “Task” to smaller steps of what needs to be done. This is an important concept.

Now first time my teacher would teach me how to find vowels like this, but the next time she says me to find vowels, its a “Task” we should already know. This is the concept of a function. It is always a good idea to learn to define new short “verbs” for actions which you do often, say you work in a brick Kline, and the owner asks you “to collect mud, shape it and then bake it”  , would it be easier for him to “invent” a single word  for the whole process say “comisab” or something! and everyone just understands what the owner is saying.

So I will end this topic by summarizing 2 things what i think is important for writing a program:

1. Manually first do what you want to instruct to your computer in pen and paper. Its like a translation, first your need to know your mother language!

Did you Know? Programme comes from word Pro meaning before, and graphe meaning write, which probably sums up,what you need to do before writing your first code!Think about it before writing!

2.Try to break the process to as simple as possible and group them as small “tasks”.

Next Tutorial:

Installing python in Linux machine/Windows. Editors

Advertisements

Any thoughts?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s