{"id":4426,"date":"2022-02-16T23:17:47","date_gmt":"2022-02-16T15:17:47","guid":{"rendered":"https:\/\/1989lifejourney.com\/?p=4426"},"modified":"2022-02-16T23:18:23","modified_gmt":"2022-02-16T15:18:23","slug":"imperative-programming-v-s-declarative-programming","status":"publish","type":"post","link":"https:\/\/1989lifejourney.com\/?p=4426","title":{"rendered":"Imperative programming v.s. Declarative programming"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"imperative-programming-\u6307\u4ee4\u5f0f\u7a0b\u5f0f\u8a2d\u8a08\">Imperative programming (<strong>\u6307\u4ee4\u5f0f\u7a0b\u5f0f\u8a2d\u8a08<\/strong>)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5b9a\u7fa9:<br><\/strong>In computer science, imperative programming is a programming paradigm that uses statements that change a program&#8217;s state. In much the same way that the imperative mood in natural languages expresses commands, an imperative program consists of commands for the computer to perform. Imperative programming focuses on describing how a program operates. (from <a href=\"https:\/\/en.wikipedia.org\/wiki\/Imperative_programming\">Wiki<\/a>)<br>\u7c21\u55ae\u4f86\u8aaaImperative programming\u5c31\u662f\u7528\u4e00\u9023\u4e32\u7684\u6307\u4ee4\u6216statements\u4f86\u6539\u8b8a\u7a0b\u5f0f\u7684state\u3002\u6240\u4ee5Imperative programming\u8457\u91cd\u5728\u300chow a program operates\u300d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u7f3a\u9ede:<br><\/strong>\u56e0\u70baImperative programming\u6703\u6539\u8b8a\u7a0b\u5f0f\u7684state\uff0c\u6240\u4ee5\u4e5f\u6709\u53ef\u80fd\u6539\u8b8a\u5230function\u5916\u7684state\uff0c\u9032\u800c\u7522\u751fside effect\u3002\u5728\u5c08\u6848\u8f03\u5927\u6642\uff0cdebug\u7684\u96e3\u5ea6\u4e5f\u5927\u5927\u589e\u52a0 (p.s. \u56e0\u70ba\u96e3\u4ee5\u8ffd\u8e64\u5728\u4ec0\u9ebc\u6642\u5019\u3001\u54ea\u4e00\u884ccode\u6216function\u6539\u8b8a\u67d0\u500bstate)\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"declarative-programming-\u5ba3\u544a\u5f0f\u7a0b\u5f0f\u8a2d\u8a08\">Declarative programming (<strong>\u5ba3\u544a\u5f0f\u7a0b\u5f0f\u8a2d\u8a08<\/strong>)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u5b9a\u7fa9:<br><\/strong>Declarative programming is a programming paradigm\u2014a style of building the structure and elements of computer programs\u2014that expresses the logic of a computation without describing its control flow (from <a href=\"https:\/\/en.wikipedia.org\/wiki\/Declarative_programming\">Wiki<\/a>)<br>\u7c21\u55ae\u4f86\u8aaaDeclarative programming\u5c31\u662f\u4e00\u7a2e\u5efa\u69cb\u7a0b\u5f0f\u7d50\u69cb\u7684\u8a2d\u8a08\u6cd5\uff0c\u8457\u91cd\u5728\u300cwhat to do\u300d\uff0c\u800c\u975e\u300chow to do\u300d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\u5b50:<br><\/strong>Those of database query languages (e.g., SQL, XQuery), regular expressions, logic programming, functional programming, and configuration management systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Imperative programming (\u6307\u4ee4\u5f0f\u7a0b\u5f0f\u8a2d\u8a08) \u5b9a\u7fa9:In computer science [&hellip;]<\/p>\n","protected":false},"author":139426785,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","_postgate_lock_override":"inherit","_postgate_lock_mode":"inherit","_postgate_preview_mode":"inherit","_postgate_preview_limit":0,"_postgate_product_ids":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"{title}\n\n{excerpt}\n\n{url}","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[55138170,1],"tags":[],"post_folder":[],"class_list":["post-4426","post","type-post","status-publish","format-standard","hentry","category-technology-sharing","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paR5vw-19o","jetpack-related-posts":[{"id":4431,"url":"https:\/\/1989lifejourney.com\/?p=4431","url_meta":{"origin":4426,"position":0},"title":"Getting started with RxSwift","author":"Kevin","date":"16 2 \u6708, 2022","format":false,"excerpt":"\u4ee5\u4e0b\u8cc7\u6599\u53c3\u8003\u81eaRef\uff0c\u9019\u88e1\u50c5\u4f5c\u500b\u4eba\u5b78\u7fd2\u6574\u7406 Definition of ReactiveXAdvan\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3895,"url":"https:\/\/1989lifejourney.com\/?p=3895","url_meta":{"origin":4426,"position":1},"title":"Functional Reactive Programming","author":"Kevin","date":"2 12 \u6708, 2021","format":false,"excerpt":"What is functional reactive programming (FRP)?FRP \u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4536,"url":"https:\/\/1989lifejourney.com\/?p=4536","url_meta":{"origin":4426,"position":2},"title":"Reactive programming","author":"Kevin","date":"23 2 \u6708, 2022","format":false,"excerpt":"\u5b9a\u7fa9: Reactive programming is a declarative programm\u2026","rel":"","context":"\u5728\u300cIOS Development\u300d\u4e2d","block_context":{"text":"IOS Development","link":"https:\/\/1989lifejourney.com\/?cat=37324612"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=1050%2C600&ssl=1 3x, https:\/\/i0.wp.com\/1989lifejourney.com\/wp-content\/uploads\/2022\/02\/e688aae59c96-2022-02-23-e4b88be58d881.53.06.png?resize=1400%2C800&ssl=1 4x"},"classes":[]},{"id":5758,"url":"https:\/\/1989lifejourney.com\/?p=5758","url_meta":{"origin":4426,"position":3},"title":"\u95dc\u65bc\u5957\u4ef6\u7ba1\u7406\u5de5\u5177(Package manager):","author":"Kevin","date":"22 7 \u6708, 2022","format":false,"excerpt":"\u95dc\u65bc\u5957\u4ef6\u7ba1\u7406\u5de5\u5177(Package manager): About RubyGems:RubyGems\u2026","rel":"","context":"\u5728\u300cTechnology sharing\u300d\u4e2d","block_context":{"text":"Technology sharing","link":"https:\/\/1989lifejourney.com\/?cat=55138170"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7176,"url":"https:\/\/1989lifejourney.com\/?p=7176","url_meta":{"origin":4426,"position":4},"title":"ChatGPT\u6e2c\u8a66 &#8211; how to become an iOS system architect","author":"Kevin","date":"7 3 \u6708, 2023","format":false,"excerpt":"\u4ee5\u4e0b\u70baChatGPT \u7684\u56de\u7b54\uff1a To become an iOS system architect,\u2026","rel":"","context":"\u5728\u300cTechnology sharing\u300d\u4e2d","block_context":{"text":"Technology sharing","link":"https:\/\/1989lifejourney.com\/?cat=55138170"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5894,"url":"https:\/\/1989lifejourney.com\/?p=5894","url_meta":{"origin":4426,"position":5},"title":"\u95dc\u65bc\u7248\u672c\u865f\u78bc\u547d\u540d\u898f\u5247\uff08rule of version number)","author":"Kevin","date":"22 9 \u6708, 2022","format":false,"excerpt":"\u4ee5\u4e0b\u8cc7\u6599\u7686\u4f86\u81eaRef,\u9019\u88e1\u50c5\u505a\u500b\u4eba\u7b46\u8a18\u6574\u7406 https:\/\/medium.com\/fiverr-en\u2026","rel":"","context":"\u5728\u300cTechnology sharing\u300d\u4e2d","block_context":{"text":"Technology sharing","link":"https:\/\/1989lifejourney.com\/?cat=55138170"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/4426","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/users\/139426785"}],"replies":[{"embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4426"}],"version-history":[{"count":4,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/4426\/revisions"}],"predecessor-version":[{"id":4430,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=\/wp\/v2\/posts\/4426\/revisions\/4430"}],"wp:attachment":[{"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4426"},{"taxonomy":"post_folder","embeddable":true,"href":"https:\/\/1989lifejourney.com\/index.php?rest_route=%2Fwp%2Fv2%2Fpost_folder&post=4426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}