Ballerina 与其他语言有何不同?

How does Ballerina differ from other languages?

Ballerina is a general purpose, concurrent and strongly typed programming language with both textual and graphical syntaxes for better integration

  1. Ballerina 是一种解释性语言吗?
  2. 如何构建 Ballerina 程序?我们需要设置 Ballerina Home 还是 还有其他系统变量吗?
  3. Ballerina 如何支持依赖管理?有没有推荐的 构建工具?
  4. 推荐使用芭蕾舞女演员完成哪些任务?是不是只适合做一个特定的任务,比如各种系统的集成?
  5. 在哪里可以找到语言规范以及 Ballerina 中支持的类型?

Does Ballerina an interpreted language?

Ballerina 编译后解释。

How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?

您可以使用您喜欢的文本编辑器或一些IDE(目前baallerina支持vim、IDEA、sublime Text3、VCS和atom)编写您的ballerina程序。 当您拥有源 bal 文件时。您可以将其打包为归档文件(库、服务或主文件)或简单地 运行 单个 bal 文件。 例如ballerina run main <path to bal path> (or you can give the path to archive)ballerina run service <path to archibe (or you can give the path to archive .bsz)>

您不必把 Ballerina 放在家里。它将由芭蕾舞演员自己设定。但是你需要设置 JAVA_HOME

How Ballerina supports dependency management? Are there any recommended build tools?

它与 Go 语言非常相似,请参阅文档以获取更多信息。

What kind of tasks are recommended to do with Ballerina? Is it only suitable to do a specific task such as integration of various system?

如果您的程序包含大约 80% 或更多的集成场景,那么 Ballerina 将是一个很好的尝试对象。但是,如果集成部分少得多 (< 20%),那么您可以考虑其他方法。如果部分不同,那么您可以根据您的用例来决定。

Where can I find language specification and what are the types supported in Ballerina?

更多信息请参考Github location and Ballerinalang

服务和参与者的第一个 class 表示非常适合集成。但从开发人员的角度来看 —— 这些只是抽象,您可以在任何现代语言中以可重用的方式轻松实现。所以起初这似乎没什么大不了的。但如果你仔细观察,ballerina 不仅提供这些抽象 OOTB —— 而且还负责性能等事情,这样开发人员就不必担心这些事情。值得注意的是 HTTP 连接池、流式传输等等。 Spring 例如,在他们的 RestTemplate OOTB 中不提供连接池,并且大多数情况下开发人员不会担心这一点,直到他们的应用程序性能非常糟糕。

Ballerina 应该提供 OOTB 或执行所有市场上的集成最佳实践,我希望将添加更多这些最佳实践,尤其是断路器。如果我们可以获取连接器的事件流,以便可以使用 netflix 的 hystrix 仪表板进行监控,那也很棒。

是的,这正是我们的意图 - Ballerina 将很好地理解编写分布式交互的意义,这些交互预计会表现良好、行为可靠且有弹性并安全地工作。

我们没有考虑过连接器的事件流来支持 Hystrix 仪表板,但会考虑!

  1. Is Ballerina an interpreted language?

Ballerina 是一种编译型编程语言。它编译成平台中立的二进制形式,然后由 Ballerina 运行time 解释。

  1. How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?

芭蕾舞女演员没有系统变量的概念。从 https://ballerina.io/downloads/

下载并安装 OS 特定的安装程序

运行 芭蕾舞节目

使用ballerina run 命令编译和运行 Ballerina 程序。

$ ballerina run hello.bal
Hello, World!

使用ballerina build命令生成扩展名为"balx"的静态链接可执行二进制文件。然后使用ballerina run命令到运行程序。

$ ballerina build hello.bal
$ ls 
hello.bal hello.balx
$ ballerina run hello.balx
Hello, World!
  1. How Ballerina supports dependency management? Are there any recommended build tools?

一个 Ballerina 程序通常由多个 Ballerina 程序包组成。包是源文件的集合。它定义了一个命名空间,包中所有源文件中的符号都属于该命名空间。如果你想引用另一个包中定义的符号,你需要先导入那个包,然后你可以用包名引用符号。

当您想要执行或构建 Ballerina 程序时,Ballerina 使用您的程序目录、内置存储库解析所有导入包(Ballerina 发行版包含所有核心库包以及一些第三方连接器包) ,或 Ballerina 存储库目录。 Ballerina 存储库是您机器上可用的本地存储库。

我们将来会开发工具供您管理 Ballerina 存储库。