ezoic

Monday, June 13, 2016

One article to summarize programming language, I hope so

One article to summarize programming language:

1. What is programming language:

Programming language is some command people write to let computer do something, like calculations etc. It can be complicated.

2. What basic things you need to know about a programming language

Since programming language is doing calculations, you need to know how a programming language does plus, minus, multiply, divide etc. And how it presents data which is called data structures. For example data structure of python has, list, tuple, dictionary (hash table for python). The mostly used data structure from me is dictionary, hash table.

Hash table is important. If you learn it, you can do some complicated data analysis.

https://en.wikipedia.org/wiki/Hash_table

Basically hash table associates some keys with some values.  When your data has a key, and it has a vector of values, and you need to use the vector of values on calculations, and still keep the association between the keys and the vectors of values, you need to use hash table.




Another thing about programming is the loop.

For example, if you want to traverse a list in python to do some calculations, and the list is very long, you need to use loops. An example:

a=[1,2,5,3,4,6,7,8]
b=[2,3,5,6,7,8,9,9]
for i in range(len(a)):
      t=a[i]/b[i]
      print t





3. How people complicate a programming language and  simplify it.


When programming language tries to evolve, and ppl invent a thing, called objective oriented programming (OOP). Maybe different ppl have different opinions on this. But I try to simplify the definition.


In OOP, there is a concept called "class". It is the central of OOP.

In python a class is a collection of functions.  And every time, when you write some script, you put all the functions you need into one bucket  called "class". And in future, when you need to call a function within the class, you directly call it without re-write or something. In that way, your script will be simplified and shortened.

Here is a page about class in Python

http://learnpythonthehardway.org/book/ex40.html

Other language has the similar thing, like PHP.

In PHP, people has class and arrow and double colon. They are some things that you need to learn to be advanced on PHP.  Arrow and double colon are some things for class in PHP.

Here is the difference between arrow and double colon:

http://stackoverflow.com/questions/3961456/difference-between-double-colon-and-arrow-operators-in-php

Quote, the most important lines in the article:


:: is for static elements while -> is for instance elements.

static methods can be called directly from an instance in the same way that you would call "instance" method: $obj->hello()






No comments:

Post a Comment

looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...