[翻译Joel On Software]选择一门语言/Choosing a language
Choosing a language
选择一门语言
by Joel Spolsky Sunday, May 05,2002
Why do developerschoose one programming language over another for a given task?
为什么对一项给定的任务,开发者会偏向于选择某一门语言?我啥事也干不了。
Sometimes I choose raw C when I needblazing speed.
有时候当我需要飞速的时候我会选择原始C语言。
When I want something that will run onWindows with as small a distribution as possible, I often choose C++ with MFC staticallylinked.
当我要写个东西运行在Windows而且希望发布包越小越好的时候,我通常会选择静态链接的MFC C++。
When we need a GUI that will runon Mac, Windows, and Linux, a common choice is Java (although the GUI willnot be perfect, it will work.)
当我们需要一个能够在Mac,Windows和Linux上面运行的GUI界面程序的时候,一个通常的选择就是Java(虽然GUI界面不完美,但至少是能工作的)
For rapid GUI development and reallysmooth UIs, I like Visual Basic, but I know that I'm going to have to pay theprice in the size of the distributable and the fact that I'll be locked intoWindows.
对于快速的GUI开发和非常平滑的界面开发,我喜欢Visual Basic,但我知道我要付出的代价是发布包的大小和我会被框定在Windows平台上。
For a command-line tool that must run onany UNIX machine and doesn't need to be fast, perl is a good choice.
对于必须运行在UNIX机器上的命令行工具,而且不需要非常快的话,perl是个不错的选择。
If you have to run inside a web browser,JavaScript is the really the only choice. In a SQL stored procedure, youusually get to choose between one vendor's proprietary SQL derivative or gohome.
如果必须要运行在web浏览器里,JavaScript实际上是唯一的选择了。在一个SQL写成的存储过程里,你通常要选择一个供应商所有的SQL方言或者 放弃。
What's the Point?重点是什么?
But I hardly ever choose a language basedon syntax. Yeah, I prefer the {}; languages (C/C++/C#/Java). And I have lots ofopinions as to what makes a "good" syntax. But I wouldn't accept a 20MB runtime just to get semicolons.
但我几乎不会因为语法选择一门语言。是的,我更喜欢{};语言(C/C++/C#/Java)。而且对于什么是“好”的语法我有很多观点。但我不会为了要分号而接受一个20MB的运行时库。
Which makes me wonder a bit about .NET'scross-language strategy. The idea is, choose any language you want, there arezillions, and they all work the same way.
这让我对.NET的跨平台策略感到有点惊奇。想法是,选择任何你想要的语言,已经有不计其数的语言,他们的工作方式都是相同的。
VB.NET and C#.NET are virtually identicalexcept for tiny syntactic differences. And other languages that want to be partof the .NET world need to support at least a core set of features and types orthey won't be able to Play Well With Others. But how do I develop a UNIXcommand line utility in .NET? How do I develop a tiny Windows EXE in less than16K 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似乎给了我们一种语言选择,在语法上要操心更多。