问题描述
当我从现在开始编写代码时,我计划首先用漂亮、可读的伪代码布置所有内容,然后围绕该结构实现程序.
As I write code from now on, I plan to first lay out everything in beautiful, readable pseudocode and then implement the program around that structure.
如果我将我目前知道的语言从最容易翻译到最难翻译,我会说:
If I rank the languages that I currently know from easiest to most difficult to translate, I'd say:
Lisp、Python、Lua、C++、Java、C
Lisp, Python, Lua, C++, Java, C
我知道每种语言都有其优点和缺点,但我特别关注伪代码.您使用哪种语言最适合伪代码到代码?我总是喜欢学习新的语言.此外,如果您目前正在使用这种技术,我很想听听您关于构建实用伪代码的任何提示.
I know that each language has its strength and weaknesses but I'm focusing specifically on pseudocode. What language do you use that is best suited for pseudocode-to-code? I always enjoy picking up new languages. Also, if you currently use this technique, I'd love to hear any tips you have about structuring practical pseudocode.
注意:我觉得这是主观的,但每个人的喜好都有明确的答案.我在这里问这个问题是因为 SO 社区拥有非常广泛的受众,并且可能会建议我不会遇到的语言和技术.
Note: I feel this is subjective but has a clear answer per individual preference. I'm asking this here because the SO community has a very wide audience and is likely to suggest languages and techniques that I would otherwise not encounter.
推荐答案
您可能对 文学编程,这里你写的源代码"更像是写一本书,但它是一本可以纠缠"成真实代码或编织"成格式化文档的书.
You may be interested in Literate Programming, where the "source code" you write is more like writing a book, but its a book that can be "tangled" into real code or "woven" into formatted documentation.
请参阅 http://www.literateprogramming.com/cweb_download.html 中提供的示例.
See the examples provided at http://www.literateprogramming.com/cweb_download.html.
您可能还会发现 Eiffel 很有趣:
You may also find Eiffel interesting:
"... Eiffel 避免使用编码技巧或编码技术作为编译器的优化提示.目的不仅是使代码更具可读性,而且还允许程序员专注于程序的重要方面,而无需陷入了实施细节的困境...."
"... Eiffel shuns coding tricks or coding techniques intended as optimization hints to the compiler. The aim is not only to make the code more readable, but also to allow programmers to concentrate on the important aspects of a program without getting bogged down in implementation details. ..."
这篇关于哪种编程语言可以最好地弥合伪代码和代码之间的差距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!