哪个更容易?从C ++或Java翻译...... [英] Which is easier? Translating from C++ or from Java...

查看:47
本文介绍了哪个更容易?从C ++或Java翻译......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有:


我正在使用一些现有软件的''纯''python端口。


实现我正在努力实现的目标(用C ++和Java开源

来源)。


这对我来说更容易使用一个参考?


我不是在寻找自动化工具,只是试图在

上收集意见哪种语言更容易理解/重写为python。


-cjl

解决方案

cjl写道:

我正在尝试完成的实现(C ++和Java中的开源源代码)。

哪个更容易用作参考?

我不是在寻找自动化工具,只是想收集哪些语言更容易理解/重写为python。



取决于你知道的语言最好的。但是Java比C ++更容易读取



-pu



Patrick Useldinger写道:

cjl写道:

我想要完成的实现是
(开放) C ++和Java中的源代码。

哪个更容易用作参考?

我不是在寻找自动化工具,只是想收集意见
哪种语言更容易理解/重写为python。


取决于你最熟悉的语言。但是Java比C ++更容易读取




在最后两句中肯定有些讽刺。但是,我和b $ b同意前者。这取决于你更了解哪些,每个人开发的风格等等。就个人而言,我更喜欢C ++。


" cjl" < CJ **** @ gmail.com>写道:

嘿所有:

我正在研究一些现有软件的''纯''python端口。

哪个更容易用作参考?

我不是在寻找自动化工具,只是试图收集关于哪种语言更容易理解/重写为python的意见。

-cjl



我已经从C ++和Java中进行了一些手动移植,但对于相同的算法,我从来没有使用过
。以下是需要考虑的一些要点:


1. Java已经是垃圾收集,面向对象,并且通常是bbb安全。所以算法几乎可以逐字复制到
Python中。在C ++中,你可能会得到指针,强制转换等等,这会让你感到难过。


2. Java作为一个社区正试图重新发明轮子你可能已经在图书馆里拥有的一切

。因此,在C ++中你可能只需绑定到同一个库,在Java中你可能需要通过一层又一层的java-isms来对抗你的b $ b方式。你可能最终会复制java-esque库而不是执行

实际感兴趣的代码。


因此需要权衡。对于纯算法和计算机科学的程序,java可能更容易。对于任何

使用库和API的东西,C ++可能会更容易。


实际上,我发现我需要阅读代码并且

用原始语言理解它。然后,受到这个

洞察力的启发,我编写了一个全新的python程序,使用python-esque

成语。因此,归结为哪一段特定的代码更容易理解,而这反过来又取决于原作者的

风格而不是语言。


-
ha ***** *******@boeing.com

6-6M21 BCA CompArch设计工程

电话:(425)294-4718

Hey all:

I''m working on a ''pure'' python port of some existing software.

Implementations of what I''m trying to accomplish are available (open
source) in C++ and in Java.

Which would be easier for me to use as a reference?

I''m not looking for automated tools, just trying to gather opinions on
which language is easier to understand / rewrite as python.

-cjl

解决方案

cjl wrote:

Implementations of what I''m trying to accomplish are available (open
source) in C++ and in Java.

Which would be easier for me to use as a reference?

I''m not looking for automated tools, just trying to gather opinions on
which language is easier to understand / rewrite as python.



Depends on what language you know best. But Java is certainly easier to
read than C++.

-pu



Patrick Useldinger wrote:

cjl wrote:

Implementations of what I''m trying to accomplish are available (open source) in C++ and in Java.

Which would be easier for me to use as a reference?

I''m not looking for automated tools, just trying to gather opinions on which language is easier to understand / rewrite as python.

Depends on what language you know best. But Java is certainly easier to read than C++.



There''s certainly some irony in those last two sentences. However, I
agree with the former. It depends on which you know better, the style
of those who developed each and so forth. Personally, I''d prefer C++.


"cjl" <cj****@gmail.com> writes:

Hey all:

I''m working on a ''pure'' python port of some existing software.

Implementations of what I''m trying to accomplish are available (open
source) in C++ and in Java.

Which would be easier for me to use as a reference?

I''m not looking for automated tools, just trying to gather opinions on
which language is easier to understand / rewrite as python.

-cjl



I''ve done a bit of manual porting from C++ and from Java, but never
for the same algorithm. Here are some points to consider:

1. Java is already garbage collected, object oriented, and generally
"safe". So an algorithm could be copied almost verbatim into
Python. In C++ you might get pointers, casts, etc. which would
leave you stumped.

2. Java as a community is trying to reinvent the wheel for everything
you might already have in a library. So whereas in C++ you might
just bind to the same library, in Java you might have to fight your
way through layer after layer of java-isms. You could end up doing
more work replicating the java-esque libraries than in doing the
actual code of interest.

Thus there is a tradeoff. For pure algorithms and
computer-science-ish programs, java may be easier. For anything that
uses libraries and API''s, C++ may be easier.

As a practical matter, I have found I need to read the code and
understand it in the original language. Then, inspired by this
insight, I write a wholly new python program, using python-esque
idioms. So it comes down to which particular piece of code is easier
to understand, and that in turn depends more on the original author''s
style than on the language.

--
ha************@boeing.com
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718


这篇关于哪个更容易?从C ++或Java翻译......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆