Learning a programming language

I realize I learn a programming language in an inefficient way. I can learn how to write code quickly, but it is difficult to write elegant code.

How programming is different from other science subject

You cannot ask why there are natural number. You cannot ask why there are gravity. It is the law of the world, decide by God. But for programming language, which is design by people for some reason. It is alway good to ask why the programming language is design in this way.

What can be learn from programming language

First of all, code in any programming languages will be convert to machine code. They have the same power on solving problems, why we need different programming language?

Programming language is also an abstraction, using language problem, syntatic sugar to simplify the programming task, make developers’ life easier. Learning programming language is asking why the language designer going to abstract programming in this way. The designers of programming language integrate good design pattern and useful techniques into the language. For example, many good design pattern is integrated of C language is become language feature of other languages. Such as the template method become the concept of class and object in OOP. The function pointer becomes first class function in functional language.

Conclusion

When learning a language, we should think about why it is designed in this way. After understanding the principle, we can write better code, or apply the good pattern in another language.