Home >Backend Development >Python Tutorial >Reflection from an old foreign programmer: You can't have C, Python, and Java at the same time, just concentrate on learning one programming language well!
Recently, John Carmack, a famous game programmer and co-founder of id Software, said in an interview that programmers should concentrate on learning a programming language well. This surprised me a bit. While I personally strongly agree with this advice, this view is controversial in today's programmer circles.
I guess, I am what everyone calls an "old programmer". I am not young, I have been engaged in programming all my life, and I have been engaged in this professional work since I entered the society. Sometimes I feel like a programming language enthusiast who has witnessed the development of many programming languages. Looking back at this exciting history, we can't help but come to the (wrong) conclusion that it never hurts to know a few programming languages. The historical development of programming languages is very exciting, but today's development situation is relatively peaceful.
In this article I want to review the past history, summarize experience and lessons, and take a look at which programming language is the best standardized language.
With the rise of computing hardware and computer science as a discipline, computer programming (in addition to the instructions of the processor itself outside) also began to develop slowly. In its first few decades, programming languages were primarily the preserve of academia and attracted a small group of researchers. The options for programmers are limited and mainly depend on the field.
Business programming uses COBOL, scientific programming uses Fortran, and a few other languages are often used for specific fields, research, or hardware.
For most programmers, they only need to concentrate on learning one programming language for their entire programming career or for a long time. Although some people were interested in the design of programming languages, the field was still very young at the time. Despite some interesting innovations, what goes into designing a good programming language is not yet well understood.
As the number of computer hardware increases and its uses become increasingly diverse, the number of programming languages also begins to grow, and programming Language choice has become a popular topic. People began to classify programming languages. We can tell which language a programmer will choose based on the type of programmer they are and the level of expertise they aspire to achieve.
Personal computer programming enthusiasts use the increasingly popular BASIC. This is a very absurd and primitive programming language, but it is widely used and has become a guide for a generation of programmers (including myself). Pascal introduced structured programming and had a huge impact (Pascal built a thriving community with Turbo-Pascal and Delphi, but eventually disappeared).
C, which originated from UNIX, became a system programming language. C became the successor to C and borrowed object-oriented programming from Smalltalk, becoming the language of professional application and service developers. Eventually Visual Basic (which had nothing to do with BASIC) popularized "visual programming," met the needs of application development (which grew rapidly with the advent of Windows), and became the first choice for the masses. But it is generally believed that VB programmers are domain experts doing part-time programming jobs, while C and C are "professional" programmers.
At this stage, people still do not understand the design of programming languages well, resulting in many aspects of the design of many popular programming languages being less than ideal. The C language is simple and powerful, but it is difficult to master and there are too many things that can go wrong. C had good intentions, but ended up with a poor design and a bad feel to use. Visual Basic was fun and simple, but it was a bit cumbersome and lacked elegance and efficiency given the technical conditions of the time. Smalltalk and LISP were both interesting and elegant languages, but eventually fell out of favor because they were tied to specialized hardware and expensive tools.
Later, the Internet emerged. The extent of the impact of the Internet on programming languages may not be known, but it is undoubtedly a significant factor. A long time ago, programming languages were a rarity, usually born in research labs and large commercial companies; but now it seems that anyone can develop their own programming language. For a time, PERL became a popular general-purpose language, covering everything from system administration to Web programming.
Later, Python changed from a scientific research language to a simple and easy-to-learn general-purpose language. Although it developed slowly at first, it eventually swept the entire world. It is said that Netscape's Brandan Eich developed JavaScript (as a very limited browser extension language) in just a few days. This not only proves that Eich is a genius, but also proves that people during that period had a good understanding of the design of programming languages.
Many other programming languages appeared during this period, the most famous of which is Java. There is nothing special about the language itself, but the JVM it provides is a universal runtime environment that realizes "write once, run anywhere", which means that the language is very universal and is not limited to specific hardware, operating systems, or Limitations of the target environment. Strictly speaking, the early JVM was nothing to show off, but it ushered in an era of increasingly mature language runtimes and deployment options.
Since the JVM, programming languages have begun to develop rapidly in an interesting direction. The just-in-time compiler (JIT) derived from the Self language (the successor of Smalltalk, although excellent but very failed) was further studied, resulting in the birth of Java's HotSpot, and Microsoft launched the .NET CLR to combat Java. .NET goes a step further and uses CLR (Common Language Runtime) as a universal runtime for multiple languages, not just C#. In hindsight, this was a watershed moment: the choice of programming language became irrelevant.
This may not be the main reason why Microsoft made this choice (at that time they were still trying to continue to support the very popular Visual Basic and C#), coupled with Microsoft's closure during that period Type licensing, ultimately the CLR failed to become the most popular operating environment. But in the first decade after the turn of the millennium, programming languages became more numerous and ubiquitous.
On the other hand, the number of programmers has also experienced explosive growth. As demand for software grew rapidly and tools and knowledge became more widely available, millions of people around the world became programmers. These programmers are human beings, and they crave a strong sense of group identity. Just like ordinary people have strong and irrational opinions about sports teams, programmers are starting to take sides on the choice of programming languages. Many programmers are forced to choose some new, unique, and special programming language.
For example, some people claim that functional programming is king, Ruby is better than Python, Scala will completely change data science, and it is your loss if you don’t choose Clojure... At this point, programming languages have entered from linear development The chaotic Darwinian era of survival of the fittest.
I thought that people during this period would realize that some programming languages are too crazy to sustain development. However, this was not the case. Instead, the situation took an unexpected turn. In the era of "cloud" computing, where many applications and services are deployed across a large number of distributed nodes on the Internet, it seems to no longer matter which programming language is used. Programmers are developing independent components that communicate with each other, so why bother with programming languages? Components do not need to know which language each other is written in. If programmers like to write components in X language, then use this language. Who cares.
The same is true for components running on different machines. With the release of Docker, containers have gained popularity, whether it is an application running on a single machine or on a cluster of machines through orchestration software. Software that runs collaboratively can all be easily managed using the same paradigm.
People are still developing new programming languages today, many of which are promising and highly anticipated. Some are domain-specific (Swift, Kotlin, and Dart for mobile apps, Solidity for Ethereum smart contracts), while others are more general, but each language benefits from the lessons learned over the decades (for Go for cloud programming, Rust for system programming, TypeScript, a superset of JavaScript, etc.).
At the same time, the programming world has reached a new level of maturity where we are no longer chasing every new trend and adopting every new language. We have all grown up.
There is no doubt that some programming languages are indeed better, while others are better suited to handle certain use cases. Anyone who has been programming for a while knows that learning a new language is not difficult at all. Most programmers can easily learn the basics of a new language in just an afternoon, and become more or less productive after a few days of use. New programmers can start with any of the major programming languages and easily apply their programming knowledge to other languages.
However, frequent changes in programming languages are not a good thing, for two main reasons. First, learning a programming language is a bit like learning to play chess. You can learn the rules quickly, but that doesn't mean you can beat experienced players. You need to learn strategies, and that takes time and practice. This is an ecosystem of best practices, pitfalls, optimization techniques, as well as libraries, tools, and communities. Secondly, although programming is simple, it is prone to errors.
Even with common programming experience and the best tools, converting ideas into computer code is not an intuitive act. No matter what intuition a programmer develops, it must go through a cycle of repeated use, immediate feedback, and error correction. Every time you change programming languages, you pay a price. So, in my experience, the choice of programming language is important, but once you make a choice, you should stick to it in the long run.
By 2022, we need to consider the following points when choosing a programming language.
First of all, the most critical consideration is the scope of application of the language. If it is a specific domain and some domain-specific language must be used, the most generally applicable language is preferred. Fortunately, since Java proposed "write once, run anywhere", runtime and deployment are no longer an issue, and cost and licensing are no longer constraints. Today, all programming languages, runtimes, and various tools are basically available for free. If a language is not suitable for a special occasion, it can only be said that it is not popular enough and has not spread to everyone; or it is because of some basic factors that the language is really not suitable for the task.
Popularity matters, we should choose languages that have a strong community, rich sources of information, and a large number of other programmers to work with or hire. Any unpopular language is not worth choosing. If you encounter special circumstances, the choice will be more difficult. No one language is suitable for all scenarios, but ideally, a common mainstream language should be sufficient for most scenarios.
Finally, the programming language we choose should be better than most other languages. Even in 2022, there are still some terrible programming languages that are difficult to learn and use, and can easily get programmers into trouble.
Given the statement above, I don’t think we actually have much choice. Now, let’s take a look at these best programming languages.
JavaScript in the world of programming languages is like the English used by humans to communicate. It is the most popular and versatile programming language, suitable for many different scenarios (browser/frontend, system/backend, embedded as an extension language in many environments). JavaScript's runtime (V8/Node/Deno) is very efficient, has many great tools, and a large community.
TypeScript is a superset of JavaScript that introduces strong typing and standard tools and is quickly becoming the default choice for JS programming.
Rust has all the features of C/C, is easier to use, and doesn’t have too many traps. Rust's community and ecosystem are strong and growing, and the tools are great to use. If Rust provides all the features you need, then it is definitely the best choice. Where you could only use C or C before, you can now choose Rust. In addition, Rust is also building its own universal language for WebAssembly (WebAssembly can be said to be the ultimate "write once, run anywhere" runtime).
I have been using Python for more than 20 years. Unfortunately, in 2022, Python is still Not really a general-purpose programming language. One reason is that Python is still very inefficient and cannot be used in many performance-focused situations. Another reason is that it hasn't made it into mainstream user-facing environments, such as web browsers or mobile phones. Despite this, Python is still an excellent programming language and occupies an important position in data engineering/data science/machine learning, so if you work in these fields, Python is definitely a language worth knowing and loving. . As it stands, Python is likely to continue to develop as a universal language for data science, but it may not be able to break through this field.
Go is a language that is very suitable for "cloud" programming. The Go language is elegant, easy to learn and use, and has an excellent community, ecosystem and tools. It's widely used in core products in the cloud native space, so it's here to stay. Unfortunately, Go is not universally applicable and cannot be used outside of Internet servers. Additionally, due to Go design choices, it does not perform well in the C/C++ world. Go is good, but if you have to make a choice, Rust can implement all the functions that Go can achieve. As time goes by, Go may be replaced by mainstream system programming languages.
C# and its ecosystem are great and you can do a lot with it. Java is not as good as C# in every aspect, so I don't understand why anyone would like it, but Java is really popular. C# is widely used, not only as a systems and "business" language, but now also extends to mobile applications and browsers. Powerful runtime, great ecosystem. However, unless you need some of C#'s tailor-made runtime and tooling capabilities, it will be difficult for C# to compete with JavaScript and Rust in the short term.
According to the Lindy Effect, C and C will continue to be popular for decades to come. If you are already an expert in these two languages, you will definitely have no worries about finding a job. If there is a need in this area, it is also a good choice to spend time learning both. Otherwise, choosing Rust is more appropriate.
These languages have their place in specific fields. If mobile UI programming is required, these are a good choice. But JavaScript is more universally applicable and is also suitable for mobile development, so we should choose JavaScript more.
LISP is very special. Even if you don’t have this need in your daily work, you should learn it. Racket is a state-of-the-art, very complex language (actually it's a language building toolkit). Clojure is rumored to be powerful because it targets the JVM and can use Java libraries. But I'm not sure how useful this selling point is.
Functional languages are important. In some cases, they are a superior choice. Haskell is the representative of functional programming. F# has better general applicability because it runs on the CLR and can use .NET libraries. Scala is not purely functional, but is very general and runs on the JVM.
Julia is very suitable for the field of mathematics. Both R and MATLAB are good at specific situations. However, in the field of data engineering dominated by Python, these programming languages may be difficult to survive.
If you are into shell programming, PowerShell is by far the best choice. It works on all operating systems, so we have no reason to use any other shell. PowerShell can also be considered a general-purpose programming language, but in fact, no one uses it outside of non-system management.
These languages also had their glory days, mainly as web " backend" language. No matter what you think of these languages, you should no longer waste your efforts on them. They are all dying.
VB changed the world, but is now falling by the wayside, both as a general-purpose language and as an extension to other programs. Functions that could be achieved with VB in the distant past can now be achieved better with other modern languages.
I love programming languages and am always curious about new languages. However, for now, TypeScript is my top choice for C, with Rust coming in second when power and low-level access are needed. I believe that almost all programmers in 2022 will have similar views to me.
The above is the detailed content of Reflection from an old foreign programmer: You can't have C, Python, and Java at the same time, just concentrate on learning one programming language well!. For more information, please follow other related articles on the PHP Chinese website!