码迷,mamicode.com
首页 > 编程语言 > 详细

009 The Interfaces In JAVA(官网文档翻译)

时间:2015-10-30 10:49:58      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:

Interfaces

There are a number of situations in software engineering when it is important for disparate groups of programmers to agree to a "contract" that spells out how their software interacts. Each group should be able to write their code without any knowledge of how the other group‘s code is written. Generally speaking, interfaces are such contracts.

在软件工程的很多情形中,不想干的小组或程序员达成一致的合约(合约用于阐述软件如何交互)是非常重要的。在合约的帮助下,每个小组写代码时不必了解其它小组的代码时如何编写的。一般来说,这样的合约由接口来充当。

For example, imagine a futuristic society where computer-controlled robotic cars transport passengers through city streets without a human operator. Automobile manufacturers write software (Java, of course) that operates the automobile—stop, start, accelerate, turn left, and so forth. Another industrial group, electronic guidance instrument manufacturers, make computer systems that receive GPS (Global Positioning System) position data and wireless transmission of traffic conditions and use that information to drive the car.

譬如说,想象一下在不久的将来,由电脑控制的机器人汽车载着乘客穿过城市街道,而车是无人驾驶的。而汽车制造商用JAVA编写的软件操作汽车——停止、启动、加速、向左转等等。而另一个产业群电子制导仪器制造商使用电脑系统接收GPS数据和交通状况的无线传输数据,并用接收到的数据驾车汽车。

The auto manufacturers must publish an industry-standard interface that spells out in detail what methods can be invoked to make the car move (any car, from any manufacturer). The guidance manufacturers can then write software that invokes the methods described in the interface to command the car. Neither industrial group needs to know how the other group‘s software is implemented. In fact, each group considers its software highly proprietary and reserves the right to modify it at any time, as long as it continues to adhere to the published interface.

该汽车的制造商必须发布行业标准接口,阐述调用什么方法可以使车移动,然后指导制造商可以调用接口描述中的方法控制汽车,而工业集团不必知道其他集团的软件是如何实现的。事实上,每个集团都认为自己对软件高度专有,可以随时修改软件,前提是遵循发布的接口规范。

009 The Interfaces In JAVA(官网文档翻译)

标签:

原文地址:http://www.cnblogs.com/tantanjishu/p/4922552.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!