Programming Languages: What tool is right for which job?
therighttool.hammerprinciple.com
therighttool.hammerprinciple.com
Personally, Python, Java, and ObjC gets me everything I need and it allows me to get really good at a few languages instead of trying to keep 10 different ones in my head. Granted, if you know a few languages any new one should be fairly easy to pick up.
You don't want to start a job with some new language only to find out that it hasn't evolved enough to give you exactly what you need in your project.
I'd love to hear how people decide what language to use in their business. Do you pick Python over Java because it's simpler to write? Do you use PHP because of how well it's documented?
Like others, I'm saying this based on the title as I can't get the page to load.
Some languages (e.g. Matlab, Erlang) were designed for specific domains in which they excel, but most were designed to be general-purpose. So, most of those languages are really suitable for most tasks.
There are few things that, for example, one might code in Java, that I would not consider using Python for. The two are very different, of course, but for non-specialized applications, the practical reasons for using one over the other come down to other concerns; ubiquity, your own familiarity, interoperability with your existing infrastructure, etc. Me, just I'll choose the novel general-purpose language out of interest.
Then again, a few languages I've worked with (i.e. PHP, Matlab) deserve thoroughly to be crucified for their crimes against computer science and developers everywhere.
The only thing that's certain is that language popularity surveys are painfully easy to cherry-pick.
So, yes, it's true, I haven't used the right tool for the job. Except that as with so many things "the right tool" is "an actively maintained codebase". Looking into why it's crashing now, but don't expect any miracles
Turns out a query I'd written back when there were 20k votes in the system didn't perform so well now that there are 200k votes in the system. Go figure.
I realize that the future of the Flash Platform is in doubt, but Flash is still a great choice for a lot of things, like:
- This language is good for beginners.
- This language is well documented.
- I find this language easy to prototype in.
"This language has a niche in which it is great"
"This language has a niche outside of which I would not use it"
"I enjoy playing with this language but would never use it for "real code""
"I am sometimes embarrassed to admit to my peers that I know this language"
"The thought that I may still be using this language in twenty years time fills me with dread"
Can ActionScript say that?
http://therighttool.hammerprinciple.com/statements/programs-...
It's definitely the case that stock Ruby 1.8 is slow for a great many applications, though. Having said that, there's alternatives, and a lot of the time efficiency of execution is not at the forefront of the objectives for systems written in Ruby.
"faster" compared to what? "pretty fast" compared to what?
I was not trying to be precise though, just give a feel for the different implementations.
(The Shootout is not the One True Measure of speed... but it isn't meaningless, either.)
Generally the only thing this really means though is that you wouldn't want to do hard-core computation in pure Perl/Ruby/Python, hence things like NumPy. [1]: http://shootout.alioth.debian.org/u64q/which-programming-lan...
[1] http://www.infoq.com/presentations/Systems-that-Never-Stop-J...
This pretty much rules out e.g. Python and Ruby, because the CPython/CRuby interpreters suck at concurrency (there are other implementations available, which are a little better). You can still do many Python processes, which do lightweight switching between I/O tasks somehow (e.g. with Twisted), but then load balancing between processes becomes a PITA. Node.js is similar, there's only one thread running at once. With Node.js (and twisted) you also have to manually "compile" your code for asynchronous style continuation passing style, something humans suck at but compilers do very well.
Now given the task you said, you could take C and epoll/kqueue and write a small framework yourself, but processing the data you got with C might not be too nice.
Or you could use an interpreter or a compiler that does this automatically for you. This is where the choice of language kicks in. In order for the language implementation to be able to effectively organize parallel execution, it needs some information from the language. C doesn't have any helpful information, which is why it often relies on full OS context switches where all machine state is stored and restored (or a non-portable hack with the stack). Something lisp-y with first class continuations might be helpful, but many lisp implementations don't really do concurrent execution well.
So, for a language that concurrently executes network I/O efficiently while still being high level and fast, my recommendation for your task would be: Haskell. There's years of research and engineering work done on just what you're looking for in Haskell. Just forkIO as much as you wish, write your code in regular sequential imperative style, compile for multithreaded execution (ghci --threaded) and let the compiler and runtime do all the hard work for you.
Erlang might do the job too. If anyone knows of other languages with smart I/O multiplexing and co-operative userland threads or fibers (with concurrent execution!), please reply here!
NOTE: my assumption was that you're actually processing the data you're receiving and you're more or less CPU limited. If you're I/O bound, you don't necessarily need concurrent execution and may get away with Twisted or Ruby fibers or Node.js (without using multiple processes and load balancing or task queues).
It's been around for two years slowly bitrotting (I really should do some maintenance on it). Just gradually been getting slower and this time it hit the threshold where it was too slow to stay up. It happens.
There are certainly cases where one language at another for a given task, e.g. Ruby is better for string parsing than PHP. But in many (most?) scenarios the technique used for the job matters far more than the language. Sorting is an easy example: bubble sort is a crap solution regardless of the language.
Disclaimer: I can't read the actual page due to 503's and the cache isn't helpful, so I'm responding to the title and what I can divine from the linked page.
Once you know several techniques and several languages, and have started to get a skill at identifying the core bits of a project, the process (or series of questions to answer) becomes:
- what technique will effectively handle to core problems?
- What languages make this technique simple to implement?
and then the real kicker, which in a way comes full circle to the original naive analysis:
- in the best language for $technique, are there any problems with secondary and ancillary problems associated with it? (e.g. i have to do this really fast lookup table of simple operations, C would be great for this, except that the data is irregular and involves a lot of string parsing C sucks at that..., or the central problem here is just a big fold, i'll use Haskell, but it involves a lot of tricky memory optimization to be fast enough...)
Out of this of course arises a meta-technique of learning to partition problems into stages in different languages, which of course has its own problems.
In that context, I disagree with your assesment. It often takes me a week, sometimes more, to evaluate and choose the right solutions for a new product. The techniques that I use when coding matter little during that time.
What _does_ matter: third party services and libraries that will make it easier to build a better product.
However, I agree that choice of language is only tangially significant. It's rarely a "pain point" for me. Gui toolkits, cloud services, hosting solutions, payment solutions, libraries for [you name it], etc. _those_ make up the "tool for the job."
I sometimes wonder what we could achieve if choices of language were reduced and we were all forced into "speaking the same language". Would the advantages of a common language supercede the advantages of any one language's design?
But seriously, i think its great that we can all work in our favorite language, and we can get away with it. I can write a web service in common lisp, and you can use it in your Rails cat picture app, that also uses a brainf*ck script to convert the cat pictures in a suitable format. And your company can also write an iPhone version of your app in objC and a desktop version in C++ for windows and Linux. Man, protocols are awesome :)
I trace the existence of many languages to having no common instruction set in hardware.
Different assembly languages for different hardware. This was very frustrating for people many years ago.
If protocols (rules) are awesome what if we had had a protocol that asked the chip makers to use a common (extendable) instruction set for all hardware? What if there had only been one assembly language?
It seems that all abstractions, from Pascal or Lisp virtual machines to C to higher and higher level languages to the ones popular today, are all descended from the search for a way to deal with that initial lack of protocol (rule) to get hardware makers to use the same instruction set and thereby let programmers use the same assembly language.
I could be very wrong on this.
Maybe I am misunderstanding this.
But Lisp and C derives from very different views of the underlying machine. It is rather hard to unify a lisp machine (or other lambda calculus machine) instruction set with the instruction set assumed by a language like C. Even assuming extensibility of the instruction set, constructing a machine that can execute both the "usual" instruction set and lambda calculus efficiently is very very hard.
So this may not really be practical.
I would like a One True Assembly because it would make it easier to develop new languages. :)