1. 程式人生 > >向下相容、向上相容、向前相容、向後相容

向下相容、向上相容、向前相容、向後相容

摘要:

簡要辨析向下相容、向上相容、向前相容、向後相容四個概念之間的關聯與聯絡。簡言之,向上相容等同於作向前相容,向下相容等同於向後相容。主流使用的是向前相容和向後相容。向後相容中“後”指“落後”,站在新版本的立場討論過去版本的相容性問題。向前相容中“前”指“前進”,表示未來的事情,站在舊版本的立場討論未來版本的相容性問題。

正文:

向後相容(Backward compatibility)

        Backward compatibility is the capability of interoperating with older systems. In telecommunications and computing, a product or technology is backward or downward compatible if it can work with input generated by an older product or technology. If products designed for the new standard can receive, read, view or play older standards or formats, then the product is said to be backward-compatible; examples of such a standard include data formats and communication protocols. The reverse is forward compatibility, which implies that old devices allow data formats generated by new devices, perhaps without supporting all new features. A standard supports forward compatibility if older product versions can receive, read, view, or play the new standard. For example, the introduction of FM stereo transmission allowed backward compatibility since new FM radio receivers could receive monaural signals generated by old transmitters. It also allowed forward compatibility, since old monaural FM radio receivers could still receive a signal from a new transmitter. In programming languages, backward compatibility refers to the ability of a compiler for version N of the language to accept programs or data that worked under version N - 1. By this definition, if previous versions were also backward compatible, which is often the case, then, by induction, version N will also accept input that worked under any prior version after, and including, the latest one that was not backward compatible. However, in practice, features are often deprecated and support is dropped in a later release, which is yet thought of as backward compatible.         Backward compatibility is important because it eliminates the need to start over when you upgrade to a newer product. A backward-compatible word processor, for instance, allows you to edit documents created with a previous version of the program. In general, manufacturers try to keep all their products backward compatible. Sometimes, however, it is necessary to sacrifice backward compatibility to take advantage of a new technology.         The flip side of backward compatibility is upward compatibility. Upward compatible is the same as backward compatible, except that it is from the point of view of the older model. 向前相容(Forward compatibility)
        Forward compatibility is the capability of interoperating with anticipated future systems. Forward compatibility aims at the ability of a design to gracefully accept input intended for later versions of itself. The concept can be applied to entire systems, electrical interfaces, telecommunication signals, data communication protocols, file formats, and computer programming languages. A standard supports forward compatibility if older product versions can receive, read, view, play or execute the new standard. The applicability of a forward compatible system with new versions requires not only the respecting of the older version by the designers of the newer version but additionally some agreement on future design features with the design freeze of current versions. The introduction of a forward compatible technology implies that old devices partly can understand data generated by new devices. 
forward compatibility and extensibility:
        Although the concepts of forward compatibility and extensibility are similar, they are not the same. A forward compatible design can accept data from a future version of itself and pick out the "known" part of the data. An example is a text-only word processor ignoring picture data from a future version. An extensible design is one that can be upgraded to fully handle the new data in the newer input format. An example is a text-only word processor that can be upgraded to handle picture data.         Forward compatibility is a design principle in which a program or piece of hardware is developed to remain functional in the future with new software or devices. For example, a computer program is typically written in code that allows it to work with an Operating System (OS) and hardware that is current at the time of its release. A developer creating a program with forward compatibility in mind tries to ensure that it will also be able to function several years later with a new OS and different hardware. This can be quite difficult to ensure, however, though certain methods can be used to make the process simpler. 總結:
        向後相容中“後”指“落後”,而不是“後來”,表示過去的事情,站在新版本的立場討論過去版本的相容性問題。向前相容中“前”指“前進”,而不是“以前”,表示未來的事情,站在舊版本的立場討論未來版本的相容性問題。         微軟網站對“向後相容”和“向前相容”的理解:

      (1)向後相容。2007 Microsoft Office 系統向後相容下列早期版本:Microsoft Office 2000、Microsoft Office XP 和 Microsoft Office 2003。這些版本的使用者可以輕鬆地採用新的格式,並繼續從現有檔案中獲得最大的益處。特別是他們還可以繼續使用舊的 .doc、.xls 和 .ppt 二進位制格式,這些格式與 2007 檔案格式完全相容。       (2)向前相容。應用程式的早期版本能夠開啟較新版本中的檔案並忽略早期版本中未實現的功能。例如,Word 2003 向前相容 Word 2007,因為它能夠成功地使用轉換器開啟 Word 2007 檔案。
向上相容(Upward Compatible)
向上相容(Upward Compatible),又稱作向前相容(Foreward Compatibility)。在計算機中指在較低檔計算機上編寫的程式,可以在同一系列的較高檔計算機上執行,或者在某一平臺的較低版本環境中編寫的程式可以在較高版本的環境中執行,都稱為向上相容,前者是硬體相容,而後者是軟體相容。例如,基於Intel386的PC相容機上所有的軟體也可以執行在486或更高的機型上。向上相容具有非常重要的意義,一些大型軟體的開發,工作量極大,如這些軟體都能做到相容,則無需在其它機器上重新開發,就可節省龐大的人力和物力。
向下相容(Downward Compatible)
向下相容(Downward Compatibility),又稱作向後相容(Backward Compatibility)。在計算機中指在一個程式或者類庫更新到較新的版本後,舊的版本程式建立的文件或系統仍能被正常操作或使用,或在舊版本的類庫的基礎上開發的程式仍能正常編譯執行的情況。例如較高檔的計算機或較高版本的軟體平臺可以執行較為低檔計算機或早期的軟體平臺所開發的程式,如基於Pentium微處理器的PC相容機可以執行早期在486上執行的全部軟體。向下相容可以使使用者在進行軟體或硬體升級時,廠商不必為新裝置或新平臺從頭開始編制應用程式,以前的程式在新的環境中任然有效。 對於軟體來說,向下相容的意思是,較高版本的程式能順利處理較低版本程式的資料。拿著名的動畫製作軟體 Flash的兩個版本 Flash 5(老版本)與 Flash MX 2004(新版本)來說,這兩個版本雖然儲存出來的檔案都是 .fla,可是檔案內容的結構有所不同。儘管如此,Flash MX 2004 仍然能處理 Flash 5 儲存的 fla 檔案,我們就說 Flash MX 2004 是向下相容的。而Flash 5不能處理Flash MX 2004儲存的fla檔案,我們就說Flash 5不支援向上相容。
西安電子科技大學的《計算機體系結構》的考題答案中給出相容性的定義:
(1)向上(下)相容指的是按某檔機器編制的軟體,不加修改就能運行於比它高(低)檔的機器上。
(2)向前(後)相容指的是按某個時期投入市場的該型號機器上編制的軟體,不加修改就能運行於比它前(後)投入市場的機器上。