login about faq

What kinds of applications or features/requirements make a good case for the use of a dynamic language like Python or Ruby, instead of a static language like Java or C#?

(Aside from apps that require scripting capability, I might say.)

asked Dec 16 '09 at 08:28

cruizer's gravatar image

cruizer
1.5k9

edited Jan 08 '10 at 15:47

AnGoL's gravatar image

AnGoL
1.3k318

1

why does this question sound familiar? :P

(Dec 16 '09 at 08:40) Jon Limjap Jon%20Limjap's gravatar image

because we were talking about it last night!

(Dec 16 '09 at 08:54) cruizer cruizer's gravatar image

The term "dynamic language" is a pretty broad term so I'll assume this question refers to both programs that do compile time stuff during runtime (e.g. metaprogramming) and dynamically typed languages.

A lot of apps that are currently done in static languages can be done better in dynamic languages. The big one here would be web application development, mainly because ORMs and Front Controllers can be simplified via metaprogramming. There's also the option of using DSLs for testing and other aspects of web development.

Sure, it's no silver bullet and you won't see an order of magnitude improvement over static languages, but with the right technology and people, you would see significant improvements in productivity.

Which leads us the the limitations of dynamic languages, namely technology and people.

If your client's platform (or the client himself) doesn't support dynamic languages, then it's obviously not a good use case. Also, if you need to interface with existing systems outside of open protocols, going with the existing system's language is a better choice.

Then there's the people. An average Java developer wouldn't know the pros and cons of dynamic typing and closures, let alone metaprogramming. Many of them are also unwilling to learn, as evidenced by stories/jokes of devs sticking with one language for the rest of their lives. Without proper mentoring, these developers will keep on doing the things they used to do in their previous language regardless if it's appropriate or not.

When Java developers started programming in Ruby some years back, it wasn't a pretty sight. :P

link

answered Dec 17 '09 at 11:39

Bryan%20Bibat's gravatar image

Bryan Bibat
2.6k119

2

it's like programming Ruby with a Java accent :P in the case of Friendster long ago, it was programming Java with a PHP accent. and in my case years back, programming Perl with a C accent!

(Dec 17 '09 at 14:07) cruizer cruizer's gravatar image

+10 on this: When Java developers started programming in Ruby some years back, it wasn't a pretty sight. :P

(Dec 18 '09 at 00:01) radamanthus radamanthus's gravatar image

Some thoughts:

  1. I would love to see mathematical models involving operations research being written in dynamic languages. At the moment model solvers implement their own notations/languages. Optimization models require a lot of testing and validation, requiring implementors to tweak them every so often.

  2. Tax computations. If you're doing tax accounting software, dynamic languages will come in handy. I've implemented a similar requirement when working on a government accounting software, where tax structures are a bit different from the consumer taxation rules that we know of. This will also help you port the app in areas that have a different set of taxation requirements.

  3. Uber-dynamic super searches. Can't say anything more on this. The issue search feature of Redmine (an issue ticketing app made from RoR) says it all. ;)

link

answered Dec 17 '09 at 05:31

leypascua's gravatar image

leypascua
1.6k115

In The Rails Way, Obie Fernandez described a use case that in my opinion is better implemented using a dynamic language.

His example involved modifying class instances on the fly. On the database, wherein each table row maps to a class instance, there is a column named "config". This column contains code - methods, etc. - that is eval'd when the row is instantiated.

Let me explain with my own example. Note that I haven't used this technique before, but this is how I imagine I'd use the Obie Fernandez technique.

Imagine a role-playing game, wherein you control a space ship. Some space ships will have the classic_warp_engine, some may have the warp_nine_engine, and an elite few may be equipped with the uber_secret_stolen_from_the_romulans_warp_engine. Code-wise, they have the same interface: ship.engage_warp_drive(). But the engines behave differently: they activate different animations, and different sound effects.

And the beauty here is that the differences between the engines is in the database, not in the code. If you want the uber_secret_romulan_warp_engine to have a 30% chance of blowing up when used, but only for the user named "radamanthus", just change the database row for user radamanthus. No code changes required.

Coolness.

link

answered Dec 16 '09 at 11:58

radamanthus's gravatar image

radamanthus
1.1k110

Hmm.. Isn't this example still a "scripting" requirement?

(Dec 17 '09 at 05:13) leypascua leypascua's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×30
×1
×1
×1

Asked: Dec 16 '09 at 08:28

Seen: 611 times

Last updated: Jan 08 '10 at 15:47