`
hlzhao
  • 浏览: 25447 次
  • 性别: Icon_minigender_1
  • 来自: 常州
最近访客 更多访客>>
社区版块
存档分类
最新评论

You wanted a banana but you got a gorilla holding the banana

阅读更多

Joe Armstrong, creator of Erlang, on software reusability.

I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions — all the data comes in its input arguments and everything goes out and leave no state behind — it’s incredibly reusable.

Source: Coders at Work. Emphasis added.

I do most of my work in object-oriented languages and I don’t see that changing any time soon. I’m more interested in functional techniques than functional languages : using pure functions, using functions as arguments and return values, etc. As Joe Armstrong says, such code is easier to reuse. If you want to reuse (or test) a functional banana, you don’t have to set up a stateful gorilla to hold the banana first.

 

From : http://www.johndcook.com/blog/2011/07/19/you-wanted-banana/

分享到:
评论

相关推荐

    Gorilla

    【Gorilla字体详解】 在IT领域,字体设计是一个至关重要的元素,尤其在网页设计、图形设计以及软件界面中。"Gorilla"是一个专有名词,可能指的是一个特定的字体系列或者设计风格。在本案例中,它可能代表一种独特的...

    QuickBasic自带的投掷游戏代码GORILLA.BAS

    ' Your mission is to hit your opponent with the exploding banana ' by varying the angle and power of your throw, taking into account ' wind speed, gravity, and the city skyline. ' ' Speed of this game...

    Gorilla 软件

    Gorilla软件的出现,正是为了解决这个问题,提供一个可靠且易用的平台来存储和管理我们的数字身份。 首先,让我们深入理解一下密码管理软件的核心功能。密码管理软件的主要目标是帮助用户创建、存储和管理复杂的...

    开源项目-gorilla-csrf.zip

    开源项目-gorilla-csrf.zip,gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services

    Rust 的类似 FB Gorilla 的时间序列压缩算法_rust_代码_下载

    本项目"Rust 的类似 FB Gorilla 的时间序列压缩算法"正是利用Rust语言实现的一个库,目标是模仿Facebook的Gorilla时间序列压缩算法。 Facebook的Gorilla压缩算法是一种高效的时间序列数据压缩方法,特别适合用于...

    gorilla.exe

    gorilla大猩猩,是一款密码管理软件,可分类管理各种使用密码,个人使用密码管理工具,即安全又非常好用!

    Carriage of Infants by a Silverback Mountain Gorilla.pdf

    本文报告了在卢旺达卡里索克研究中⼼观察到的一种山地大猩猩(学名:Gorilla gorilla beringei)银背携带幼崽的新奇行为。这种行为在山地大猩猩种群中未曾有过报道,对于理解雄性大猩猩与幼崽之间的互动模式具有重要...

    Gorilla-Player-Support, 这是 public 大猩猩播放器支持网站.zip

    Gorilla-Player-Support, 这是 public 大猩猩播放器支持网站 欢迎访问大猩猩播放器支持网站 这是Gorilla的public 支持网站。在这里,用户可以找到有用的信息,请求新功能,填充 Bug 并请求帮助。 有关产品及其用法的...

    Python库 | gorilla_core-0.2.5.5-py3-none-any.whl

    资源分类:Python库 所属语言:Python 资源全名:gorilla_core-0.2.5.5-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    Android代码-ThisIsEssential

    You heard about Andy Rubin, the co-founder of our beloved operating system Android. You probably heard about his latest tech company, and their first device, the PH-1. It is a beautifully designed ...

    Atom-feeds,golang rss/atom生成器库。通过在github上创建一个帐户为gorilla/feeds开发做出贡献。.zip

    【标题】中的“Atom-feeds”是指一个基于Golang(Go语言)的RSS/Atom生成器库,由gorilla团队开发。RSS(Really Simple Syndication)和Atom是两种广泛使用的互联网内容聚合格式,用于发布博客、新闻和其他定期更新...

    开源项目-gorilla-handlers.zip

    开源项目-gorilla-handlers.zip,gorilla/handlers: A collection of useful handlers for Go's net/http package

    Gorilla Software-开源

    Gorilla Software是一家专注于游戏和Web应用开发的公司,其独特之处在于它采用了开源的方式进行软件构建。开源软件意味着公司的代码库对公众开放,允许社区成员查看、使用、修改和分发代码,以此鼓励协作和创新。...

    gorilla-api-docs:Gorilla API文档

    Gorilla.io文件 的文档站点。 看到他们住。 贡献 先决条件 您将需要: Ruby( >= 1.9.3 ) 邦德勒 设定 分叉存储库 运行以下命令: git clone https://github.com/{gh-username}/gorilla-api-docs.git cd ...

    GoWebsocket:GO中基于Gorilla websockets的简化websocket-client实现

    在GO中基于Gorilla Websocket的简化客户端实现。 概述 该客户端提供以下易于实现的功能 支持发射和接收文本和二进制数据 资料压缩 并发控制 代理支持 设置请求头 子协议支持 SSL验证启用/禁用 安装使用 go get ...

    M38gorilla

    "M38gorilla"是一个与字体相关的主题,很可能是指一种特定的字体设计或者字体库。在计算机领域,字体是用于显示或打印文本的图形样式,它们由一系列字符组成,包括字母、数字和符号,每种字符都有独特的形状和风格。...

    Statistical Shape Analysis

    for instance, the difference between male and female Gorilla skull shapes, normal and pathological bone shapes, etc. Some of the important aspects of shape analysis are to obtain a measure of ...

    Package gorillamux是一个强大的HTTP路由器和URL匹配器,用于构建Go web服务器.zip

    `gorillamux`是Go语言中一个非常著名的HTTP路由库,由`Gorilla`团队开发,全称为`gorilla/mux`。这个库提供了一种高效且灵活的方式来映射HTTP请求到相应的处理函数,使得构建Web服务变得更加简单和强大。 在Go语言...

    Go-GorillaWebSocket是WebSocket协议的Go实现

    在Go语言中,Gorilla WebSocket库是广泛使用的一个实现,它为开发者提供了简单易用的接口来处理WebSocket连接。 Gorilla WebSocket库的核心在于它的`websocket.Upgrader`类型,这个类型提供了将HTTP请求升级到...

Global site tag (gtag.js) - Google Analytics