Saturday, April 16, 2016

Topics/Concepts for a person who wants to learn programming

This post is a work-in-progress. 

I spoke to a couple of friends (at different times) who wanted to know what programming was all about. The below points/concepts came to my mind during both those times, so I wanted to write a blogpost to save those points. (Better examples are needed perhaps for the below concepts).

1. Strings, Strings, Strings - alphabets, number, special characters etc.
Knowing how to do String manipulation in any language is a must - being able to create the required string, being able to split a string (parse a string) etc

HTTP protocol is just a bunch of rules that a browser (client) and server follow to exchange strings (messages) between one another.
Browser - i will send you this particular string if I want this
Server - I will send you this particular string if I have what you want

2. Object Oriented Programming (OOP), functions etc are just ways of Organizing your code... organizing your code in the same file or in different files etc
It is important to note that -
a) writing code to accomplish something is the 1st step;
b) the 2nd step is to organize it (using OOP, MVC etc) to make it easier to find it and modify later on.

3. Abstractions
Abstractions are everywhere in computers.
Lets say we have to work with something called A.
Lets say that it is really difficult to write programs for A.
What typically happens is that a genius (or a team of them) comes along and creates a layer called B that is easier to work with, but translates our programs to A.
Now if some people feel that B also is difficult for them, then a layer called C is created, and so on.

B & C are then called layers of abstraction over A.
B is a layer of abstraction over A.
C is a layer of abstraction over B.
Each layer's goal is hide the complexity of the layer beneath it and at the same time be useful to people.

As complexity of tasks increases, programmers tend to find themselves working with (in) lower and lower levels of abstractions.

Perhaps we should always try to spot the layers of abstraction in anything that we encounter in our software world.

Below are some Real-life examples of abstractions:

CPUs understand only 1s and 0s.
Assembly Language is an abstraction over 1s and 0s.
High-level languages are abstraction over Assembly Languages.

jquery is an abstraction over Javascript
bootstrap is an abstraction over CSS
ruby is an abstraction over C

4. API - Application Programming Interfaces
From wikipedia - A good API makes it easier to develop a program by providing all the building blocks, which are then put together by the programmer.

Best is an example - we want to get data from some company, say weather data from accuweather.com

So, to successfully get data from accuweather.com and display it in our application, we need 2 things:
a) first, we should check if accuweather provides an API to access its data
b) we should then look at that API's documentation - how to access the API, which functions/methods it provides etc.
We cannot guess how an API will work. We would need documentation of how it is supposed to behave - this should be given by the people who make the API.
We would need Documentation before we would be able to use any API.

5. Documentation
Take anything that has been built by Someone Else.
In order to use it properly, we would need its Documentation.

E.g. 1 accuweather.com's people built their API. They have to put up their Documentation on their website if they want people outside their company to be able to use.

E.g. 2. Java was initially created by Sun Microsystems, and now is being owned & worked on by Oracle.

When we work with Java or Accuweather's API, we have access to the below types of documentation:
a) verbal info from peers, or already existing code in your application
b) books, online tutorials, blogs, videos
c) documentation created by people who created Java or Accuweather.com's API

As the complexity of what you are trying to do increases, programmers typically shift from 'a' to 'b' to 'c'.

Friday, April 8, 2016

Followers

Blog Archive