简体   繁体   English

如何比较工作中的项目的编程语言?

[英]How do I compare programming languages for projects at work?

I am wondering what are some specific questions I should keep in mind when I am comparing programming languages for use on given work projects. 我想知道当我比较用于给定工作项目的编程语言时,我应该记住哪些具体问题。 For instance, I am told logic programming languages like Prolog are good for natural language processing. 例如,我被告知像Prolog这样的逻辑编程语言对自然语言处理很有用。 I'm not sure why exactly; 我不确定为什么; I assume it is true because experts say so, but I don't know the consideration that guides them to that conclusion. 我认为这是真的,因为专家这么说,但我不知道引导他们得出这个结论的考虑因素。 So I am looking for a simple heuristic, a checklist of questions, I can apply to evaluate programming languages and be able to explain my decisions, so that I can say "Language X is good for Y because it does Z." 所以我正在寻找一个简单的启发式方法,一个问题清单,我可以申请评估编程语言并能够解释我的决定,这样我就可以说“语言X对Y有好处,因为它有Z.”

The only way I know of to figure out which programming language is most appropriate for a given problem, is to know lots of programming languages. 我知道找出哪种编程语言最适合给定问题的唯一方法就是了解很多编程语言。 After all, if you don't know screwdrivers exist, how will you know not to use a hammer when you encounter a screw? 毕竟,如果您不知道螺丝刀存在,当您遇到螺丝时,您怎么知道不使用锤子?

Unfortunately, there are thousands (maybe tens of thousands) of programming languages, so learning even a significant portion of them is just not realistic. 不幸的是,有数千种(可能是数万种)编程语言,所以学习它们中的很大一部分都是不现实的。

However, programming languages implement paradigms . 但是,编程语言实现了范例 And Peter van Roy's famous poster only lists about 34 of those. 而彼得范罗伊的着名海报只列出了其中的34个。 Although he deliberately decided to ignore several aspects, including anything related to typing, so the real number is probably higher than that. 虽然他故意决定忽略几个方面,包括与打字有关的任何事情,所以实际数字可能高于此。 But we can expect it to be well below 100. 但我们可以预期它会远低于100。

That's still a lot, though, but thankfully, paradigms aren't atomic either, they are composed of concepts . 尽管如此,这仍然很多,但幸运的是,范式也不是原子的,它们是由概念组成的。 The poster lists about a dozen of those (again ignoring typing and a couple of other things). 海报列出了大约十几个(再次忽略打字和其他几件事)。 Significantly less than paradigms. 显着低于范式。

Learning a significant portion of concepts is entirely feasible. 学习很大一部分概念是完全可行的。 Once you know them, you can look at a problem and see which concepts would be useful to have to build a solution. 一旦了解了它们,就可以查看问题,看看哪些概念对于构建解决方案很有用。 Then you look at which paradigms contain those concepts and which languages implement those paradigms. 然后,您将看看哪些范例包含这些概念以及哪些语言实现了这些范例。 Pick one, learn it, use it, solve the problem. 选择一个,学习它,使用它,解决问题。

And since you already know the concepts (and thus the paradigms) the language implements, you only need to learn the syntax, not the semantics. 既然您已经了解了语言实现的概念(以及范例),您只需要学习语法,而不是语义。 There aren't actually that many different syntaxes in the wild (C, C++, Objective-C, Objective-C++, D, Go, Java, C#, ECMAScript, PHP, Vala and many others share a lot of syntax, for example, as do Smalltalk, Self, Newspeak and Objective-C, SML, OCaml and F#, and so on), so chances are, you'll pick that up very quickly. 实际上并没有那么多不同的语法(C,C ++,Objective-C,Objective-C ++,D,Go,Java,C#,ECMAScript,PHP,Vala和许多其他语法共享很多语法,例如,和Smalltalk,Self,Newspeak和Objective-C,SML,OCaml和F#等等一样,所以很有可能,你会很快选择它。 (Besides, with today's modern IDEs that's much less of an issue anyway.) (此外,无论如何,今天的现代IDE都不是问题。)

One small point to bear in mind: if you are an expert in language X and you are asked to develop a program in domain Y for which language Z is supposed to be ideal -- will you deliver sooner and better by writing in the language you are an expert in even if it is not (by some measures) ideal for the problem domain ? 需要记住的一点是:如果您是X语言专家,并且您被要求在Y域开发一个Z应该是理想语言的程序 - 您是否会通过用您的语言书写来更快更好地交付即使不是(通过某些措施)对问题领域的理想选择,他们也是专家吗? Or will you deliver better and sooner by first learning a new language ? 或者,您是否会通过首先学习一门新语言来提供更快更好的服务?

I think your search for a simple heuristic is in vain. 我认为你搜索一个简单的启发式算法是徒劳的。

Start with what you're team is familiar with. 从团队熟悉的内容开始。 While there's a lot to be said for the philosophy that a great developer can pick up almost any language in short order, there's a practical side that goes to the fact that if you have a ton of .Net or Java coders, you're best served in starting from that base. 虽然优秀的开发人员可以在短时间内掌握几乎所有语言的理念,但有一个实际的方面可以说,如果你有大量的.Net或Java编码器,那么你是最好的。从那个基地开始服务。

Now, within both stacks you have options on things like functional programming (F#, Erlang, etc.) and other languages on the runtime your team is most familiar with. 现在,在两个堆栈中,您可以选择函数编程(F#,Erlang等)以及团队最熟悉的运行时上的其他语言。 But it really does boil down to the culture, infrastructure, and (most importantly) the experience and flexibility of the individual developers on your team. 但它确实归结为文化,基础设施,以及(最重要的)团队中各个开发人员的经验和灵活性。

There are several factors to consider: 有几个因素需要考虑:

  • What is your local expertise? 您当地的专业知识是什么? If you have a company full of C programmers, it's probably not worth retraining everybody to be Lisp programmers. 如果你有一个充满C程序员的公司,那么可能不值得重新培训所有人成为Lisp程序员。
  • What are your libraries? 你的图书馆是什么? If you have libraries that you want to use, make sure that they are compatible with your language of choice. 如果您有要使用的库,请确保它们与您选择的语言兼容。

If you are starting a new project with a wide-open field of options, I would recommend taking a few sample problems out of the application domain. 如果您正在开始一个具有广泛开放选项的新项目,我建议您从应用程序域中获取一些示例问题。 Nothing too complex, but nothing trivial either. 没有什么太复杂,但也没有什么微不足道的。 Then, implement (or have someone from your team implement) these samples in each candidate language. 然后,在每种候选语言中实施(或让团队成员实施)这些样本。 Then, choose the one that is clear, easy, and appropriate. 然后,选择一个清晰,简单和适当的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM