What is a programming model?

本文翻译自: What is a programming model?

作为软件工程师,我们熟悉一系列编程模型,比如命令式、函数式、声明式、或面向对象编程。

1.编程模型
编程模型或编程范式是一个概念框架,它指导和约束我们如何思考问题及其解决方案。
如同任何概念框架一样,一个编程模型是一个诸多概念及这些概念之间的诸多关系以及这些关系的诸多约束的集合。比如,在面向对象编程中,核心概念是类和类之间的继承关系。

继承关系被约束以形成有向无环图。
在选择面向对象编程语言时,该框架是我们思考问题及其解决方案的视角。在面向对象语言的语境中,这种视角甚至有一个名字:我们用它来观察问题的视角称为面向对象分析,而我们用它来观察解决方案的视角称为面向对象设计。

2.超越编程语言
然而,一个编程模型不但是由编程语言定义的,而且也被整体环境定义。函数库、框架、平台都有能力改变概念、关系和约束的集合。

比如,甚至当编写面向对象程序时,你的程序会在你增加线程时发生巨大改变。你的程序不仅成为了面向对象程序,而且它们开始成为了并发程序,改变迫使你思考与之前不同的问题和解决方案。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
MapReduce is a programming model and software framework for processing large sets of data in a distributed and parallel manner. It allows for processing of large data sets on clusters of computers using a simple model for parallel processing. In the MapReduce framework, the input data is divided into chunks and each chunk is processed by a separate mapper function. The mapper function processes the input data and generates intermediate key-value pairs. These key-value pairs are then sorted and grouped by key, and passed on to the reducer function. The reducer function then aggregates the intermediate key-value pairs and generates a final output. For example, let's say we have a large data set of customer orders that we want to process using MapReduce. The mapper function will read each order and generate intermediate key-value pairs where the key is the customer ID and the value is the order amount. The intermediate key-value pairs might look like this: ``` customer1: 10.99 customer2: 25.55 customer1: 5.99 customer3: 15.00 customer2: 12.50 ``` These intermediate key-value pairs are then sorted and grouped by key: ``` customer1: [10.99, 5.99] customer2: [25.55, 12.50] customer3: [15.00] ``` The reducer function then aggregates the values for each key and generates a final output: ``` customer1: 16.98 customer2: 38.05 customer3: 15.00 ``` In this example, the MapReduce framework allowed us to process a large data set in a distributed and parallel manner, making it faster and more efficient.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值