你的位置:首页 > Java教程

[Java教程]009 The Interfaces In JAVA(官网文档翻译)

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.

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


马尔代夫自助游攻略2015怎样去马尔代夫旅游去马尔代夫哪个旅行社好马尔代夫旅游攻略大全马尔代夫旅游攻略锦绣中华民俗村好玩吗?深圳锦绣中华怎么样? 味蕾上的于都美食 令人魂牵梦绕 锦绣中华民俗村门票预约电话?深圳锦绣中华预订优惠多少? 锦绣中华民俗村官网,深圳锦绣中华官方网站。 宝墨园南粤苑好玩吗?番禺宝墨园南粤苑有什么看点? 宝墨园南粤苑门票可以单独买吗?宝墨园和南粤苑有联票吗? 到宝墨园南粤苑交通路线?宝墨园和南粤苑距离多远? 宝墨园南粤苑玩点是什么?番禺宝墨园与南粤苑区别在哪里? 清远黄腾峡漂流多少钱?2015黄腾峡漂流最新票价? 霞客古渡船票价格?上林霞客古渡游船免费吗? 2015清远黄腾峡漂流开漂时间?黄腾峡漂流什么时间开放? 上林霞客古渡门票包括什么?霞客古渡门票包含游船吗? 康定海螺沟购物特产:麝香 中国四川康定特色菜:“大不同”羊肉汤和焦窝子油糕 四川甘孜州藏历年 康定海螺沟购物特产:贝母 IDT2305A-1DCGI Datasheet IDT2305A-1DCGI Datasheet IDT7201LA15JGI Datasheet IDT7201LA15JGI Datasheet ICS843001AG-21LF Datasheet ICS843001AG-21LF Datasheet 预定捷克游 预定捷克游 预定捷克游 捷克旅游团价格 捷克旅游团价格 捷克旅游团价格 从深圳去捷克旅游报价 从深圳去捷克旅游报价 从深圳去捷克旅游报价