Thursday, November 19, 2009

Chinese is Object-Oriented Language

There are a lot of articles comparing Chinese and English to some extent. From the computer language design point of view, we shall see that Chinese is an object-oriented high-level language; while English or the like is index-based language.

Let us first look at what is Object-Oriented language. In the computer science, any concrete or abstract thing can be viewed as Object. Objects have their attributes and methods. Take “dog” as an example, color, weight and so on are its attributes; while eating, coquetry, barking etc are its methods.

Similarly, a Chinese character or an English word can also be viewd as an object. Once again, take “狗" (dog) as an example, the pronunciation and spelling are attributes of the word, and its meaning in usage is its method.

The most important concepts of Object-Oriented languages are: encapsulation, inheritance, and polymorphism.

1. Encapsulation

In software engineering, encapsulation means concealing the functional details of an object from its interface. This provides not only certain levels of protection of the data structure, but also excellent foundation for modularity.

The two features of encapsulation are: separation of interface and implementation and the protection of the internal implementation. By the same token, we can define the following four criteria to examine whether a natural language ensures encapsulation.

1. Shape interface: whether all words have consistent shape.
2. Semantics interface: whether there is unique definition of certain words.
3. Pronunciation interface: whether the pronunciation of certain words is unique.
4. Spelling interface: whether the spelling changes according to the different scenario.

Chinese. 1) Chinese characters have squared shape. 2) Most Chinese characters have multiple meanings. 3) Most Chinese characters have only one pronunciation; only a few (more than one hundred) have two or more ways of pronunciation. 4) Chinese characters’ spelling is fixed, despite that there are simplified and traditional spelling.

English. 1) English words can be arbitrary in length. For example, “I” has only one letter; and "pneumonoultramicroscopicsilicovolcanoconiosis" has a total of 45 letters. 2) Most English words have multiple meanings. For example, “book” in noun means differently from it in verb. 3) Most English words have unique pronunciation. 4) Spelling of English words is not fixed. The letters are case-sensitive; nouns have plural form; verbs have tense changes. And the pronunciation will change as well.

To compare them, “do” can appear to be “do”, “did”, “doing”, “done” in English, while in Chinese there is only a need for some commonly used adverb.

Conclusion: Chinese is a better encapsulated language of encapsulation

2. Inheritance

In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. Inheritance is intended to help reuse existing code with little or no modification.

For human language, there may not be hierarchies that rise from the inheritance relationship. Still, there are obviously compounds of roots (or 部首) for words and compounds of words for phrase, which make reusing word components possible. We will find that by using inheritance, language is much simpler for learners.

Single inheritance: Chinese characters are mostly made of parts (部首). Some parts are for the semantics (意); some parts are for the pronunciation (音). Therefore, one can guess the meaning of certain words without knowing how to pronounce it, or visa versa. For example, 围、圆、园、圈. These four words all have been circled with “口”; this is for the semantics meaning that they are something to do with circles. The inner parts 韦、员、元、卷 tells how to pronounce them. On the other hand, English has Latin roots that can be used to make words. This can be viewed as an example of single inheritance.

Multiple inheritance: which means to inherit from more than one classes. Chinese language does this in making phrases. For example,
  飞机(plane) = 会飞行(flight)的机器(machine)
  工人(worker) = 在工厂(factory)工作的人(man)
  解放(liberate) = 解开(unlatch)后释放(release)
  计算机(computer) = 能计算(calculate)的机器(machine)

English has such inheritance in the compounded words, such as: football, handwriting, and breakwater. However, there are also very bad examples that no inheritance can be found. For example:
猪 pig 公猪 boar 母猪 sow 小猪 piglet 猪肉 pork
牛 cattle 公牛 bull 母牛 cow 小牛 calf 牛肉 beef
羊 sheep 公羊 ram 母羊 ewe 小羊 lamb 羊肉 mutton
One shall see that there are only seven Chinese characters involved in representing these words: 猪、牛、羊、公、母、小、肉 whilst 15 words for English.

The last example, the months:
  一月 January
  二月 February
  三月 March
  四月 April
  五月 May
  六月 June
  七月 July
  八月 August
  九月 September
  十月 October
  十一月 November
  十二月 December
In Chinese, they are just numbers plus “月” for month. In English, they are twelve irrelevant words.

Conclusion: Chinese language is perfectly inheritance language, (given that five thousand years of Chinese history).

3. Polymorphism

Polymorphism (poly = multiple, morph = shape) is the ability of one type, A, to appear as and be used like another type, B. It provides the runtime flexibility for the language. Actually, polymorphism is a consequence of inheritance. By properly inherited from one interface (a.k.a. abstract base class), values of different data types can be handled using a uniform interface.

To exam whether a human language has polymorphism, we shall see 1) whether there exist words representing interfaces; 2) whether a word in a single interface can have different semantics in its context.

Starting comparison with an example, “我要坐车去” (I will go there by car). In English, it is quite definite that the transportation is “car”. In Chinese, however, “车” is an abstract word; it can refer to汽车 (car), 出租车 (taxi), 公共汽车 (bus), 火车 (train), etc. To be competent in English, one would have to say “I will go there by vehicle” – which sounds odd. Words like “车” that serves as an interface are quite common in Chinese, partly because a lot of compounded words are inherited from some single character.

Another type of polymorphism in Chinese is Pinyin. There are four tones for Pinyin. The tones sometimes are decided within its context, so called “多音字” (multi-tones character). Even the tones are provided, the meaning of the words have to be determined within the context in some cases. For example, “lì hài” can be “厉害” (Formidable) or “利害” (gains and losses, advantages and disadvantages).

Actually in English, the use of the tense is considered anti-polymorphism because the objects (words) changed their interface when its properties are changing; potentially increase the number of objects.

From the above examples, it is quite obvious that polymorphism provides certain degrees of flexibility in communication at the cost of preciseness. This probably is a feature of “information hiding” that makes languages more literally colorful.

To conclude this article, Chinese is, if not the only one, an Object-Oriented Natural Language; and English is definitely not.

No comments:

Post a Comment