自己设计编程语言_关于编程语言设计

自己设计编程语言

What makes us different from all other species? Well, several things. We are the only species that has a sense of humor. We’re the only ones that cry. But, most importantly, we’ve been changing ourselves and the world around us faster than any other living being.

是什么使我们与所有其他物种不同? 好吧,几件事。 我们是唯一具有幽默感的物种。 我们是唯一哭泣的人。 但是,最重要的是,我们改变自己和周围世界的速度比任何其他生物都要快。

Take a look at where you are today. You may be some meters above ground level. You can control the weather inside those walls. To go somewhere, you can take your pick from a medley of means of transportation. You have power in the form of electricity coming out of plugs in the walls. You have the Internet flowing in the air.

看看您今天的位置。 您可能在地面上方几米的地方。 您可以控制这些墙内的天气。 要去某个地方,您可以选择多种交通工具。 您可以通过墙壁上的插头来获得电力。 您的互联网络绎不绝。

If you have all these, it’s because humankind has two big advantages: we are tool builders, and we have language.

如果拥有所有这些,那是因为人类有两个很大的优势:我们是工具制造商,而我们有语言。

工具和语言 (Tools and Language)

The pen, the airplane, the clock, the phone: tools. Aristoteles’ work on logic, Newton’s “Principia Mathematica”, Darwin’s “Origin of the Species”, Einstein’s “Theory of Relativity”: language. All human civilization was built upon tools and language.

笔,飞机,时钟,电话:工具。 亚里士多德的逻辑著作,牛顿的《数学原理》,达尔文的《物种起源》,爱因斯坦的《相对论》:语言。 所有人类文明都是建立在工具和语言之上的。

When we think about a problem, some of us might see images, but all of us use words to think. The most common view is that language is a way for us to communicate. But it’s way more than that: it’s also a tool for us to think with higher-level concepts.

当我们想到一个问题时,我们中的一些人可能会看到图像,但是我们所有人都使用文字进行思考。 最普遍的观点是语言是我们交流的一种方式。 但这不仅限于此:它还是我们思考更高层次概念的工具。

And the language itself influences the way we think. A study showed that people whose native language has no strong future tense (like German or Finish, where they say “I go to the cinema tomorrow” instead of “I’ll go to the cinema tomorrow”) save more for retirement and have lower smoking rates. People don’t distance themselves from their future selves.

语言本身会影响我们的思维方式。 一项研究表明,母语不强的人(例如德语或完成语,他们说“我明天去电影院”而不是“明天我去电影院”)会为退休储蓄更多,而收入却较低吸烟率。 人们不会与未来的自己疏远。

There is an aboriginal tribe in Australia that does not have the words ‘left’ or ‘right’, only ‘North’, ‘South’, ‘East’ and ‘West’, so they have a far better sense of direction than everyone else.

澳大利亚有一个原住民部落,没有“左”或“右”两个词,只有“北”,“南”,“东”和“西”,所以他们的方向感比其他所有人都好。

So what a language doesn’t have is just as important as what it does have. The core of a language is not words and sentences; it’s the meaning of them in the heads of the people who use it.

因此,一种语言所没有的和它所拥有的一样重要。 语言的核心不是单词和句子。 这是使用它的人们头脑中的意义。

Now say, for example, the word ‘pen’. A mental image of the object crops into your head, which may not necessarily be the same as the mental image of someone who speaks another language. Yet there is a universal consensus of what the word ‘pen’ represents.

现在说,例如“ pen”一词。 对象的心理形象会渗入您的脑海,这不一定与说另一种语言的人的心理形象相同。 然而,关于“笔”这个词的含义已经达成了普遍共识。

The same can be said about programming languages. That’s where visual language comes in.

关于编程语言也可以这样说。 这就是视觉语言的用武之地。

从口语到视觉 (From Spoken to Visual)

The words that make up a language do indeed affect the way in which a person processes the world around them, but it’s not the only means of referring to objects or actions. Graphic, or visual, communication is not simply aesthetic, but rather has a functional role in communicating. In programming language, that couldn’t be more obvious.

构成语言的单词确实确实会影响一个人处理周围世界的方式,但这不是指代对象或动作的唯一手段。 图形或视觉交流不仅是美学上的,而且在交流中具有功能性作用。 在编程语言中,这再明显不过了。

Let me give you an example. The other day, a colleague of mine was working on an application using the OutSystems low-code visual language. She looked at a timer and immediately said that it would not scale and that she needed a “heavy timer”.

让我举一个例子。 前几天,我的一位同事正在使用OutSystems低代码可视语言开发应用程序。 她看着一个计时器,立即说这不会缩放,她需要一个“沉重的计时器”。

Image for post

A heavy timer is a pattern known by advanced OutSystems developers, where records are processed, thus committing the transaction, and, after a specified time, the timer wakes itself over again. It works like a processing queue.

繁重的计时器是高级OutSystems开发人员已知的一种模式,在该模式下,记录会被处理,从而提交事务,并且在指定的时间后,计时器会自动将其唤醒。 它像处理队列一样工作。

So it is not part of our core visual language, it’s part of our extended language. But it’s also a tool that allowed her to spot a problem and a fix at a higher level. She saw it in her head. She heard it in her head. And then she fixed it.

因此,它不是我们核心视觉语言的一部分,而是我们扩展语言的一部分。 但这也是使她能够发现问题并在更高级别进行修复的工具。 她在脑海中看到了它。 她在脑海里听到了。 然后她修好了。

Regarding programming languages, you may already know this quote:

关于编程语言,您可能已经知道以下引用:

Image for post

Naming things… Language, right? But let’s focus on another one: do you know why there are so many off-by-one errors? Because arrays start counting with 0 instead of 1, unlike humans do.

命名……语言,对不对? 但是,让我们关注另一个问题:您知道为什么会有如此多的一对一错误吗? 因为数组从0开始计数而不是1,这与人类不同。

Another: Tony Hoare, the creator of Algol (a precursor of C) said that null references were his billion-dollar mistake. Every time I see C# or Java code, with all those null checks, I know that’s a severe underestimation.

另一个:Algol(C的前身)的创建者Tony Hoare表示,空引用是他数十亿美元的错误。 每当我看到C#或Java代码以及所有这些null检查时,我就知道这是一个严重的低估。

A last one: Why do object-oriented languages lead to messy spaghetti code? Because of inheritance and because state is spread all over. That doesn’t happen so much in our visual language as there is no inheritance.

最后一个:为什么面向对象的语言导致混乱的意大利面条代码? 因为继承,而且因为状态遍布各地。 在我们的视觉语言中,这没有发生太多,因为没有继承。

那么,OutSystems在做什么呢? (So What’s OutSystems Doing About it?)

Our company is lucky to be focused. OutSystems is not for creating websites, games, scientific research, or operating or embedded systems. Our low-code approach allows the creation of enterprise web and mobile apps. At the same time, the scope is so broad, and there is so much need for it, that if we continue evolving in the right way, we might have an impact in future programming languages and tools.

我们公司很幸运能专注。 OutSystems不适用于创建网站,游戏,科学研究或操作系统或嵌入式系统。 我们的低代码方法允许创建企业Web和移动应用程序。 同时,范围如此之广,并且有太多的需求,以至于如果我们以正确的方式继续发展,可能会对未来的编程语言和工具产生影响。

And as for the difference between language and tool: our users don’t care if something is solved with the tool or with the language. They view it as a whole. They may think “How can I solve this pain/new challenge?”, and we at OutSystems understand their struggles and needs. And we can offer a solution to solve their problem. What’s important is the whole developer experience.

至于语言和工具之间的区别:我们的用户不在乎是否使用工具或语言解决了某些问题。 他们将其视为一个整体。 他们可能会想“我该如何解决这个痛苦/新挑战?”,因此OutSystems的我们了解他们的挣扎和需求。 我们可以提供解决方案来解决他们的问题。 重要的是整个开发人员的经验。

So these choices matter. What we put in the tool and on the language, and how they work together, matters. It’s hard to make these calls, but it’s supposed to be hard. Because OutSystems is a pioneer in low-code, and our choices might live a lot longer than us or this company. They will be our legacy.

因此,这些选择很重要。 我们在工具和语言中的投入以及它们如何协同工作至关重要。 很难打这些电话,但应该很难。 因为OutSystems是低代码的先驱,所以我们的选择可能比我们或这家公司的寿命更长。 他们将是我们的遗产。

设计工具和语言 (Designing a Tool and a Language)

Programming languages were born from the bottom up as a way for people to understand, and leverage, how computers work. That view is now outdated; it should be the other way around.

编程语言是自下而上诞生的,是人们理解和利用计算机工作方式的一种方式。 这种观点现在已经过时了。 它应该是相反的方式。

A programming language and tool needs to be a way for computers to understand what humans want. And for humans to think and work collaboratively on higher-level challenges.

编程语言和工具必须成为计算机了解人类需求的一种方式。 并让人们思考和协作应对更高级别的挑战。

That’s our contribution to human evolution: making a language and tool that work together in that way is our noble responsibility.

那就是我们对人类进化的贡献:使一种语言和工具以这种方式协同工作是我们的崇高责任。

Based on an internal presentation.

基于内部演示。

Watch OutSystems visual language in action

观看OutSystems视觉语言的实际应用

Image for post

翻译自: https://medium.com/outsystems-engineering/on-programming-language-design-f02617651ab4

自己设计编程语言

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值