代码重用是一个显著的开发目标,而命令式抽象倾向于用不同于函数式程序员解决问题的方法来解决问题。
Code reuse is an obvious development goal, and imperative abstractions tend to solve that problem differently from the way that functional programmers solve it.
声明式信息在编译时转换为命令形式,而不是在运行时每次使用时进行转换,这使代码更快。
The declarative information is transformed into an imperative form at compile-time, rather than each time it is used at runtime, resulting in faster code.
因为宏可以以任何方式展开常规代码,所以如果声明式语言不能满足需要,那么随时可以切换回命令式编程。
Since the macro expands to regular code anyway, you can always switch back to imperative programming if the declarative language doesn't suit your needs.
正如我在命令式版本中所做的一样,我将重复的代码提取到其factors类中,并且为便于阅读,将factors方法的名称改为of,如清单8所示。
Just as I did with the imperative versions, I extract the duplicated code into its own factors class, changing the name of the factors method to of for readability, as shown in Listing 8.
现在,可以使用DB 2WORF技术将这些命令暴露为MicrosoftIISWeb方法或者DB 2嵌入式应用服务器Web服务,而不需要编写任何代码!
These commands can now be exposed as either Microsoft IIS Web methods or DB2 embedded application server Web services using the DB2 WORF technology, without having to write a single line of code!
在减少代码冗长方面这算是向前迈了很大的一步,但还不算是更加抽象——其依然迫使用户命令式地计算比较函数。
This is a big step forward in reducing verbosity but is still not any more abstract - it still forces the user to calculate the comparison function imperatively.
在减少代码冗长方面这算是向前迈了很大的一步,但还不算是更加抽象——其依然迫使用户命令式地计算比较函数。
This is a big step forward in reducing verbosity but is still not any more abstract - it still forces the user to calculate the comparison function imperatively.
应用推荐