03 Dec The Rules of a High-Level Programming Language
The purpose of this book is to teach you how to think like a computer scientist. I like the way computer scientists think because they combine some of the best qualities of math, engineering, and science. Like mathematicians, computer scientists use formal languages to refer to ideas (especially calculations). Like engineers, they design things, assemble components into systems, and evaluate trade-offs between alternatives. Like scientists, they observe the behavior of complex systems, formulate hypotheses and test predictions. 8.5) Keep in mind that many programmers are not native English speakers. Computers speak machine language, not English, French or Chinese. But for a programming language to be widely used, it helps if it is more open to other natural languages (e.g. translation of tutorials and reference manuals, support for internationalization of software created with this programming language, etc.).
4.1.2) avoid exceptions; Keep grammar on a regular basis. All other things being equal, the fewer pitfalls and exceptions there are in the grammar of a language, the better. Another way of saying the same thing is “get value for money”; Every time you learn this language, this new idea should “give you a lot of mileage.” How can a programming language increase the efficiency of computers (i.e. consume less “computing resources” such as memory, CPU cycles, parallel processors, etc.)? How to avoid programs that look like a herd of cows crossing a molasses river in winter? Simply put, a programming language takes the “source code” and converts it into “machine code,” which is then executed by a computer. (In fact, it is the compiler that “translates” the source code, and the result can also be “object code” that cannot be executed directly from a computer, but let`s simplify it for now.) Thus, the programmer discovers what he wants to say and types it as source code in a programming language. 4.3.2) No big “jumps”. It should be possible to learn everything about this programming language step by step and add all the terms one by one, without having big “mental steps” between each new successive term. Formal languages have strict rules for syntax.
For example, 3 + 3 = 6 is a syntactically correct mathematical statement, but $3 = is not. Also, H2O is a syntactically correct chemical name, but 2Zz is not. 5.1.1) Do not use anything if you do not need to. For example, if large pieces of code are duplicated, the programming language should make this clear to the programmer. (In C++, incorrect use of templates often leads to such “code bloat.”) Another example is the mandatory “garbage collection” (i.e. all variables are dynamically allocated on the so-called “heap”, which requires more memory and CPU cycles when all things are otherwise equal). Sometimes the programmer knows exactly who owns which section of memory and when that memory is no longer used, so they don`t have to pay for a feature they won`t use. When choosing a programming language, don`t let all the different criteria overwhelm you. If you`re trying to choose between high-level and low-level languages, think about what interests you most. In almost all cases, you should be interested in the projects that interest you. “Efficiency” can be defined as the same result with less effort. Because of these advantages, almost all programs are written in high-level languages.
Low-level languages are only used for a few specialized applications. As mentioned earlier, human-machine communication is the easy part. It is the communication between men that is difficult. Developing a language that compiles and does what it is programmed to do is no reason to celebrate. (Kreitzberg and Shneiderman said otherwise: “Programming can be fun, as can cryptography; however, they should not be combined. My favorite example is this program that prints the lyrics of the song “99 bottles of beer,” written in a programming language whose name should not be spoken. High-level languages have an abstraction.