什么会更有成效? 将 VAX PASCAL 转换为 GNU PASCAL 或将其移植到 perl 或其他语言

发布于 2024-07-11 00:33:04 字数 1431 浏览 9 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

靑春怀旧 2024-07-18 00:33:05

我总是尽量用公司主要使用的语言来编写程序。

如果公司里有 6 名程序员在做 C++,那么诉诸脚本语言是没有意义的(因为它更容易),从而增加了对下一次招聘的语言要求。

就我个人而言,我讨厌 Perl,因为它的语法有点加密。 此外,它不是一种“企业”语言,特别是在这里,而且在 Unix 系统管理角落之外,很难找到真正精通它的人 (*)

请注意,这只是我当前观点的一篇文章,这主要是一家小商店里的程序员的工作,他们有大的商业客户,将他们的做法强加给我们。 YMMV。

(*) webdevels 在这里主要做 ASP.NET。

I always try to write programs as much as possible in the language the company mainly uses.

It makes no sense to resort to a scripting language (because it is a fragment easier) if there are six programmers sitting doing C++ in the company, increasing the language requirements on the next hire.

Personally I resent Perl because, well, the syntax is slightly cryptographic. Moreover it is not such a "corporate" language, specially not here, and outside of the Unix sysadmin corner it is hard to find people that are really versed in it (*)

Note that this is just a write-up from my current viewpoint, which is mostly that of a programmer in a small shop with big commercial clients that force their practices on us. YMMV.

(*) webdevels do mostly ASP.NET here.

冷弦 2024-07-18 00:33:04

我会尝试将其移植到 Free Pascal,但有时间限制。 如果太难,那么就回退到(你)最近使用的语言。

有什么方法可以测试新(移植或翻译)版本的行为是否与旧版本相同?

I would try to port it to Free Pascal, but with a time limit. If it's too hard, then fall back to a more recently used (by you) language.

Is there any way to test if the new (ported or translated) version behaves the same as the old one?

无名指的心愿 2024-07-18 00:33:04

考虑到它只有 1500 行代码,而且虽然 Pascal 有很多优点,但 I/O 并不是其中之一,我会将整个东西移植到 C 中,将其分解为模块并在此过程中编写一些单元测试。 移植到新的 Pascal 时,不同方言的兼容性有一个很大的“未知因素”。 如果你把它移植到 C 上,第一天结束时你就会知道这项工作需要多长时间,一旦你完成了它,你就会把它彻底搞定,因为 C 会比我们所有人都活得更久。 我同意乔尔·尼利的观点; 找到另一个 C 程序员来维护它总是很容易的。

由于该程序非常小,并且主要是 I/O 和整数操作,因此我认为 C++ 在这里没有作用。 不值得额外的复杂性。

Given that it is only 1500 lines of code, and that while Pascal had many virtues I/O was not one of them, I would port the whole thing to C, breaking it up into modules and writing some unit tests along the way. Porting to a new Pascal there's a big 'unknown factor' in just how compatible the different dialects are. If you port it to C you'll know by the end of the first day how long the job will take, and once you've done it you'll have it thoroughly nailed, because C will outlive us all. And I agree with Joel Neely; it will always be easy to find another C programmer to maintain it.

Because the program is so small and is mostly I/O and integer manipulation, I don't see a role for C++ here. Not worth the extra complexity.

悟红尘 2024-07-18 00:33:04

我首先会考虑长期可维护性(包括除您之外的其他人)。 例如,如果您是唯一了解 PASCAL 的人,并且您不想成为该程序的维护和支持的唯一所有者,那么 PASCAL 可能不如具有更广泛开发人员基础的语言那么好在你的店里。

如果这不是一个决策问题(例如,多个开发人员都同样熟悉相同范围的语言),那么我会估计 gnu PASCAL 移植的时间与 Perl 移植的时间相同,并选择目标语言,这样会花费更少的时间到时候使用。

如果这也不是一个决策问题(即同等水平的努力),那么我会考虑运行时经济性(更高的速度,更小的内存占用)。

I would first consider long-term maintainability (including by someone other than you). If, for example, you're the only one who knows PASCAL and you don't want to be the sole owner of maintenance and support for this program, then PASCAL might not be as good a choice as a language with a wider developer base in your shop.

If that is not a decision issue (e.g. multiple developers all equally familiar with the same range of languages), then I'd estimate time for the gnu PASCAL port to time for e.g. the Perl port and go with the target language that would take less time to use.

If that also is not a decision issue (i.e. equivalent level of effort), then I'd look at run-time economy (higher speed, smaller memory footprint).

給妳壹絲溫柔 2024-07-18 00:33:04

我认为将 1500 行代码移植到任何语言/平台应该不会太难,因为您所需要做的就是“执行填充”并计算校验和。 就我个人而言,我更喜欢 C# - 它对我的心灵有舒缓作用:),但考虑到您对 C/C++ 的熟练程度,我建议您选择 C++,原因很简单,C++ 是世界上最好的汇编语言,将满足您的要求完美。 我认为 pascal 是一些过时的和新项目应该避免的东西。 如果我错了,请随时纠正我。

用 C 编程是一件苦差事,为进一步增强程序留出一些空间,C++ 似乎是最好的选择。 另外不要忘记,与 C 不同,C++ 有一些非常强大的库支持(STL、Boost 等)。

I think porting 1500 lines of code to any language/platform should not be too hard given the fact that all you need to do is "perform fills" and compute checksums. Personally I would have preferred C# - it has a soothing effect on my mind :) but given your proficiency in C/C++ I would advise that you go with C++ for the simple reason that C++ is the world's best assembly language and will fulfill your requirements perfectly. I think pascal is some what antiquated and new projects should avoid it. Please feel free to correct me if I am wrong.

Programming in C is a chore and to leave some room for further enhancements to your program C++ seems to be the best option. Also do not forget unlike C, C++ has some very capable libraries backing it up (STL, Boost etc).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文