官术网_书友最值得收藏!

Declarative programming

Let's go back to the real-life imperative example, where we gave directions to a friend on how to get to a place. When we think in terms of the declarative programming paradigm, instead of telling our friend how to get to the specific location, we can simply give him the address and let him figure out how to get there. In this case, we tell him what to do and we don't really care if he uses a map or a GPS, or if he asks somebody for instructions: Be at the junction between Fifth Avenue and Ninth Avenue at 9:30 in the morning.

As opposed to imperative programming, declarative programming is a programming paradigm that specifies what a program should do, without specifying how to do it. Among the purely declarative languages are database query languages, such as SQL and XPath, and regular expressions.

Declarative programming languages are more abstract compared to imperative ones. They don't mimic the hardware structure, and, as a consequence, they don't change the programs' states but transform them to new states, and are closer to mathematical logic.

In general, the programming styles that are not imperative are considered to fall in the declarative category. This is why there are many types of paradigms that fall under the declarative category. In our quest, we will look at the only one that is relevant to the scope of our journey: functional programming.

主站蜘蛛池模板: 靖州| 繁峙县| 新泰市| 横峰县| 林西县| 阳信县| 安龙县| 香河县| 安阳县| 曲水县| 常州市| 弥渡县| 麦盖提县| 卢湾区| 象山县| 壶关县| 通化市| 长垣县| 荆州市| 华容县| 金昌市| 南充市| 县级市| 陆川县| 西丰县| 股票| 平安县| 深水埗区| 乳源| 石门县| 通江县| 双峰县| 靖州| 伊川县| 安泽县| 开平市| 布尔津县| 潜江市| 科技| 商城县| 皮山县|