选择一门语言

优质
小牛编辑
134浏览
2023-12-01

Why do developers choose one programming language over another for a given task?

为什么对一项给定的任务,开发者会偏向于选择某一门语言?

Sometimes I choose raw C when I need blazing speed.

有时候当我需要绝对程序运行效率的时候,我会选择原始C语言。

When I want something that will run on Windows with as small a distribution as possible, I often choose C++ with MFC statically linked.

当我需要一个运行在Windows的软件,而且希望安装包越小越好的时候,我通常会选择静态链接的MFC C++。

When we need a GUI that will run on Mac, Windows, and Linux, a common choice is Java (although the GUI will not be perfect, it will work.)

当我们需要一个能够在Mac,Windows和Linux上面运行的GUI界面程序的时候,很常见的选择就是Java(虽然GUI界面不完美,但至少是能运行的)

For rapid GUI development and really smooth UIs, I like Visual Basic, but I know that I'm going to have to pay the price in the size of the distributable and the fact that I'll be locked into Windows.

对于快速的GUI开发和非常平滑的界面开发,我喜欢Visual Basic,但我知道我要付出的代价是:发布包的大小会变大,并且我的软件将会被限定只能在Windows平台上。

For a command-line tool that must run on any UNIX machine and doesn't need to be fast, perl is a good choice.

对于必须运行在UNIX机器上的命令行工具,而且不需要非常快的话,perl是个不错的选择。

吐槽: 其实perl一般都是调用C底层,还算蛮快的

If you have to run inside a web browser, JavaScript is the really the only choice. In a SQL stored procedure, you usually get to choose between one vendor's proprietary SQL derivative or go home.

如果必须要运行在web浏览器里,JavaScript实际上是唯一的选择了。 在一个SQL存储过程里,通常你除了某个供应商所提供的SQL方言之外别无选择。

What's the Point?

重点是什么?

But I hardly ever choose a language based on syntax. Yeah, I prefer the {}; languages (C/C++/C#/Java). And I have lots of opinions as to what makes a "good" syntax. But I wouldn't accept a 20 MB runtime just to get semicolons.

但我绝对不会因为语法选择一门语言。是的,我更喜欢{};语言(C/C++/C#/Java)。而且对于什么是“好”的语法我有很多观点。但我也不会为了分号语言而接受一个20MB的运行时库。

Which makes me wonder a bit about .NET's cross-language strategy. The idea is, choose any language you want, there are zillions, and they all work the same way.

因此.NET的跨平台策略让我感到惊奇。.NET的出发点是:世界上已经有不计其数的语言,但他们的工作方式却都是相同的,因此你可以选择任何你想要的语言。

VB.NET and C#.NET are virtually identical except for tiny syntactic differences. And other languages that want to be part of the .NET world need to support at least a core set of features and types or they won't be able to Play Well With Others. But how do I develop a UNIX command line utility in .NET? How do I develop a tiny Windows EXE in less than 16K in .NET?

VB.NET和C#.NET除了略微的语法不同之外几乎是一样的。并且其他的语言如果想要成为.NET世界里的一员的话,就必须支持一堆核心的特性和类型,否则他们就无法和.NET世界里的其他成员很好共存。但是我要如何才能使用.NET创建一个UNIX命令行呢?我如何才能使用.NET创建一个小于16K的Windows 可执行程序呢?

It seems like .NET gives us a "choice" of languages precisely where we couldn't care less about it -- in the syntax.

看起来.NET给了我们一种语言选择,正好就是那种让我们完全不用考虑语法的语言