我是一名.NET程序员。 Python和/或Ruby的具体用途是什么会让我更有效率?

时间:2022-06-18 23:27:03

I recall when I first read Pragmatic Programmer that they suggested using scripting languages to make you a more productive programmer.

我记得当我第一次阅读Pragmatic Programmer时,他们建议使用脚本语言来使你成为一个更高效的程序员。

I am in a quandary putting this into practice.

我陷入了困境,将其付诸实践。

I want to know specific ways that using Python or Ruby can make me a more productive .NET developer.

我想知道使用Python或Ruby的具体方法可以使我成为一个更高效的.NET开发人员。

One specific way per answer, and even better if you can say whether I could use Python or Ruby or Both for it.

每个答案的一种特定方式,如果您可以说我是否可以使用Python或Ruby或两者,那就更好了。

See standard format below.

请参阅下面的标准格式

8 个解决方案

#1


5  

IronPython / IronRuby

IronPython in Action will do a better job explaining this (and exactly how best to use IronPython) that can possibly be accommodated in a SO answer. I'm biased -- I was a tech reviewer and am a friend of one of the authors -- but objectively think it's a great book. (No idea if IronRuby is blessed with a similarly wonderful book, yet).

IronPython in Action将更好地解释这个问题(以及究竟如何最好地使用IronPython),这可能会在SO答案中得到满足。我有偏见 - 我是一名技术评论家,并且是其中一位作者的朋友 - 但客观地认为这是一本好书。 (不知道IronRuby是否有幸拥有同样精彩的书)。

As you want "one specific way per answer" (incompatible with SO, which STRONGLY discourages a poster posting 25 different answers if they have 25 "specific ways" to indicate...!-): prototyping in order to explore some specific assembly or collection thereof that you're unfamiliar with (to check if you've understood their docs right and how to perform certain tasks) is an order of magnitude more productive in IronPython than in C#, as you can explore interactively and compilation is instantaneous and as-needed. (Have not tried IronRuby but I'll assume it can work in a roughly equivalent way and speed).

正如你想要的“每个答案的一种特定方式”(与SO不相容,如果他们有25个“特定方式”来指示......! - ,强烈阻止海报张贴25个不同的答案):为了探索某些特定的装配而进行原型设计或你不熟悉的集合(检查你是否理解他们的文档以及如何执行某些任务)在IronPython中比在C#中提高了一个数量级,因为你可以交互式地探索并且编译是瞬时的,并且如同-needed。 (没有尝试过IronRuby,但我认为它可以以大致相同的方式和速度工作)。

#2


4  

Less Code

I think productivity is direct result on how proficient you are in a specific language. That said the terseness of a language like Python might save some time on getting certain things done.

我认为生产力直接导致你对特定语言的熟练程度。这就是说像Python这样的语言的简洁性可能会节省一些时间来完成某些事情。

If I compare how much less code I have to write for simple administration scripts (e.g. clean-up of old files) compared to .NET code there is certain amount of productivity gain. (Plus it is more fun which also helps getting the job done)

如果我比较一下,与.NET代码相比,我为简单的管理脚本(例如清理旧文件)编写的代码少了多少,就可以获得一定的生产率。 (此外,它更有趣,也有助于完成工作)

#3


2  

Advanced Text Processing

Traditional strengths of awk and perl. You can just glue together a bunch of regular expressions to create a simple data-mining system on the go.

awk和perl的传统优势。您可以将一堆正则表达式粘合在一起,以便随时创建一个简单的数据挖掘系统。

#4


2  

Learning a new language gives you knowledge that you can bring back to any programming language. Here are some things you'd learn.

学习一门新语言可以让您了解可以使用任何编程语言。以下是您要学习的一些内容。

Add functionality to your objects on the fly.

动态添加功能到您的对象。

Mix in modules.

混合模块。

Pass a chunk of code around.

传递一大堆代码。

Figure out how to do more with less code: ruby -e "puts 'hello world'"

弄清楚如何用更少的代码做更多事情:ruby -e“把'你好'世界'”

C# can do some of these things, but a fresh perspective might bring you one step closer to automating your breakfast.

C#可以做一些这样的事情,但是一个全新的视角可能会让你更接近自动化早餐。

#5


2  

Embedding a script engine

Use of IronPython for a scripting engine inside your .NET application. For example enabling end-users of your application to change customizable parts with a full fledge language such as Python.

在您的.NET应用程序中使用IronPython作为脚本引擎。例如,使应用程序的最终用户能够使用完整的支持语言(如Python)更改可自定义的部分。

A possible example might be to expose custom logic to end-users for a work flow engine.

一个可能的示例可能是将自定义逻辑暴露给工作流引擎的最终用户。

#6


1  

Quick Prototyping - Both

In the simplest cases when firing a python interpreter and writing a line or two is way faster than creating a new project in visual studio.

在最简单的情况下,触发python解释器并编写一行或两行比在visual studio中创建新项目要快。

And you can use ruby to. Or lua, or evel perl, whatever. The point is implicit typing and light-weight feel.

你可以用ruby来。或lua,或者evel perl,无论如何。重点是隐含的打字和轻盈的感觉。

#7


1  

Cross platform

Compared to .NET a simple script Python is more easily ported to other platforms such as Linux. Although possible to achieve the same with the likes of Mono it simpler to run a Python script file on different platforms.

与.NET相比,简单的脚本Python更容易移植到其他平台,如Linux。尽管可以通过Mono之类的方式实现相同的功能,但在不同平台上运行Python脚本文件更为简单。

#8


1  

Processing received Email

Python has built-in support for POP3 and IMAP where the standard .NET framework doesn't. Useful for automating email triggered tasks.

Python内置了对POP3和IMAP的支持,而标准的.NET框架则没有。用于自动执行电子邮件触发的任务。

#1


5  

IronPython / IronRuby

IronPython in Action will do a better job explaining this (and exactly how best to use IronPython) that can possibly be accommodated in a SO answer. I'm biased -- I was a tech reviewer and am a friend of one of the authors -- but objectively think it's a great book. (No idea if IronRuby is blessed with a similarly wonderful book, yet).

IronPython in Action将更好地解释这个问题(以及究竟如何最好地使用IronPython),这可能会在SO答案中得到满足。我有偏见 - 我是一名技术评论家,并且是其中一位作者的朋友 - 但客观地认为这是一本好书。 (不知道IronRuby是否有幸拥有同样精彩的书)。

As you want "one specific way per answer" (incompatible with SO, which STRONGLY discourages a poster posting 25 different answers if they have 25 "specific ways" to indicate...!-): prototyping in order to explore some specific assembly or collection thereof that you're unfamiliar with (to check if you've understood their docs right and how to perform certain tasks) is an order of magnitude more productive in IronPython than in C#, as you can explore interactively and compilation is instantaneous and as-needed. (Have not tried IronRuby but I'll assume it can work in a roughly equivalent way and speed).

正如你想要的“每个答案的一种特定方式”(与SO不相容,如果他们有25个“特定方式”来指示......! - ,强烈阻止海报张贴25个不同的答案):为了探索某些特定的装配而进行原型设计或你不熟悉的集合(检查你是否理解他们的文档以及如何执行某些任务)在IronPython中比在C#中提高了一个数量级,因为你可以交互式地探索并且编译是瞬时的,并且如同-needed。 (没有尝试过IronRuby,但我认为它可以以大致相同的方式和速度工作)。

#2


4  

Less Code

I think productivity is direct result on how proficient you are in a specific language. That said the terseness of a language like Python might save some time on getting certain things done.

我认为生产力直接导致你对特定语言的熟练程度。这就是说像Python这样的语言的简洁性可能会节省一些时间来完成某些事情。

If I compare how much less code I have to write for simple administration scripts (e.g. clean-up of old files) compared to .NET code there is certain amount of productivity gain. (Plus it is more fun which also helps getting the job done)

如果我比较一下,与.NET代码相比,我为简单的管理脚本(例如清理旧文件)编写的代码少了多少,就可以获得一定的生产率。 (此外,它更有趣,也有助于完成工作)

#3


2  

Advanced Text Processing

Traditional strengths of awk and perl. You can just glue together a bunch of regular expressions to create a simple data-mining system on the go.

awk和perl的传统优势。您可以将一堆正则表达式粘合在一起,以便随时创建一个简单的数据挖掘系统。

#4


2  

Learning a new language gives you knowledge that you can bring back to any programming language. Here are some things you'd learn.

学习一门新语言可以让您了解可以使用任何编程语言。以下是您要学习的一些内容。

Add functionality to your objects on the fly.

动态添加功能到您的对象。

Mix in modules.

混合模块。

Pass a chunk of code around.

传递一大堆代码。

Figure out how to do more with less code: ruby -e "puts 'hello world'"

弄清楚如何用更少的代码做更多事情:ruby -e“把'你好'世界'”

C# can do some of these things, but a fresh perspective might bring you one step closer to automating your breakfast.

C#可以做一些这样的事情,但是一个全新的视角可能会让你更接近自动化早餐。

#5


2  

Embedding a script engine

Use of IronPython for a scripting engine inside your .NET application. For example enabling end-users of your application to change customizable parts with a full fledge language such as Python.

在您的.NET应用程序中使用IronPython作为脚本引擎。例如,使应用程序的最终用户能够使用完整的支持语言(如Python)更改可自定义的部分。

A possible example might be to expose custom logic to end-users for a work flow engine.

一个可能的示例可能是将自定义逻辑暴露给工作流引擎的最终用户。

#6


1  

Quick Prototyping - Both

In the simplest cases when firing a python interpreter and writing a line or two is way faster than creating a new project in visual studio.

在最简单的情况下,触发python解释器并编写一行或两行比在visual studio中创建新项目要快。

And you can use ruby to. Or lua, or evel perl, whatever. The point is implicit typing and light-weight feel.

你可以用ruby来。或lua,或者evel perl,无论如何。重点是隐含的打字和轻盈的感觉。

#7


1  

Cross platform

Compared to .NET a simple script Python is more easily ported to other platforms such as Linux. Although possible to achieve the same with the likes of Mono it simpler to run a Python script file on different platforms.

与.NET相比,简单的脚本Python更容易移植到其他平台,如Linux。尽管可以通过Mono之类的方式实现相同的功能,但在不同平台上运行Python脚本文件更为简单。

#8


1  

Processing received Email

Python has built-in support for POP3 and IMAP where the standard .NET framework doesn't. Useful for automating email triggered tasks.

Python内置了对POP3和IMAP的支持,而标准的.NET框架则没有。用于自动执行电子邮件触发的任务。