什么是下一代低级语言迁移代码库的最佳选择?

时间:2022-03-20 15:00:45

Let's say you have a company running a lot of C/C++, and you want to start planning migration to new technologies so you don't end up like COBOL companies 15 years ago.

假设您有一家公司在运行大量的C/ c++,您希望开始计划迁移到新技术,这样您就不会像15年前的COBOL公司那样了。

For now, C/C++ runs more than fine and there is plenty dev on the market for it.

目前,C/ c++运行良好,市场上有大量开发。

But you want to start thinking about it now, because given the huge running code base and the data sensitivity, you feel it can take 5-10 years to move to the next step without overloading the budget and the dev teams.

但是您现在就要开始考虑这个问题了,因为考虑到庞大的运行代码库和数据敏感性,您认为在不增加预算和开发团队的负担的情况下,可能需要5-10年才能进入下一个步骤。

You have heard about D, starting to be quite mature, and Go, promising to be quite popular.

你听说过D,开始变得很成熟了,然后就去了,承诺会很受欢迎。

What would be your choice and why?

你的选择是什么?为什么?

14 个解决方案

#1


39  

D and Go will probably just become as popular as Python and Ruby are today. They each fill a niche, and even though D was supposed to be a full-fledged replacement of C++, it probably will never acquire enough mass to push C++ away. Not to mention that they both aren't stable/mature enough, and it's unknown whether you'll have support for these languages in 10-20 years for the then-current hardware and operating systems. Considering that C/C++ is pretty much the compiled language and is used in the great majority of operating systems and native-code applications, it's very unlikely that it'll go away in the foreseeable future.

D和Go可能会像今天的Python和Ruby一样流行。它们各自都占据了一个小众市场,尽管D被认为是c++的一个成熟替代品,但它可能永远不会获得足够的质量来推动c++的发展。更不用提它们都不够稳定/成熟,而且还不知道在未来10-20年内,您是否会支持这些语言来支持当时的硬件和操作系统。考虑到C/ c++几乎是编译语言,并且在大多数操作系统和本机代码应用程序中都使用它,在可预见的将来它不太可能消失。

#2


35  

C and C++ are a pretty much unbeatable combo when it comes to native/unmanaged/"lowlevel" languages.

当涉及到本地/非托管/“低级别”语言时,C和c++几乎是不可战胜的组合。

Not because they're the best languages, far from it, but because they're there, they do the job, and they're good enough. There's little doubt that D, for example, is better than C++ in most respects. But it fails in the most important one: Compatibility with all the existing C++ code. Without that requirement, most of that code would be written in a managed language today anyway. The only reason so many codebases use C++ today is because they used it last year, and it'd be too much of a pain to switch to something else. But if and when they switch, they typically don't switch to D. They switch to C# or Java or Python.

不是因为他们是最好的语言,远远不是,而是因为他们在那里,他们做了工作,他们足够好。例如,毫无疑问,D在大多数方面都优于c++。但最重要的一点是:与所有现有c++代码的兼容性。如果没有这个需求,大部分代码现在都是用托管语言编写的。今天有这么多的代码库使用c++的唯一原因是他们去年使用了它,而切换到别的代码库将会非常痛苦。但当他们转换时,他们通常不会切换到d,而是切换到c#、Java或Python。

The problem for D and other "upcoming" languages competing for the same niches, is that while they're better, they're not groundbreaking enough to motivate people to actually switch to them.

D和其他“即将到来”的语言争夺同样的利基市场,但问题在于,虽然它们做得更好,但它们还不足以激发人们真正地转向它们。

So C and C++ are here to stay. C is unlikely to evolve much further. It is as it is, and one of the niches it has to fill is "simplicity, even for compiler writers". No other language is likely to beat it in that niche, even if they never revise the standard again.

所以C和c++会一直存在。C不太可能进一步进化。事实就是如此,它必须填补的一个利基是“简单,即使是编译器作者”。没有任何其他语言可以在这个领域打败它,即使他们再也不会修改标准。

C++ is evolving much more dramatically, with C++0x getting nearer, and they've already got a huge list of features they want to do afterwards. C++ isn't a dead end in any way.

随着c++ 0x越来越接近,c++的发展速度也越来越快,它们已经有了一大堆特性,这些特性是以后要做的。c++在任何方面都不是一个死胡同。

Both languages are here to stay. Perhaps in 50 years other languages will have replaced them, but it won't happen this decade.

两种语言都将继续存在。或许50年后,其他语言将取代它们,但这十年不会发生。

#3


23  

I currently use D regularly. I wouldn't recommend it yet for people writing production code because it's too bleeding edge. I get away with it because most of my code is research prototypes in bioinformatics. However, the language is starting to stabilize. Andrei Alexandrescu is releasing a book titled "The D Programming Language" next March, and right now there is a push to stabilize the spec for version 2 of the language in time for the book.

我现在经常用D。我还不建议编写生产代码的人使用它,因为它的优势太大了。我之所以能成功,是因为我的大部分代码都是生物信息学的研究原型。然而,语言开始稳定下来。安德烈·亚历山大·亚历山大将于明年3月出版一本名为《D编程语言》的书,目前正在努力稳定该书的版本2的规范。

While D is not a formal superset of C, it is what I'd call an idiomatic superset except for the lack of a preprocessor. In other words, any code written in C proper (ignoring the preprocessor), can be trivially translated to D without a redesign, because C concepts like pointers and inline ASM are there and work the same in D as in C. D also supports direct linking to C code and the D standard library includes the entire C standard library.

虽然D不是C的正式超集,但它是我所谓的惯用超集,只是缺少预处理器。换句话说,任何代码用C编写适当的预处理(忽略),可以很容易突破翻译到D没有重新设计,因为C概念如指针和内联ASM和工作有相同的D和C D还支持直接链接到C代码和D标准库包括整个C标准库。

Also, despite D's lack of libraries because it is still a bleeding edge language, it's a library writer's dream because of its metaprogramming capabilities. If it takes off, it will probably have some pretty impressive libs. For a preview of this, see std.range or std.algorithm in the D2 standard library (Phobos). As another example, I implemented an OpenMP-like parallelism model (parallel foreach, parallel map, parallel reduce, futures) as a pure library in D, without any special compiler support. (See http://cis.jhu.edu/~dsimcha/parallelFuture.html)

此外,尽管D缺少库,因为它仍然是一种边缘语言,但由于它的元编程能力,它是库作者的梦想。如果它起飞,它可能会有一些相当令人印象深刻的libs。有关这方面的预览,请参阅D2标准库(Phobos)中的std.range或std.algorithm。作为另一个示例,我实现了一个类似openmp的并行模型(parallel foreach、parallel map、parallel reduce、futures),作为一个纯粹的D库,没有任何特殊的编译器支持。(见http://cis.jhu.edu/ dsimcha / parallelFuture.html)

Given that you're mostly interested in the long term, I'd say give D 6 months to stabilize (given Andrei's book and the current push to stabilize the language, version 2 should be stable by then) and then take a hard look at it.

考虑到你最感兴趣的是长期发展,我建议你给他6个月的时间来稳定(考虑到安德烈的书以及目前稳定语言的努力,到那时版本2应该是稳定的),然后再仔细看看。

Edit: Now that the core language spec is relatively stable and the focus has turned to toolchain and library development, I would recommend D for small production projects unless you are in a very risk-averse environment. Larger projects that absolutely must have good toolchain and library support should still wait, though.

编辑:既然核心语言规范相对稳定,重点转向了工具链和库开发,我建议D用于小型生产项目,除非您处在一个非常规避风险的环境中。但是,必须拥有良好的工具链和库支持的大型项目仍然需要等待。

#4


14  

C++ -- it is relatively young and updated... It has a big number of compiler vendors and got improved all the time.

c++——它相对年轻而且更新……它有大量的编译器供应商,并且一直在改进。

C -- it would live for a long time filling the gap between assembler and higher level languages. It is also very simple and easy to implement language, so it would remain the first language for various "strange" architectures like embedded or extremely new ones.

C——它将长期存在,填补汇编语言和高级语言之间的空白。它也非常简单,易于实现语言,因此它仍然是各种“奇怪”架构的第一语言,比如嵌入式架构或非常新的架构。

D is promising but still very new and unstable specifications and libraries.

D是有前途的,但仍然是非常新的和不稳定的规范和库。

Go was born few weeks ago... Never use anything of version 0 for big important projects. Also it is significantly more limited the C++ or D.

Go是几个星期前出生的……不要在重要的项目中使用0版本。同时,它也大大限制了c++或D。

#5


13  

Stick with C and C++. I don't see it going the way of COBOL, it runs as well as anything, and you'll have no problem finding people to code in C and C++.

坚持使用C和c++。我不认为它会像COBOL那样运行,它运行得很好,而且您可以毫不费力地找到用C和c++编写代码的人。

#6


13  

If you believe in the lean manufacturing principles, you should strive to "decide as late as possible". The moment should be the last responsible moment, meaning the moment at which failing to make a decision eliminates an important alternative.

如果你相信精益生产原理,你应该努力“尽可能晚地做出决定”。这个时刻应该是最后一个负责任的时刻,也就是说,在这个时刻,不做决定会消除一个重要的选择。

I think this principle can be applied to your situation. Instead of committing now to a language (that you don't even know will be around in 10 years), you should keep your options open. Maybe refactor some of your code so it is a bit more generic or is built on more abstractions, so that when it is indeed required to migrate, the process will be easier.

我认为这一原则适用于你的情况。与其现在就开始学习一门语言(你甚至都不知道10年后会出现这种语言),你应该保持开放的选择。也许可以重构一些代码,使其更通用,或者构建在更抽象的基础上,这样当确实需要迁移时,过程就会更容易。

#7


8  

C++ will stay around for the next 10 years... (if not, I will correct this answer, when it will not be relevant any more....)

c++将在未来的10年里继续存在……(如果不是,我将正确的答案,当它将不再相关....)

the reason companies works with COBOL today is b/c they already have millions of COBOL code written. if the could throw it - they will do it at once, on the other hand - companies work with C/C++ as part of their needs and new projects using this language b/c they can't / don't want to use java/c# any other framework based language - so COBOL is not the analogy here.

公司现在使用COBOL的原因是他们已经编写了数百万的COBOL代码。如果可以把它——他们会这么做,另一方面,公司使用C / c++作为他们的需求和新项目使用这个语言b / C他们不能/不想使用基于java / c#其他框架的语言——所以COBOL不是这里的类比。

#8


6  

Like dsimcha said the D way is currently risky. Yet the language has a huge potential, it is low-level and i've experienced drastically better productivity with D (instead of C++). Perhaps what people feel with dynamic languages.

就像dsimcha说的,D方法目前是有风险的。然而,这门语言有巨大的潜力,它是低层次的,我体验过使用D(而不是c++)的生产率大大提高。也许是人们对动态语言的感受。

Go is so much blog-marketed it seems like a joke to me. Dispatching an interface method is not trivial, and actually slower than dispatching a regular single-inheritance method.

Go在博客上的推广如此之多,对我来说简直就是个笑话。调度接口方法并不简单,实际上比调度一个常规的单继承方法要慢。

If you'd have a huge codebase the decision is of course more difficult, I would advise only to switch for new projects, not for existing ones.

如果您有一个庞大的代码库,那么这个决定当然会更加困难,我建议您只切换到新的项目,而不是现有的项目。

#9


5  

I wouldn't concentrate on a language but more on the libraries surrounding it. C++ in combination with the boost libraries are an excellent choice. People who develop in C++ tend to have a better understanding of computing, I myself started of with Java which made my life easier by hiding a lot of fundamental stuff, which is good, however I only really started to understand programming once I learned C/C++ (pointers etc).

我不会专注于一门语言,而会更多地关注它周围的库。c++结合boost库是一个很好的选择。使用c++开发的人往往对计算有更好的理解,我自己从Java开始,通过隐藏很多基本的东西使我的生活变得更容易,这很好,但是我真正开始理解编程是在我学会了C/ c++(指针等)之后。

I do recognise that C++ can be hard (e.g. memory management) so I think it's good to have a 'add on' language where performance is not essential and readability (==maintainability) scores high: I recommend Python for this.

我的确认识到c++可能很难(例如内存管理),所以我认为最好使用一种“添加”语言,在这种语言中,性能不是必需的,可读性(==维护性)也很好:我推荐使用Python。

#10


2  

Check out Intel® Cilk++ Software Development Kit if you want to spark your interest in C++/Multi-Core development. I don't see C or C++ going away anytime soon either.

+ + Cilk看看英特尔®软件开发工具包如果你想激发你的兴趣c++ /多核发展。我也不认为C或c++会很快消失。

#11


2  

There are countless machines running C++ software, I don't see them shutting down all at once. If C++ will go in the way of COBOL there will be a huge market for application migration. There will be specialized tools developed to translate C++ applications to the popular language of the time (Z++ ???).

有无数的机器在运行c++软件,我没有看到它们同时关闭。如果c++采用COBOL语言,那么应用程序迁移将会有巨大的市场。将开发专门的工具将c++应用程序翻译成当时流行的语言(Z+ ??? ?)

So I guess the best advice is to cross that bridge when you come to it.

所以我认为最好的建议是当你到达那座桥的时候过桥。

#12


0  

We have no idea if Go will find acceptance. Just being by Google is probably not going to be enough.

我们不知道去是否会被接受。仅仅靠谷歌可能是不够的。

D? Well, some nice things are being said about it but it won't be taking off either. No user base to speak of. D is #20 in popularity on the TIOBE Index, and dropping fast.

D ?好吧,有人说了一些好东西,但它也不会起飞。没有用户基础可言。D在TIOBE指数中排名第20,下降很快。

You may say that a language's popularity has little to do with how well it's suited for your company's work. But it has a lot to do with how easy it will be to find people qualified to program in it.

你可能会说,一门语言的受欢迎程度与它是否适合你公司的工作关系不大。但这与发现有资格参加该项目的人是多么容易的事情有很大关系。

Java is on top and I would be surprised if it went far away in the next 20 years. It's not considered a systems programming language but performs well enough that there are few tasks you'd do in C++ that you couldn't in Java. Certainly these days nobody is willing to task human programmers with the job done (flawlessly and often more effectively) by the garbage collector. I for one considered Java a significant step up from C++ in terms of programming effectivity.

Java处于领先地位,如果它在未来20年走得更远,我会感到惊讶。它不被认为是一种系统编程语言,但是它的性能非常好,在c++中很少有任务是在Java中不能完成的。当然,现在没有人愿意让人类程序员去完成垃圾收集器所完成的工作(通常是完美的、更有效的)。在编程效率方面,我认为Java是c++的一个重要进步。

I'm quite impressed by Ruby. It's an elegant, expressive language: You can accomplish a lot with not too much code, yet that code is still mostly legible. One of Ruby's main principles is to be consistent and not hold surprises for the developer. This is an extremely good idea, IMO, and boosts productivity. At the time of the big Rails hype (which may still be ongoing), I made a wide berth around Ruby because its reference implementation is abysmally slow. However, the JRuby folks at Sun have made it blazingly fast on a JVM, so now it's definitely worth some consideration. Ruby provides closures and a good handful of functional programming capabilities (see below for why this important), though it's not really considered a FP language. TIOBE index: 10 and rising.

Ruby给我留下了深刻的印象。它是一种优雅的、表达性强的语言:您可以用不太多的代码完成很多工作,但是代码仍然大部分是可读的。Ruby的主要原则之一是保持一致,不让开发人员感到意外。在我看来,这是一个非常好的主意,可以提高生产力。在大型Rails宣传(可能还在进行中)的时候,我在Ruby周围做了一个很宽的泊位,因为它的参考实现非常慢。然而,Sun的JRuby人员在JVM上运行得非常快,所以现在它绝对值得考虑。Ruby提供了闭包和大量的函数编程功能(请参阅下面这一重要的部分),尽管它并不是真正的FP语言。TIOBE指数:10,正在上升。

Something to consider for the future is the fact that CPU makers have run up against a performance limit imposed by physics. No longer is there a 30% faster CPU available every Christmas, as it was in the past. So now to get more performance you need more cores. Software development will need all the help it can get in supporting multi-core concurrent programming. C++ leaves you mostly alone with this, and Java's solutions are horrible by modern standards.

未来需要考虑的一个事实是,CPU制造商遇到了物理强加的性能限制。不再像过去那样每年圣诞节都有30%的CPU可用。所以现在要获得更多的性能,你需要更多的内核。软件开发将需要支持多核并发编程的所有帮助。c++主要是让您自己解决这个问题,Java的解决方案以现代标准来看是很糟糕的。

In view of this, there's a certain trend toward functional programming (which eliminates much of the hassle associated with concurrency) as well as languages with better concurrency support. Erlang was written specifically for this and for the ability to swap code in a running program (Ericsson wanted incredible uptimes). Scala is similar to Java but with much stronger support for functional programming and concurrency. Clojure, ditto, but it's a Lisp and it's not even in the top 50 (yet!!).

鉴于此,有一种趋势是函数式编程(它消除了与并发相关的许多麻烦)以及具有更好的并发支持的语言。Erlang是专门为这个目的和在运行的程序中交换代码的能力而编写的(Ericsson想要令人难以置信的运行时间)。Scala与Java类似,但对函数式编程和并发性的支持更强。Clojure也是如此,但它很Lisp,甚至连前50名都没有。

Scala was developed academics, and shows it: It's sophisticated and downright pedantic about data types; it tries to be the Swiss Army Knife of programming languages. I believe a lot of medium-smart programmers will have trouble getting a grip on Scala. Ruby is less FP and doesn't do so much about concurrency, but it's pragmatic, and fun and easy to get stuff done in. Also, running on the JVM, there is an enormous amount of code readily available in Java libraries, which Ruby can interface with. So:

Scala是由学者开发的,它展示了它:数据类型的复杂和彻底的迂曲;它试图成为编程语言的瑞士军刀。我相信很多中等聪明的程序员在学习Scala时会遇到困难。Ruby的FP更少,对并发也不做太多,但它是实用的、有趣的、易于完成的。而且,在JVM上运行,Java库中有大量的代码,Ruby可以与之交互。所以:

My bet would be on Ruby, with an outside chance on Scala. But there are plenty of alternatives!

我的赌注将落在Ruby上,而在Scala上的机会则微乎其微。但是还有很多选择!

#13


0  

Comparing C* to Cobol is questionable

Comparing C* to Cobol may lead to the wrong conclusion. C was perfect for its day, a huge leap forward on its introduction, and it still gets the job done today.

将C*与Cobol进行比较可能会得出错误的结论。C在它的时代是完美的,在它的介绍上是一个巨大的飞跃,而且它仍然完成了今天的工作。

I would sum up Cobol on my most charitable day with "nice try".

在我最慈善的一天,我会用“美好的尝试”来总结Cobol语言。

C and C++ will survive for a long time because they fit the bill well as implementation languages. This won't ever really change.

C和c++将会存在很长一段时间,因为它们既适用于实现语言,也适用于实现语言。这种情况永远不会改变。

Also, consider that the main negative issue with C/C++ is the lack of memory safety. This tends to be less and less of a problem as codes mature. This means there will not be a serious reason to replace the old codes.

另外,考虑到C/ c++的主要负面问题是内存安全性的缺乏。随着代码的成熟,这个问题越来越小。这意味着取代旧代码的理由并不严重。

I expect that software systems will grow outwards from C. Look at the hierarchy today:

我预计软件系统将从c向外发展。

  • application written in a framework such as Rails
  • 在Rails等框架中编写的应用程序
  • application back-end written in Ruby, PHP, Python, C#, whatever
  • 用Ruby、PHP、Python、c#等语言编写的后端应用程序
  • Ruby, PHP, Python, or C# run-time implementation (written in C*)
  • Ruby、PHP、Python或c#运行时实现(用C*编写)
  • OS kernel (written in C89)
  • OS内核(用C89编写)

I don't think the old layers will vanish, and I think legacy higher layers written in C and C++ will simply be supported that way for an indefinite period of time, eventually being phased out for their replacements written in Ruby, Python, C#, or a future development.

我不认为旧的层将会消失,我认为用C和c++编写的旧的高级层将会在一段不确定的时间内被这样支持,最终被淘汰,取而代之的是用Ruby、Python、c#或未来的开发。

#14


-7  

Java. For most low level things Java is fine these days. Why go with a partial solution to C/C++ such as D or Go when you can have something as safe and easy to develop with as Java? If you are looking for a real time solution, D and Go are definitely not it, not to mention they are probably even less supported than Java.

Java。对于大多数较低层次的东西,Java现在是可以的。为什么要使用C/ c++的部分解决方案,比如D或go,当您可以使用Java开发同样安全、容易的东西时?如果您正在寻找实时解决方案,D和Go肯定不是,更不用说它们可能比Java更不受支持。


Java is now a system programming language. I don't see how you can consider anything with unsafe constructs such as pointers "next gen". The only reason those insecure constructs ever existed is because it was the pragmatic approach to building a turing complete language. There was no concern of representing the memory in discrete objects, because they just wanted to build something that worked. There are already hard and soft realtime applications in Java, a variety of hardware bytecode processors, and over 2 billion mobile devices running Java. At most all you would have to do is add some constructs for interoperability with devices, which wouldn't be that much code; even in C/C++ you'd still have to add these constructs...

Java现在是一种系统编程语言。我不知道如何考虑不安全的结构,比如指针“next gen”。这些不安全的构念存在的唯一原因是它是构建图灵完整语言的实用方法。不关心在离散对象中表示内存,因为他们只是想构建一些有用的东西。Java中已经有硬的和软的实时应用程序、各种硬件字节码处理器和超过20亿的运行Java的移动设备。你所需要做的最多就是添加一些与设备互操作的结构,这不是很多的代码;即使在C/ c++中,您仍然需要添加这些结构……

What are you programming? 8-bit microcontrollers with 1KB ram? In that case, it would be pointless to use anything other than the assembler for that platform...

你编程?带1KB ram的8位微控制器?在这种情况下,除了为该平台使用汇编程序之外,使用任何东西都是毫无意义的……

#1


39  

D and Go will probably just become as popular as Python and Ruby are today. They each fill a niche, and even though D was supposed to be a full-fledged replacement of C++, it probably will never acquire enough mass to push C++ away. Not to mention that they both aren't stable/mature enough, and it's unknown whether you'll have support for these languages in 10-20 years for the then-current hardware and operating systems. Considering that C/C++ is pretty much the compiled language and is used in the great majority of operating systems and native-code applications, it's very unlikely that it'll go away in the foreseeable future.

D和Go可能会像今天的Python和Ruby一样流行。它们各自都占据了一个小众市场,尽管D被认为是c++的一个成熟替代品,但它可能永远不会获得足够的质量来推动c++的发展。更不用提它们都不够稳定/成熟,而且还不知道在未来10-20年内,您是否会支持这些语言来支持当时的硬件和操作系统。考虑到C/ c++几乎是编译语言,并且在大多数操作系统和本机代码应用程序中都使用它,在可预见的将来它不太可能消失。

#2


35  

C and C++ are a pretty much unbeatable combo when it comes to native/unmanaged/"lowlevel" languages.

当涉及到本地/非托管/“低级别”语言时,C和c++几乎是不可战胜的组合。

Not because they're the best languages, far from it, but because they're there, they do the job, and they're good enough. There's little doubt that D, for example, is better than C++ in most respects. But it fails in the most important one: Compatibility with all the existing C++ code. Without that requirement, most of that code would be written in a managed language today anyway. The only reason so many codebases use C++ today is because they used it last year, and it'd be too much of a pain to switch to something else. But if and when they switch, they typically don't switch to D. They switch to C# or Java or Python.

不是因为他们是最好的语言,远远不是,而是因为他们在那里,他们做了工作,他们足够好。例如,毫无疑问,D在大多数方面都优于c++。但最重要的一点是:与所有现有c++代码的兼容性。如果没有这个需求,大部分代码现在都是用托管语言编写的。今天有这么多的代码库使用c++的唯一原因是他们去年使用了它,而切换到别的代码库将会非常痛苦。但当他们转换时,他们通常不会切换到d,而是切换到c#、Java或Python。

The problem for D and other "upcoming" languages competing for the same niches, is that while they're better, they're not groundbreaking enough to motivate people to actually switch to them.

D和其他“即将到来”的语言争夺同样的利基市场,但问题在于,虽然它们做得更好,但它们还不足以激发人们真正地转向它们。

So C and C++ are here to stay. C is unlikely to evolve much further. It is as it is, and one of the niches it has to fill is "simplicity, even for compiler writers". No other language is likely to beat it in that niche, even if they never revise the standard again.

所以C和c++会一直存在。C不太可能进一步进化。事实就是如此,它必须填补的一个利基是“简单,即使是编译器作者”。没有任何其他语言可以在这个领域打败它,即使他们再也不会修改标准。

C++ is evolving much more dramatically, with C++0x getting nearer, and they've already got a huge list of features they want to do afterwards. C++ isn't a dead end in any way.

随着c++ 0x越来越接近,c++的发展速度也越来越快,它们已经有了一大堆特性,这些特性是以后要做的。c++在任何方面都不是一个死胡同。

Both languages are here to stay. Perhaps in 50 years other languages will have replaced them, but it won't happen this decade.

两种语言都将继续存在。或许50年后,其他语言将取代它们,但这十年不会发生。

#3


23  

I currently use D regularly. I wouldn't recommend it yet for people writing production code because it's too bleeding edge. I get away with it because most of my code is research prototypes in bioinformatics. However, the language is starting to stabilize. Andrei Alexandrescu is releasing a book titled "The D Programming Language" next March, and right now there is a push to stabilize the spec for version 2 of the language in time for the book.

我现在经常用D。我还不建议编写生产代码的人使用它,因为它的优势太大了。我之所以能成功,是因为我的大部分代码都是生物信息学的研究原型。然而,语言开始稳定下来。安德烈·亚历山大·亚历山大将于明年3月出版一本名为《D编程语言》的书,目前正在努力稳定该书的版本2的规范。

While D is not a formal superset of C, it is what I'd call an idiomatic superset except for the lack of a preprocessor. In other words, any code written in C proper (ignoring the preprocessor), can be trivially translated to D without a redesign, because C concepts like pointers and inline ASM are there and work the same in D as in C. D also supports direct linking to C code and the D standard library includes the entire C standard library.

虽然D不是C的正式超集,但它是我所谓的惯用超集,只是缺少预处理器。换句话说,任何代码用C编写适当的预处理(忽略),可以很容易突破翻译到D没有重新设计,因为C概念如指针和内联ASM和工作有相同的D和C D还支持直接链接到C代码和D标准库包括整个C标准库。

Also, despite D's lack of libraries because it is still a bleeding edge language, it's a library writer's dream because of its metaprogramming capabilities. If it takes off, it will probably have some pretty impressive libs. For a preview of this, see std.range or std.algorithm in the D2 standard library (Phobos). As another example, I implemented an OpenMP-like parallelism model (parallel foreach, parallel map, parallel reduce, futures) as a pure library in D, without any special compiler support. (See http://cis.jhu.edu/~dsimcha/parallelFuture.html)

此外,尽管D缺少库,因为它仍然是一种边缘语言,但由于它的元编程能力,它是库作者的梦想。如果它起飞,它可能会有一些相当令人印象深刻的libs。有关这方面的预览,请参阅D2标准库(Phobos)中的std.range或std.algorithm。作为另一个示例,我实现了一个类似openmp的并行模型(parallel foreach、parallel map、parallel reduce、futures),作为一个纯粹的D库,没有任何特殊的编译器支持。(见http://cis.jhu.edu/ dsimcha / parallelFuture.html)

Given that you're mostly interested in the long term, I'd say give D 6 months to stabilize (given Andrei's book and the current push to stabilize the language, version 2 should be stable by then) and then take a hard look at it.

考虑到你最感兴趣的是长期发展,我建议你给他6个月的时间来稳定(考虑到安德烈的书以及目前稳定语言的努力,到那时版本2应该是稳定的),然后再仔细看看。

Edit: Now that the core language spec is relatively stable and the focus has turned to toolchain and library development, I would recommend D for small production projects unless you are in a very risk-averse environment. Larger projects that absolutely must have good toolchain and library support should still wait, though.

编辑:既然核心语言规范相对稳定,重点转向了工具链和库开发,我建议D用于小型生产项目,除非您处在一个非常规避风险的环境中。但是,必须拥有良好的工具链和库支持的大型项目仍然需要等待。

#4


14  

C++ -- it is relatively young and updated... It has a big number of compiler vendors and got improved all the time.

c++——它相对年轻而且更新……它有大量的编译器供应商,并且一直在改进。

C -- it would live for a long time filling the gap between assembler and higher level languages. It is also very simple and easy to implement language, so it would remain the first language for various "strange" architectures like embedded or extremely new ones.

C——它将长期存在,填补汇编语言和高级语言之间的空白。它也非常简单,易于实现语言,因此它仍然是各种“奇怪”架构的第一语言,比如嵌入式架构或非常新的架构。

D is promising but still very new and unstable specifications and libraries.

D是有前途的,但仍然是非常新的和不稳定的规范和库。

Go was born few weeks ago... Never use anything of version 0 for big important projects. Also it is significantly more limited the C++ or D.

Go是几个星期前出生的……不要在重要的项目中使用0版本。同时,它也大大限制了c++或D。

#5


13  

Stick with C and C++. I don't see it going the way of COBOL, it runs as well as anything, and you'll have no problem finding people to code in C and C++.

坚持使用C和c++。我不认为它会像COBOL那样运行,它运行得很好,而且您可以毫不费力地找到用C和c++编写代码的人。

#6


13  

If you believe in the lean manufacturing principles, you should strive to "decide as late as possible". The moment should be the last responsible moment, meaning the moment at which failing to make a decision eliminates an important alternative.

如果你相信精益生产原理,你应该努力“尽可能晚地做出决定”。这个时刻应该是最后一个负责任的时刻,也就是说,在这个时刻,不做决定会消除一个重要的选择。

I think this principle can be applied to your situation. Instead of committing now to a language (that you don't even know will be around in 10 years), you should keep your options open. Maybe refactor some of your code so it is a bit more generic or is built on more abstractions, so that when it is indeed required to migrate, the process will be easier.

我认为这一原则适用于你的情况。与其现在就开始学习一门语言(你甚至都不知道10年后会出现这种语言),你应该保持开放的选择。也许可以重构一些代码,使其更通用,或者构建在更抽象的基础上,这样当确实需要迁移时,过程就会更容易。

#7


8  

C++ will stay around for the next 10 years... (if not, I will correct this answer, when it will not be relevant any more....)

c++将在未来的10年里继续存在……(如果不是,我将正确的答案,当它将不再相关....)

the reason companies works with COBOL today is b/c they already have millions of COBOL code written. if the could throw it - they will do it at once, on the other hand - companies work with C/C++ as part of their needs and new projects using this language b/c they can't / don't want to use java/c# any other framework based language - so COBOL is not the analogy here.

公司现在使用COBOL的原因是他们已经编写了数百万的COBOL代码。如果可以把它——他们会这么做,另一方面,公司使用C / c++作为他们的需求和新项目使用这个语言b / C他们不能/不想使用基于java / c#其他框架的语言——所以COBOL不是这里的类比。

#8


6  

Like dsimcha said the D way is currently risky. Yet the language has a huge potential, it is low-level and i've experienced drastically better productivity with D (instead of C++). Perhaps what people feel with dynamic languages.

就像dsimcha说的,D方法目前是有风险的。然而,这门语言有巨大的潜力,它是低层次的,我体验过使用D(而不是c++)的生产率大大提高。也许是人们对动态语言的感受。

Go is so much blog-marketed it seems like a joke to me. Dispatching an interface method is not trivial, and actually slower than dispatching a regular single-inheritance method.

Go在博客上的推广如此之多,对我来说简直就是个笑话。调度接口方法并不简单,实际上比调度一个常规的单继承方法要慢。

If you'd have a huge codebase the decision is of course more difficult, I would advise only to switch for new projects, not for existing ones.

如果您有一个庞大的代码库,那么这个决定当然会更加困难,我建议您只切换到新的项目,而不是现有的项目。

#9


5  

I wouldn't concentrate on a language but more on the libraries surrounding it. C++ in combination with the boost libraries are an excellent choice. People who develop in C++ tend to have a better understanding of computing, I myself started of with Java which made my life easier by hiding a lot of fundamental stuff, which is good, however I only really started to understand programming once I learned C/C++ (pointers etc).

我不会专注于一门语言,而会更多地关注它周围的库。c++结合boost库是一个很好的选择。使用c++开发的人往往对计算有更好的理解,我自己从Java开始,通过隐藏很多基本的东西使我的生活变得更容易,这很好,但是我真正开始理解编程是在我学会了C/ c++(指针等)之后。

I do recognise that C++ can be hard (e.g. memory management) so I think it's good to have a 'add on' language where performance is not essential and readability (==maintainability) scores high: I recommend Python for this.

我的确认识到c++可能很难(例如内存管理),所以我认为最好使用一种“添加”语言,在这种语言中,性能不是必需的,可读性(==维护性)也很好:我推荐使用Python。

#10


2  

Check out Intel® Cilk++ Software Development Kit if you want to spark your interest in C++/Multi-Core development. I don't see C or C++ going away anytime soon either.

+ + Cilk看看英特尔®软件开发工具包如果你想激发你的兴趣c++ /多核发展。我也不认为C或c++会很快消失。

#11


2  

There are countless machines running C++ software, I don't see them shutting down all at once. If C++ will go in the way of COBOL there will be a huge market for application migration. There will be specialized tools developed to translate C++ applications to the popular language of the time (Z++ ???).

有无数的机器在运行c++软件,我没有看到它们同时关闭。如果c++采用COBOL语言,那么应用程序迁移将会有巨大的市场。将开发专门的工具将c++应用程序翻译成当时流行的语言(Z+ ??? ?)

So I guess the best advice is to cross that bridge when you come to it.

所以我认为最好的建议是当你到达那座桥的时候过桥。

#12


0  

We have no idea if Go will find acceptance. Just being by Google is probably not going to be enough.

我们不知道去是否会被接受。仅仅靠谷歌可能是不够的。

D? Well, some nice things are being said about it but it won't be taking off either. No user base to speak of. D is #20 in popularity on the TIOBE Index, and dropping fast.

D ?好吧,有人说了一些好东西,但它也不会起飞。没有用户基础可言。D在TIOBE指数中排名第20,下降很快。

You may say that a language's popularity has little to do with how well it's suited for your company's work. But it has a lot to do with how easy it will be to find people qualified to program in it.

你可能会说,一门语言的受欢迎程度与它是否适合你公司的工作关系不大。但这与发现有资格参加该项目的人是多么容易的事情有很大关系。

Java is on top and I would be surprised if it went far away in the next 20 years. It's not considered a systems programming language but performs well enough that there are few tasks you'd do in C++ that you couldn't in Java. Certainly these days nobody is willing to task human programmers with the job done (flawlessly and often more effectively) by the garbage collector. I for one considered Java a significant step up from C++ in terms of programming effectivity.

Java处于领先地位,如果它在未来20年走得更远,我会感到惊讶。它不被认为是一种系统编程语言,但是它的性能非常好,在c++中很少有任务是在Java中不能完成的。当然,现在没有人愿意让人类程序员去完成垃圾收集器所完成的工作(通常是完美的、更有效的)。在编程效率方面,我认为Java是c++的一个重要进步。

I'm quite impressed by Ruby. It's an elegant, expressive language: You can accomplish a lot with not too much code, yet that code is still mostly legible. One of Ruby's main principles is to be consistent and not hold surprises for the developer. This is an extremely good idea, IMO, and boosts productivity. At the time of the big Rails hype (which may still be ongoing), I made a wide berth around Ruby because its reference implementation is abysmally slow. However, the JRuby folks at Sun have made it blazingly fast on a JVM, so now it's definitely worth some consideration. Ruby provides closures and a good handful of functional programming capabilities (see below for why this important), though it's not really considered a FP language. TIOBE index: 10 and rising.

Ruby给我留下了深刻的印象。它是一种优雅的、表达性强的语言:您可以用不太多的代码完成很多工作,但是代码仍然大部分是可读的。Ruby的主要原则之一是保持一致,不让开发人员感到意外。在我看来,这是一个非常好的主意,可以提高生产力。在大型Rails宣传(可能还在进行中)的时候,我在Ruby周围做了一个很宽的泊位,因为它的参考实现非常慢。然而,Sun的JRuby人员在JVM上运行得非常快,所以现在它绝对值得考虑。Ruby提供了闭包和大量的函数编程功能(请参阅下面这一重要的部分),尽管它并不是真正的FP语言。TIOBE指数:10,正在上升。

Something to consider for the future is the fact that CPU makers have run up against a performance limit imposed by physics. No longer is there a 30% faster CPU available every Christmas, as it was in the past. So now to get more performance you need more cores. Software development will need all the help it can get in supporting multi-core concurrent programming. C++ leaves you mostly alone with this, and Java's solutions are horrible by modern standards.

未来需要考虑的一个事实是,CPU制造商遇到了物理强加的性能限制。不再像过去那样每年圣诞节都有30%的CPU可用。所以现在要获得更多的性能,你需要更多的内核。软件开发将需要支持多核并发编程的所有帮助。c++主要是让您自己解决这个问题,Java的解决方案以现代标准来看是很糟糕的。

In view of this, there's a certain trend toward functional programming (which eliminates much of the hassle associated with concurrency) as well as languages with better concurrency support. Erlang was written specifically for this and for the ability to swap code in a running program (Ericsson wanted incredible uptimes). Scala is similar to Java but with much stronger support for functional programming and concurrency. Clojure, ditto, but it's a Lisp and it's not even in the top 50 (yet!!).

鉴于此,有一种趋势是函数式编程(它消除了与并发相关的许多麻烦)以及具有更好的并发支持的语言。Erlang是专门为这个目的和在运行的程序中交换代码的能力而编写的(Ericsson想要令人难以置信的运行时间)。Scala与Java类似,但对函数式编程和并发性的支持更强。Clojure也是如此,但它很Lisp,甚至连前50名都没有。

Scala was developed academics, and shows it: It's sophisticated and downright pedantic about data types; it tries to be the Swiss Army Knife of programming languages. I believe a lot of medium-smart programmers will have trouble getting a grip on Scala. Ruby is less FP and doesn't do so much about concurrency, but it's pragmatic, and fun and easy to get stuff done in. Also, running on the JVM, there is an enormous amount of code readily available in Java libraries, which Ruby can interface with. So:

Scala是由学者开发的,它展示了它:数据类型的复杂和彻底的迂曲;它试图成为编程语言的瑞士军刀。我相信很多中等聪明的程序员在学习Scala时会遇到困难。Ruby的FP更少,对并发也不做太多,但它是实用的、有趣的、易于完成的。而且,在JVM上运行,Java库中有大量的代码,Ruby可以与之交互。所以:

My bet would be on Ruby, with an outside chance on Scala. But there are plenty of alternatives!

我的赌注将落在Ruby上,而在Scala上的机会则微乎其微。但是还有很多选择!

#13


0  

Comparing C* to Cobol is questionable

Comparing C* to Cobol may lead to the wrong conclusion. C was perfect for its day, a huge leap forward on its introduction, and it still gets the job done today.

将C*与Cobol进行比较可能会得出错误的结论。C在它的时代是完美的,在它的介绍上是一个巨大的飞跃,而且它仍然完成了今天的工作。

I would sum up Cobol on my most charitable day with "nice try".

在我最慈善的一天,我会用“美好的尝试”来总结Cobol语言。

C and C++ will survive for a long time because they fit the bill well as implementation languages. This won't ever really change.

C和c++将会存在很长一段时间,因为它们既适用于实现语言,也适用于实现语言。这种情况永远不会改变。

Also, consider that the main negative issue with C/C++ is the lack of memory safety. This tends to be less and less of a problem as codes mature. This means there will not be a serious reason to replace the old codes.

另外,考虑到C/ c++的主要负面问题是内存安全性的缺乏。随着代码的成熟,这个问题越来越小。这意味着取代旧代码的理由并不严重。

I expect that software systems will grow outwards from C. Look at the hierarchy today:

我预计软件系统将从c向外发展。

  • application written in a framework such as Rails
  • 在Rails等框架中编写的应用程序
  • application back-end written in Ruby, PHP, Python, C#, whatever
  • 用Ruby、PHP、Python、c#等语言编写的后端应用程序
  • Ruby, PHP, Python, or C# run-time implementation (written in C*)
  • Ruby、PHP、Python或c#运行时实现(用C*编写)
  • OS kernel (written in C89)
  • OS内核(用C89编写)

I don't think the old layers will vanish, and I think legacy higher layers written in C and C++ will simply be supported that way for an indefinite period of time, eventually being phased out for their replacements written in Ruby, Python, C#, or a future development.

我不认为旧的层将会消失,我认为用C和c++编写的旧的高级层将会在一段不确定的时间内被这样支持,最终被淘汰,取而代之的是用Ruby、Python、c#或未来的开发。

#14


-7  

Java. For most low level things Java is fine these days. Why go with a partial solution to C/C++ such as D or Go when you can have something as safe and easy to develop with as Java? If you are looking for a real time solution, D and Go are definitely not it, not to mention they are probably even less supported than Java.

Java。对于大多数较低层次的东西,Java现在是可以的。为什么要使用C/ c++的部分解决方案,比如D或go,当您可以使用Java开发同样安全、容易的东西时?如果您正在寻找实时解决方案,D和Go肯定不是,更不用说它们可能比Java更不受支持。


Java is now a system programming language. I don't see how you can consider anything with unsafe constructs such as pointers "next gen". The only reason those insecure constructs ever existed is because it was the pragmatic approach to building a turing complete language. There was no concern of representing the memory in discrete objects, because they just wanted to build something that worked. There are already hard and soft realtime applications in Java, a variety of hardware bytecode processors, and over 2 billion mobile devices running Java. At most all you would have to do is add some constructs for interoperability with devices, which wouldn't be that much code; even in C/C++ you'd still have to add these constructs...

Java现在是一种系统编程语言。我不知道如何考虑不安全的结构,比如指针“next gen”。这些不安全的构念存在的唯一原因是它是构建图灵完整语言的实用方法。不关心在离散对象中表示内存,因为他们只是想构建一些有用的东西。Java中已经有硬的和软的实时应用程序、各种硬件字节码处理器和超过20亿的运行Java的移动设备。你所需要做的最多就是添加一些与设备互操作的结构,这不是很多的代码;即使在C/ c++中,您仍然需要添加这些结构……

What are you programming? 8-bit microcontrollers with 1KB ram? In that case, it would be pointless to use anything other than the assembler for that platform...

你编程?带1KB ram的8位微控制器?在这种情况下,除了为该平台使用汇编程序之外,使用任何东西都是毫无意义的……