elixir 規格_Elixir:一種高畫質的編程語言

elixir 規格

by CityBase

按CityBase

Elixir:一種高畫質的編程語言 (Elixir: A Big-Picture Programming Language)

Elixir使程序員的工作更好,并且使他們的工作更好 (Elixir makes programmers better at their work, and it makes their work better)

About a year ago, I decided to pursue the chance to work with Elixir full time as lead engineer at CityBase. Since I began using the programming language in 2014, my goal has been to use, grow, and learn more from Elixir.

大約一年前,我決定尋求機會與Elixir一起在CityBase擔任首席工程師。 自2014年開始使用編程語言以來,我的目標一直是使用,發展和學習Elixir。

CityBase attracted me for other reasons, too. I’ve always been curious about making complex systems work better. With government technology, we have the challenge to make some of the most complex systems work more effectively for people on a massive scale, to massive impact.

CityBase也因其他原因吸引了我。 我一直對使復雜系統更好地工作感到好奇。 借助政府技術,我們面臨著使一些最復雜的系統更有效地工作的挑戰,從而使大規模的人們受益。

These objectives — growing Elixir and coding for large-scale impact — are in my opinion the same. I really believe that today, reliability, concurrency, and fault tolerance are foundational qualities that most applications should be built on. Elixir can help with that based on a battle-proven list of applications and concepts.

在我看來,這些目標-增長Elixir和編寫具有廣泛影響力的代碼-是相同的。 我真的相信,今天,可靠性,并發性和容錯能力是大多數應用程序應建立的基礎素質。 Elixir可以根據經過實踐驗證的應用程序和概念列表為您提供幫助。

一種經過考驗的新語言 (A New Language with Tested Roots)

Elixir is a new language created in 2011. It’s built with the principles of Erlang, a system developed in 1986 for the telecom industry. Erlang is the reason your phone is never temporarily shut down for maintenance. It’s responsible for hardware flexibility and scalability, so you can replace a phone and have your account work the same, and add new phone lines without affecting performance.

Elixir是2011年創建的一種新語言。它是根據1986年為電信行業開發的系統Erlang的原則構建的。 Erlang是您的手機永遠不會出于維護目的而永久關閉的原因。 它負責硬件的靈活性和可伸縮性,因此您可以更換電話并讓您的帳戶保持不變,并添加新的電話線而不會影響性能。

Even though Elixir is relatively young, it relies on Erlang’s proven virtual machine (VM), called BEAM, and its principles of high availability, adaptability, and scalability. These features are exceptionally important in govtech applications, where the fundamental services delivered by technology must be available to everyone.

盡管Elixir相對較年輕,但它依賴于Erlang久經考驗的虛擬機(VM)(稱為BEAM)及其高可用性,適應性和可伸縮性的原理。 這些功能在govtech應用程序中尤為重要,在該應用程序中,技術交付的基本服務必須對所有人都可用。

程序員的編程語言 (The Programmer’s Programing Language)

Engineers like me are excited to work with Elixir because it helps us be better at our jobs. To code with Elixir, developers need to be in tune with overall business objectives, and code with the future flexibility in mind.

像我這樣的工程師很高興與Elixir合作,因為它可以幫助我們更好地開展工作。 要使用Elixir進行編碼,開發人員需要與總體業務目標保持一致,并在考慮未來靈活性的情況下進行編碼。

It includes tools that encourage programmers to plan around what can go wrong, and focus on getting as close as possible to the ideal outcome for the end user.

它包含一些工具,這些工具可以鼓勵程序員圍繞可能出現的問題進行計劃,并專注于盡可能接近最終用戶的理想結果。

Having programmers who understand the desired big-picture outcomes can be a game changer.

讓程序員了解所需的總體效果可以改變游戲規則。

If you ask someone to write code that performs a certain function, they’ll write that code. But if you ask them to write code that leads to an experience or solves a problem, they may think of a solution you never considered — and foresee problems you didn’t know existed.

如果您要求某人編寫執行特定功能的代碼,那么他們將編寫該代碼。 但是,如果您要求他們編寫可帶來經驗或解決問題的代碼,則他們可能會想到您從未考慮過的解決方案-并預見到您不知道存在的問題。

Elixir encourages this kind of big-picture thinking in its DNA. A shared characteristic of Elixir and Erlang is that they are holistic programming languages. You could easily use Elixir to develop just one service, but it is optimized for developing large systems of many services.

Elixir在其DNA中鼓勵這種大圖思維。 Elixir和Erlang的共同特點是它們是整體編程語言。 您可以輕松地使用Elixir僅開發一項服務,但是它已針對開發包含許多服務的大型系統進行了優化。

容錯的語言 (A Language That’s Fault-Tolerant)

Like death and taxes, another certainty in life is that things will go wrong.

像死亡和稅收一樣,生活中的另一個確定性是事情會出錯。

Elixir has native fault tolerance for the two major types of programming errors.

Elixir具有兩種主要類型的編程錯誤的本機容錯能力。

錯誤類型1 (Error Type 1)

The rarest issues are usually discovered in production and are by definition harder to test for. For instance, connectivity (when a service goes down or is taking longer than expected) between a third-party service or a system resource, such as a database.

最稀有的問題通常在生產中發現,并且根據定義很難進行測試。 例如,第三方服務或系統資源(例如數據庫)之間的連接(當服務中斷或花費比預期更長的時間)。

To be fault-tolerant to these issues, your system must always be available to customers by using at least two servers. This is to address hardware issues, network problems, or other errors that live outside your program.

為了容忍這些問題,您的系統必須始終通過至少使用兩臺服務器供客戶使用。 這是為了解決程序外部的硬件問題,網絡問題或其他錯誤。

Elixir runs on Erlang’s BEAM VM, which is configured as a mini OS on top of the server OS. The VM is responsible for the communication between servers and nodes. A node will be notified when another node is down, and the system will act in response.

Elixir在Erlang的BEAM VM上運行,該BEAM VM被配置為服務器OS之上的迷你OS。 VM負責服務器和節點之間的通信。 當另一個節點關閉時,將通知該節點,系統將作為響應進行操作。

錯誤類型2 (Error Type 2)

Issues associated with data are easier to test and can be reproduced locally. For example, if a function that does any math calculation receives a string instead of a number, that function will fail.

與數據相關的問題更易于測試,可以在本地復制。 例如,如果執行任何數學計算的函數收到的是字符串而不是數字,則該函數將失敗。

For a program to be fault-tolerant here, your system must be able to “heal” itself during errors stemming from logic bugs, wrong input data, and other internal failures.

為了使程序在這里具有容錯性,您的系統必須能夠在由于邏輯錯誤,錯誤的輸入數據和其他內部故障而引起的錯誤中“自我修復”。

As Elixir is a compiled language, any mistakes in the code prevent the application from starting. This ensures that running applications at least have a valid starting state.

由于Elixir是一種編譯語言,因此代碼中的任何錯誤都會阻止應用程序啟動。 這樣可以確保正在運行的應用程序至少具有有效的啟動狀態。

For this to work smoothly, the Erlang VM uses something called the supervision principle, which goes like this:

為了使此操作順利進行,Erlang VM使用了稱為“監督原則”的東西,如下所示:

  • Processes are structured based on the idea that there are both “worker” and “supervisor” modules built into a given program.

    流程是基于這樣的思想構造的:給定程序既內置了“工人”模塊,又內置了“主管”模塊。
  • Workers perform computations, and supervisors monitor workers.

    工人進行計算,主管監督工人。
  • If something goes wrong, a supervisor can restart a worker to its initial valid state.

    如果出現問題,主管可以將工作人員重新啟動到其初始有效狀態。

The supervision principle is associated with process isolation, when one module can run in one isolated process. This ensures that errors in one module will not affect other parts of the application, and you can restart that module in isolation as well.

當一個模塊可以在一個隔離的進程中運行時,監督原則與流程隔離相關。 這樣可以確保一個模塊中的錯誤不會影響應用程序的其他部分,并且您也可以獨立地重新啟動該模塊。

模塊化且可擴展構建的語言 (A Language That’s Modular and Built to Scale)

Elixir is a modular language, meaning that you can modify self-contained parts without worrying about impacting other, unrelated parts. Microservices function concurrently. These code-based actions all play roles in the greater program you’ve created, but tasks are distributed so that they are not dependent on one another to work. This reinforces the benefits of failing fast — you take one faulty player out, and the game still continues.

Elixir是一種模塊化語言,這意味著您可以修改獨立的零件而不必擔心會影響其他不相關的零件。 微服務同時運行。 這些基于代碼的動作都在您創建的更大程序中扮演角色,但是任務是分布式的,因此它們彼此不依賴。 這增強了快速失敗的好處-您將一名錯誤的玩家帶出,游戲仍然繼續。

This also becomes crucial as a codebase grows: in non-modular systems, it’s not always clear when one part impacts others — or which other parts it might impact. This means that even the smallest change requires that you test everything to ensure that the change didn’t break anything. This makes for a daunting amount of work, which means projects move slowly and require lots of people.

隨著代碼庫的增長,這也變得至關重要:在非模塊化系統中,并不總是清楚某個部分何時會影響其他部分,或者它可能影響哪些其他部分。 這意味著即使最小的更改也需要您測試所有內容,以確保更改不會破壞任何內容。 這需要艱巨的工作量,這意味著項目進展緩慢,需要很多人。

It also means that training new developers is difficult and time-consuming, as they must familiarize themselves with a complex code legacy in order to effectively expand it.

這也意味著培訓新的開發人員既困難又費時,因為他們必須熟悉復雜的代碼遺產才能有效地進行擴展。

With Elixir, developers focus on the future, and ensure they’re coding for new or evolving goals, rather than a previous vision that’s baked into overly complex code.

使用Elixir, 開發人員可以著眼于未來,并確保他們正在為新的或不斷發展的目標進行編碼 ,而不是將先前的愿景植入過于復雜的代碼中。

Beyond its modularity, Elixir is also highly scalable. The language enables you to start building an application running only one or two servers and to add more as needed. Together, the servers function as part of a cluster in a distributed system to achieve high availability and scalability.

除了模塊化之外,Elixir還具有高度可擴展性。 使用該語言,您可以開始構建僅運行一臺或兩臺服務器的應用程序,并根據需要添加更多服務器。 服務器一起作為分布式系統中群集的一部分,以實現高可用性和可伸縮性。

Within that cluster, servers communicate using an Erlang-based protocol, rather than having to implement or use any application protocol like HTTP, and pick a data serialization/deserialization option like JSON or Protocol Buffers. That means you don’t need to implement anything to pass data between services in different servers/nodes. This is huge in terms of complexity of logic for communication.

在該群集中,服務器使用基于Erlang的協議進行通信,而不必實現或使用任何應用程序協議(例如HTTP),并選擇數據序列化/反序列化選項(例如JSON或協議緩沖區)。 這意味著您無需執行任何操作即可在不同服務器/節點中的服務之間傳遞數據。 就通信邏輯的復雜性而言,這是巨大的。

沒有利基的語言 (A Language That Has No Niche)

Obviously, I’m a fan of Elixir. It’s got a lot going for it, from its proven infrastructure to its scalability. But maybe the coolest thing about this language is that it’s industry agnostic. Already, it’s been adopted by a range of companies, for a variety of purposes: WhatsApp, Bleacher Report, Netflix, Pinterest, Postmates, and a handful of .gov sites all use Elixir or Erlang.

顯然,我是Elixir的粉絲。 從成熟的基礎架構到可擴展性,它有很多工作要做。 但是,也許關于這種語言的最酷的事情是它與行業無關。 它已經被許多公司用于各種目的:WhatsApp,Bleacher Report,Netflix,Pinterest,Postmates和少數.gov網站都使用Elixir或Erlang。

This is a plus for several reasons: first, it means that the language is likely to continue to grow in popularity as companies recognize the benefits it can offer. That, in turn, means that developers will continue to learn it, which means there’s not likely to be a shortage of developers who know Elixir. Companies of all sizes should be able to find developers at all levels to work with Elixir.

這是一個加號,其原因如下:首先,這意味著隨著公司認識到它可以提供的好處,該語言可能會繼續流行。 反過來,這意味著開發人員將繼續學習它,這意味著知道Elixir的開發人員不會很短缺。 各種規模的公司都應該能夠找到各個層次的開發人員來與Elixir合作。

Given the power this language has to improve user experience, minimize downtime, and make life easier for dev teams, these are indicators everyone should be cheering — especially those of us in engineering and programming fields.

鑒于該語言具有改善用戶體驗,最大程度地減少停機時間并簡化開發團隊生活的功能,這些都是每個人都應該歡呼雀躍的指標,尤其是我們在工程和編程領域的指標。

For those of us in govtech, Elixir is especially promising, as it embodies the kind of resilience and long-term focus essential to making governments function better for everyone.

對于我們中的那些政府官員來說,Elixir尤其具有發展前途,因為它體現了韌性和長期關注點,這對于使政府更好地發揮作用至關重要。

? ? ?

???

By Pedro Assumpcao, Lead Software Engineer at CityBase

作者:CityBase的首席軟件工程師Pedro Assumpcao

翻譯自: https://www.freecodecamp.org/news/elixir-a-big-picture-programming-language-755dcef2fa6a/

elixir 規格

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/394798.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/394798.shtml
英文地址,請注明出處:http://en.pswp.cn/news/394798.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

python截圖識別文字_用百度ocr+微信截圖實現文字識別

作用:將圖片中的文字識別出來 一、調用微信截圖dll控件 將微信截圖插件復制到項目文件,使用ctypes加載(膠水語言就是給力) def capture(): try: dll ctypes.cdll.LoadLibrary(PrScrn.dll) except Exception: print("Dll loa…

MySQL啟動很慢的原因

我們在啟動MySQL的時候,常常會遇到的是, 當執行啟動命令后,它會"Start MySQL ....." 一直不停的執行,也不中斷,也不成功 這里會出現此現象的原因有以下三條: 1. 配置文件中的InnoDBuffer數大于物…

linux線程出錯,在線程應用程序(linux,pthreads)中讀取文件大小時出錯

我試圖從Linux中的文件夾中讀取所有文件和目錄,其線程為 獲取最大文件大小&當前目錄和當前目錄樹下的名稱。在線程應用程序(linux,pthreads)中讀取文件大小時出錯主線程掃描基本目錄查找文件,當找到它的目錄時,會生成一個新線…

【用jQuery來判斷瀏覽器的類型】及【javascript獲取用戶ip地址】

用jQuery來判斷瀏覽器的類型,主要是使用$.browser這個工具類,使用方法: $.browser.[瀏覽器關鍵字] //谷歌瀏覽器、360瀏覽器等其他一些瀏覽器,沒有專門的判斷 function appInfo() {var bro $.browser;var binfo "";if (bro.msie) {binfo "Micr…

python函數學習1

函數1 (1)定義: def 函數名(參數列表)函數體 (2)參數傳遞: 在python中,一切都是對象,類型也屬于對象,變量是沒有類型的。 a [1,2,3] a "he…

kafka應用于區塊鏈_Apache Kafka的區塊鏈實驗

kafka應用于區塊鏈by Luc Russell盧克羅素(Luc Russell) Apache Kafka的區塊鏈實驗 (A blockchain experiment with Apache Kafka) Blockchain technology and Apache Kafka share characteristics which suggest a natural affinity. For instance, both share the concept o…

pythonfor循環100次_以寫代學: python for循環 range函數 xrange函數

腳本一: #!/usr/bin/env python # coding: utf8 sum100 0 for i in range(101): sum100 i #(1)range是一個可以取值的函數,上邊這個取的是0-100,并不包含101 #(2)也可以指定,比如r…

iis下php 500錯誤

很不想用iis,然而客戶不想增加機器,只好按客戶的意思了。可是沒想到發送短信以在本地 機器上是好的,在iis下直接500。 ??一開始以為是防火墻問題,后來檢查了一下沒有,再后來換了一個短信接口,就莫名其妙好…

linux mv 遞歸拷貝,奇技淫巧 - 給Linux中的cp和mv命令中添加進度條的高級拷貝

GNU cp和GNU mv命令用于在GNU/Linux操作系統中復制和移動文件和目錄。這兩個命令缺少的一個特性是它們不顯示任何進度條。如果復制一個大文件或目錄,您就不知道完成復制過程需要多長時間,也不知道復制的數據所占的百分比。還有您將看不到當前正在復制哪個…

webgl 著色器_如何在WebAssembly中使用WebGL著色器

webgl 著色器by Dan Ruta通過Dan Ruta 在WebAssembly中使用WebGL著色器 (Using WebGL shaders in WebAssembly) WebAssembly is blazing fast for number crunching, game engines, and many other things, but nothing can quite compare to the extreme parallelization of …

【洛谷P1966】火柴排隊

兩列排序后將編號一一對應 歸并排序求逆序對 &#xff08;每一次交換就去掉一個逆序對&#xff09; 1 #include<cstdio>2 #include<cstring>3 #include<algorithm>4 #define ll long long5 using namespace std;6 const int N100100;7 const ll P99999997;8 …

python字符串補空格輸出_Python去除空格,Python中常見字符串去除空格的方法總結...

今天小編就為大家分享一篇關于Python去除字符串前后空格的幾種方法&#xff0c;小編覺得內容挺不錯的&#xff0c;現在分享給大家&#xff0c;具有很好的參考價值&#xff0c;需要的朋友一起跟隨小編來看看吧&#xff1a; Python去除空格方法一&#xff1a; strip()方法&#x…

Alan Walker MV 合輯01 by defender

Alan Walker MV合輯 出來啦&#xff01; 百度網盤下載地址&#xff1a; 鏈接&#xff1a;https://pan.baidu.com/s/10WSool70XBe_8tJOae8V-w 提取碼&#xff1a;uckq 地址查看Microsoft Onedrive Download Address:  BE DELETED Google Drive Download Address&#xff1a; …

scanf函數具體解釋與緩沖區

1.基本信息 函數原型&#xff1a; int scanf( char *format, args, ...); 函數返回值&#xff1a; 讀入并賦給args的數據個數。遇到文件結束返回EOF&#xff0c;出錯返回0。 函數功能&#xff1a; scanf函數是格式化輸入函數&#xff0c;它從標準輸入設備(鍵盤)讀取輸入的信息。…

linux中win文件轉為unix,如何將文本文件從Windows轉換為Unix

從Unix轉換到Windows時&#xff0c;我得到正確的輸出;但是&#xff0c;從Windows到Unix時&#xff0c;我得到了一些奇怪的輸出。我認為我必須允許的是刪除回車\ r。雖然這不起作用。當我運行代碼后打開文本文件時&#xff0c;我得到了一些奇怪的結果&#xff0c;第一行是正確的…

程序員偽造一年工作經驗_試火—如何偽造程序員

程序員偽造一年工作經驗2017年9月6日 (6 September 2017) Sweat is running down my face. I’m staring down a blank sublime text document. What on earth am I doing? My hands are resting above the keyboard of my MacBook pro.汗水順著我的臉。 我盯著一個空白的崇高…

在unity中設置多種怪物數據_Unity可編程渲染管線(SRP)系列(三)——光照(單通道 正向渲染)...

本文重點:1、漫反射著色2、支持方向光、點光源和聚光燈3、每幀允許16個可見光源4、每個對象最多計算四個像素光和四個頂點光這是涵蓋Unity可編寫腳本的渲染管線的教程系列的第三部分。這次&#xff0c;我們將通過一個Drawcall為每個對象最多著色8個燈光來增加對漫反射光照的支持…

Java內部類的定義和使用

為什么要用到內部類&#xff1a; 在java開發學習中我們經常會碰到內部類。內部類又有很多的優勢&#xff1a;首先舉一個簡單的例子&#xff0c;如果你想實現一個接口&#xff0c;但是這個接口中的一個方法和你構想的這個類中的一個方法名稱參數相同&#xff0c;你應該怎么辦&am…

蛋清打發奶油狀

在做蛋糕、冰淇凌、面包之類的時候往往都需要奶油狀蛋清&#xff0c;讓蛋糕、面包更蓬松&#xff0c;冰激凌也可以使用其當做奶油來用。用料 雞蛋4個 根據用量選擇鹽(只做冰激凌用奶油放)5g(根據蛋量)白醋(可以不放&#xff0c;根據喜好)5g(根據蛋量)白砂糖40g(分三次放)根據…

react構建_您應該了解的有關React的一切:開始構建所需的基礎知識

react構建by Scott Domes由斯科特多姆斯(Scott Domes) 您應該了解的有關React的一切&#xff1a;開始構建所需的基礎知識 (Everything You Should Know About React: The Basics You Need to Start Building) Are you curious about React and haven’t had the chance to lea…