HyperAI

Take Advantage of the Holiday to Practice Your Inner Strength and Teach You How to Smoothly Switch Programming Languages

7 years ago
Information
Dao Wei
特色图像

The pain of programmers changing weapons

For programmers, in this era of rapid change, it is probably unrealistic to stick to one programming language.

There are always some reasons that, after you have mastered a language, you suddenly need to create other projects in another language.

Many programmers encounter some common difficulties when learning a new programming language. For example, being familiar with the habits of the old language may cause confusion when using the new language, leading to embarrassment during use.

In addition, programmers who are not skilled enough will be at a loss for a while if they want to use analogies to understand the new language.

Don't collapse yet.

Here is a martial arts secret book that can help you switch back and forth between new and old programming languages. It’s on sale at a special holiday price of 0.50 cents per copy. Check it out.

To solve this problem, three engineers from North Carolina State University (NCSU) came up with a solution.

In one of their papers, they proposed a method based on learning transfer and borrowed the idea of analogy learning to create a learning tool that allows programmers to learn new languages faster.

Conventional disassembly routines & novice air wall

The analogy learning method, which is often used by experienced programmers, is a good way to light up new skills. It uses the commonalities between programming languages to make analogies, making it easier to master the skills of a new language.

In simple terms, it means learning new knowledge through existing knowledge.

This is different from the setting in martial arts novels where people without any skills can easily master magical skills. Under this method, the more programming languages you master, the greater the chance of applying what you have learned to other areas.

However, the analogy learning method is not very friendly to novice programmers who have little experience, especially those who have just mastered one or two programming languages. Because they do not have enough samples, it is difficult for them to find the commonalities between the new language and the language they are good at. Therefore, when facing a new language, they will always "hit the wall".

For example, it is very difficult for someone who is familiar with procedural languages (such as C) to learn object-oriented languages (such as C++) because the ideas of the two languages are very different and it is difficult to deduce and learn by analogy.

For another example, it is very difficult for VB programmers to learn ASP, because one is a C/S (Client/Server) architecture and the other is a B/S (Browser/Server) architecture.

Although the two are similar in syntax, the architectural gap is huge, and it is difficult for inexperienced programmers to make the leap by learning by analogy.

In addition, after getting started with a new language, you will also face the following problems in practical application:

1. Inertial thinking

After learning multiple languages, you often get confused about grammar and use them interchangeably. For example, some languages end with ";", while others end with "Enter". If the language you are good at ends with ";", it will be difficult to correct it due to inertial thinking.

2. Different program running conditions

After compiling an exe program, it cannot be run immediately. Different languages may require additional configuration. For example, programs written in C language can generally be run directly, but programs written in VFP need to install the DLL component of the VFP system, so VFP programs need to be installed on a disk. Programmers who are used to C language may feel like throwing their keyboards when facing VFP.

3. Calling issues in language

The calling functions involved in a language are commonly used methods, but different languages use different calling methods. Therefore, when getting started with a new language, programmers should pay close attention to how the new language is called.

In most cases, experienced programmers can rely on experience to solve these problems, but novice programmers may find it difficult to solve them.

New tools open the door to a new world

In order to help novice programmers master the analogy learning method and solve problems that arise in the application of new languages, Transfer Tutor, a learning tool developed by three engineers from North Carolina State University, plays a good auxiliary role.


This tool allows users to find commonalities between the old and new languages, so that they can better adapt to the new language. However, the tool currently requires a fee.

The basic principle is to identify the differences between the two languages sentence by sentence, and to reduce the difficulty of learning and using the new language through comparison and prompts. It defines three types of grammar transfer:

1. Negative Transfer: Negative Transfer

By explaining the new and old languages in detail, the differences between the two languages can be made clear, avoiding errors caused by interference from other languages when understanding the new language.

2. Positive Transfer

Find the common elements between two languages so that users can quickly understand the new language through analogies and improve learning efficiency.

3. New Fact: New Syntax

For those unique grammars in new languages, Transfer Tutor will provide users with detailed explanations and examples to help memorize and shorten the user's learning time.

Let’s take the common Python and R languages as examples to see how this tool works.

Those who are familiar with them should know that there are similarities between Python and R languages, but there are also differences.

For example, when selecting a table, the operator "[ ]" is used to select rows in Python, but is used to select columns in R. In R, "," is required to select rows. When performing interception, the subscript in Python is an open interval starting from 0 (i.e. [ 0:5 ], the result is 0-4), while the subscript in R is a closed interval starting from 1 (i.e. [ 1:5 ], the result is 1-5).

Breaking the barrier between Python and R

How does Transfer Tutor help us break down the barriers between the two?

First, Transfer Tutor will mark all the similar elements in Python and R and compare them. You can click to go to the next element. This element-by-element comparison can help users get all the key points of knowledge.

Transfer Tutor will then explain in detail the differences and new grammar between the different languages.

Finally, the self-check function of Transfer Tutor allows you to perform single-step debugging on the code written in the new language, which can be used to verify the correctness of the learning results and to explain the differences between the two languages separately.

Judging from their experimental operation process, the tool is very efficient in the learning transfer from Python to R language, allowing programmers to achieve "buy one get one free" for these two languages.

Whether it is applicable to all languages still needs in-depth practical verification. However, it can be used in the learning of several languages. For humans who are tormented by different languages, it can be regarded as a reed that helps them cross the river.

As for when AI programmers will appear and be able to save the countless creatures in the world who are writing code like the light of Buddha, well, this question should be asked to the big guys who write code. When will we be able to break through the singularity of AI?