Listing 1 shows a bash shell script that you might code to try running the xclock command for a specified period of time.
您将编写清单1所示的bashshell脚本来按照指定的时间段运行xclock命令。
After looking at this code, you might say, well, I have a better solution.
查看此代码之后,您可能会说,这非常好,我拥有了一个更好的解决方案。
In a simple case, you might build up a code catalog, provide required input types, and indicate return types.
在一个简单的案例中,您可能构建代码目录,提供必需的输入类型并指明返回类型。
This might give you some idea of what the final code will look like.
这可能会让您对最终代码看起来象什么有一些了解。
Furthermore, if simple code is "fast enough," you might as well use it during your prototyping stage.
另外,如果简单的代码已经“足够快”了,也许您就希望在构建原型阶段使用它了。
In a large project where you have many classes and expose several interfaces, you might organize your code with a separate directory for the aspects that implement argument checking.
在一个大的项目中,你有很多类并暴露少数的一些接口,你可以使用用于方面的一个单独的目录来组织你的编码,进而实现实参的检查。
Any application you choose to deploy onto the provided server should be free of vendor-specific code, because you might end up with an application server implementation that you weren't expecting.
您选择部署到提供的服务器的任何应用程序都不应受到特定于供应商代码的限制,因为您最终可能会遇到始料未及的应用服务器实现。
You can work around some of them, resulting in counter-intuitive schema designs; you might handle the others with code in programming languages.
解决某些挑战可能会生成不太直观的模式设计;您也可能使用编程语言,通过代码应对其他挑战。
For example, you might view a country code as a fixed list of values, including DE (Germany), US (United States), and JP (Japan).
例如,您也许通过固定的值列表查看国家代码,包括DE(德国)、US(美国)和JP(日本)。
In some cases, you might also need to generate code that is specific to your project or domain.
在有些情况下,您可能还需要生成指定给项目或者域的代码。
For instance, you might group together all code that processes XML into a higher-level object model specific to your application.
例如,您可能会将处理XML的所有代码集合到一个应用程序提供的高层对象模型。
There are several reasons that you might want to refactor code. The first is the stuff of legend: the hoary old code base for a venerable product is inherited or otherwise mysteriously appears.
您需要进行代码重构的原因可能有以下几个:传说中的第一个原因是:需要继承为某个古老产品而开发的年代久远的代码,或者突然碰到这些代码。
If you have not already done so, you might want to download the sample code so you can view it as you read through this description.
如果您尚未获得示例代码,可以下载示例代码,以便在阅读下面的说明的过程中可以参考它。
In fact, you might want to write code that attempts to set several features and gracefully handles situations where a certain feature isn't available.
事实上,您可能想要编写代码,来尝试设置几个特征并巧妙处理某个特性不可用时的情况。
If you've spent most of your programming career writing sequential code, you might have more trouble adapting to the parallel nature of the robotics programs than your kids will.
如果您长期以来都从事顺序代码的编写工作的话,那么您可能还不如您的孩子们那样顺利地适应机器人技术编程中的并行本质属性。
So, when you have real code, you might run into portability problems -- but most of them are accidental difficulties, not real challenges inherent in the problem.
因此,当您使用真实的代码时,就可能会碰到可移植性问题 ——不过大部分问题都是由于意外造成的困难,而不是因为问题本身很难解决。
For example, you might want to generate code from a UML model.
例如,您可能想从一个UML模式中产生代码。
They may give you all the code coverage you need, but they might not give you all the system coverage you need.
尽管它可以提供您所需的全部代码,但它可能无法提供您所需的全部系统功能。
You might immediately notice that the code in Listing 3 doesn't look like PHP.
您可能会立即注意到清单3中的代码看上去并不像PHP。
You might try to clean up this code a bit by packaging the key lookup code in a named template.
您可能希望将键查找代码打包在指定模板中,使代码更加清晰。
You reduce the temptation to code features because you might need them later.
您抵制住了对功能进行编码的诱惑,因为您目前还不需要它。
Okay maybe I am oversimplifying - you might need minor code changes and regression testing.
好吧,也许我说得太过轻松了——你可 能需要细微的代码修改和回归测试。
So you might have code like this (see Listing 1).
因此您可能拥有下面这样的代码(参见清单1)。
Similarly, to set the values for a button, you might enter the code shown in Listing 2.
类似地,要设置按钮的值,您可以输入清单2中所示的代码。
The first thing you might notice about the code in Listing 1 is that it starts with the @implementation keyword.
您可能会注意到的第一件事是:清单1 中的代码以 @implementation关键字开始。
In Rational Rhapsody 7.5, you can better visualize the operation bodies for C and C++ as flowcharts; this might help you better understand code behavior.
在RationalRhapsody 7.5 中,您可以更好地将C和 C++ 的操作主体可视化为流程图;这可能会帮助您更好地理解代码行为。
You might have noticed one thing the code doesn't do, which is call invalidateDisplayList().
您可能注意到该代码没有调用invalidateDisplayList()。
If you are unfamiliar with ActionScript, the code in Listing 1 might look a little odd to you.
如果您不熟悉ActionScript,清单1的代码可能看上去有点奇怪。
If you look at the code, you might be disheartened.
如果查看代码的话,您可能会觉得气馁。
There are two main cases where you might want to take some code out of a method and put it in another method.
将一部分代码从一个方法中取出并放进另一个方法中的原因主要有两种。
应用推荐