gpt4 book ai didi

c# - 声明式编程和命令式编程有什么区别?

转载 作者:太空狗 更新时间:2023-10-29 22:11:08 46 4
gpt4 key购买 nike

我从 Microsoft .Net: Architecting Applications for the Enterprise 中阅读了以下关于架构的段落, 作者:Dino Esposito 和 Andrea Saltarello:

Whenever you take a declarative approach to coding rather than an imperative approach, you are delegating some responsibilities to some other layer of code—a layer that you don't control entirely. So you're ultimately hoping that the intermediate tool will understand you correctly and won't encounter any trouble of its own along the way. In software development, delegating to a third party makes development faster, but you should guarantee that users get exactly what you want them to.

This doesn't mean that you shouldn't trust Visual Studio 2008 or similar wizard-based products. The point is something else entirely. In a large system, likely being developed by several teams, classic declarative programming just doesn't work. You need to have in your presentation a layer of code that decides what to display, where to read settings, and how to apply them. Declarative programming is still a great option, but only if you write the engine and the wizards.

谁能用简单的话向我解释一下什么是声明式编程和命令式编程?

最佳答案

声明式 - 我将描述我希望您执行的操作,您自己想办法(SQL、XSLT)。

命令式 - 我会告诉您确切该做什么,一次一个步骤(C#、Java)。

关于c# - 声明式编程和命令式编程有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8197402/

46 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com