dynamic-languages

Is Automatic Refactoring Possible in Dynamic Languages?

馋奶兔 提交于 2019-12-04 18:24:50
问题 Perhaps I am limited by my experience with dynamic languages (Ruby on Netbeans and Groovy on Eclipse), but it seems to me that the nature of dynamic languages makes it impossible to refactor (renaming methods, classes, pushing-up, pulling-down, etc.) automatically. Is it possible to refactor AUTOMATICALLY in any dynamic language (with any IDE/tool)? I am especially interested in Ruby, Python and Groovy, and how the refactoring compares to the 100% automatic refactoring available in all Java

Is DB connection pooling all that important?

房东的猫 提交于 2019-12-04 15:58:23
In the Java world it is pretty standard for app servers to pool "expensive" resources, like DB connections. On the other hand in dynamic languages, most stacks have little to do with pooled resources and especially DB connections. E.g. for the popular PHP+MySQL combo, I've rarely seen it used with persistent connection, which can be considered poor-mans pooled connections. If the concept of pooling DB connections is not that widely implemented, does this mean that the performance/scalability gains might not be all that important, in real-life deployments? The main reason for connection pooling

Are Interfaces in JavaScript necessary?

独自空忆成欢 提交于 2019-12-04 08:18:10
问题 I suppose this could apply to any dynamic language, but the one I'm using is JavaScript. We have a situation where we're writing a couple of controls in JavaScript that need to expose a Send() function which is then called by the page that hosts the JavaScript. We have an array of objects that have this Send function defined so we iterate through the collection and call Send() on each of the objects. In an OO language, if you wanted to do something similar, you'd have an IControl interface

How programs written in interpreted languages are executed if they are never translated into machine language?

做~自己de王妃 提交于 2019-12-04 03:28:23
问题 Computers can only understand machine language. Then how come interepreters execute a program directly without translating it into machine language? For example: <?php echo "Hello, World!" ; It's a simple Hello World program written in PHP. How does it execute in machine while the machine has no idea what echo is? How does it output what's expected, in this case, the string Hello, World!? 回答1: Many interpreters, including the official PHP interpreter, actually translate the code to a byte

Dynamic languages for embedded devices? [closed]

一世执手 提交于 2019-12-03 16:27:54
Closed . This question is opinion-based. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 3 years ago . I need to deploy a dynamic language to a small embedded Linux device, and have difficulty finding the right one: I want to build a small web-application with this language (with a small framework like Sinatra or Camping ) and write some scripts for maintenance. I would prefer Ruby, as I have some experience in it, but after several days of trying to cross-compile

How do I attach a method to a dynamically-created C# type at runtime?

有些话、适合烂在心里 提交于 2019-12-03 13:47:19
I have been saddled with using an in-house data access library that is effectively XML passed to a stored procedure, which returns XML. There is nothing I can do about this. I tried to get ActiveRecord approved, but my request was declined. However, using the excellent code provided at http://blog.bodurov.com/Post.aspx?postID=27 , I added an extension method to IEnumerable that converts the key-value pairs I make out of the ragged XML coming back into strongly typed objects, complete with property names! This: dict["keyName1"] becomes MyObject.keyName1 Now the interface supports databinding!

Is Automatic Refactoring Possible in Dynamic Languages?

放肆的年华 提交于 2019-12-03 12:13:32
Perhaps I am limited by my experience with dynamic languages (Ruby on Netbeans and Groovy on Eclipse), but it seems to me that the nature of dynamic languages makes it impossible to refactor (renaming methods, classes, pushing-up, pulling-down, etc.) automatically. Is it possible to refactor AUTOMATICALLY in any dynamic language (with any IDE/tool)? I am especially interested in Ruby, Python and Groovy, and how the refactoring compares to the 100% automatic refactoring available in all Java IDEs. Given that automatic refactoring was invented in a dynamic language (Smalltalk), I would have to

Why do dynamic languages like Ruby and Python not have the concept of interfaces like in Java or C#?

最后都变了- 提交于 2019-12-03 09:00:41
问题 To my surprise as I am developing more interest towards dynamic languages like Ruby and Python. The claim is that they are 100% object oriented but as I read on several basic concepts like interfaces, method overloading, operator overloading are missing. Is it somehow in-built under the cover or do these languages just not need it? If the latter is true are, they 100% object oriented? EDIT: Based on some answers I see that overloading is available in both Python and Ruby, is it the case in

Using Groovy MetaClass to overwrite Methods

送分小仙女□ 提交于 2019-12-03 06:51:14
问题 I have a POJO that uses a service to do something: public class PlainOldJavaObject { private IService service; public String publicMethod(String x) { return doCallService(x); } public String doCallService(String x) { if(service == null) { throw new RuntimeException("Service must not be null"); } return service.callX(x); } public interface IService { String callX(Object o); } } And I have a Groovy test case: class GTest extends GroovyTestCase { def testInjectedMockIFace() { def pojo = new

Does the new 'dynamic' C# 4.0 keyword deprecate the 'var' keyword?

喜你入骨 提交于 2019-12-03 06:42:08
问题 When C# 4.0 comes out and we have the dynamic keyword as described in this excellent presentation by Anders Hejlsberg, (C# is evolving faster than I can keep up.. I didn't have much time to acquaint myself with the var keyword) Would I still need the var keyword ? Is there anything that var can do.. that dynamic can't? var x = SomeFunctionThatIKnowReturnsSomeKindOfList(); // do something with x dynamic x = SomeFunctionThatIKnowReturnsSomeKindOfList(); // do something with x 回答1: No, they're