views:

1089

answers:

20

Hi,

I'm about to produce a prototype for a technology startup that I've just joined, and I'm trying to decide which language to use. It's going to be a simple web tool with a MySQL database in the background and some AI stuff going on in between. I've used Ruby and PHP a reasonable amount in the past, but wonder whether I might be better off going with Python or even Perl. My main programming experience is with C / C++ / Java, but I feel like I want to go for something that will make my life as easy as possible since I'm just developing a prototype.

I guess what I'm looking for is:

  • speed of development
  • existing AI libraries (e.g. SVMs, neural networks, Bayesian classifiers)
  • ease of interacting with a web interface

Anyone have any thoughts on this?

Thanks,

Ben

+7  A: 

The only thing I can really comment on is this: PHP is bascially a DSL for the web, whereas the other three (Perl, Ruby, Python) are more general-purpose languages that have no specific domain, although all are definitely web-capable.

In terms of your second bullet point, I think PHP will probably be the worst choice out of your list.

Peter Bailey
+2  A: 

If you're used to the unix stack/environment, I would go for Python - nice and easy.

EDIT: You can implement the number-crunching part in C or C++ and make it a module to use in your python code. This way, you get fast number-crunching code, and easy-to-program glue.

Carl Seleborg
+6  A: 

AI? Definitely LISP

Aaron Palmer
Actually, the tie between AI and Lisp, at least the statistical flavor of AI he's talking about, really isn't all that strong. I'm a big fan of lisp, but the the two just don't necessarily go together these days. It's a historical accident of them being developed in the same lab.
John the Statistician
The three points are all met by Lisp, though.
Svante
We both might find that true, although getting ease and speed of development from a given language in the early stages of learning has been found to vary wildly from person to person, in my experience.
John the Statistician
Some AI resources: http://www.cliki.net/AI http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/areas/0.html http://www-2.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/0.html http://www.ifi.uzh.ch/ailab/aiwiki/aiw.cgi LISP success stories:http://wiki.alu.org/Success_Stories
Svante
Web development resources:http://www.cliki.net/webHave a look at `hunchentoot` and `cl-weblocks`
Svante
That's a good point: let the users see the resources and decide for themselves; I promote these comments
John the Statistician
After reading the requirements my first thought was lisp also. It'll help you write your own AI functions just in the way the language works, but as for libraries, might not be the best choice.
Josh Smeaton
+4  A: 

I think Java would make your life easiest.

  • speed of development - you said you're already familiar with it.

  • existing AI libraries - check out JOONE

  • ease of interacting with a web interface - servlets, JSP, too many Web frameworks to list.

Java also integrates easily with MySQL using JDBC.

Bill the Lizard
+3  A: 

I think Perl would be the way to go . Check out Moose for Perl OOP , and as for the other libraries you're searching for , I'm sure you'll find some of them on CPAN ( maybe something like the Bayesian modules )

Geo
Moose isn't an acronym, just a name. But yes, Moose is great.
Dave Rolsky
I would like to mention that you could use Inline::C Inline::Cpp Inline::Java
Brad Gilbert
A: 

If you're a Mac user have a look at WebObjects to do all the framework stuff, and you can focus on writing the meaningful neural code in Java.

Robert S.
Someone got a little downvote crazy today. heh.
Robert S.
A: 

Try Python using Mod_Python. As a language, it's got a lot of great machine learning and natural language processing modules, and it's really easy to read, learn, and use.

Robert Elwell
Mod_Python has been more-or-less replaced by mod_wsgi, which is more flexible and uses less memory.
sep332
+13  A: 

Prototype or not, if you are crunching huge amounts of numbers, you may need the speed of a Java or C/C++ at least for the AI parts. I don't really know exactly what you are doing but a lot of AI stuff is computation intensive. You may find Python VS C makes a difference from 10 minutes to almost 2 hours or more (or from a day to a month).

Probably your best bet is a hybrid approach. Java/C++ or something for the AI (I only say Java because it has a ton of libraries, I even have a book on Data Mining which discusses several libraries in Java that are freely available and perform some of the techniques). And Python/Ruby/Perl for everything else (like the web parts).

I am hesitant to recommend PHP because you never know what you may be doing. PHP seems to really shine on the web and for web related things, but once you need non web uses it seems to be more cumbersome than anything (although I have seen references to PHP being used like a Perl/Python/etc. as a normal scripting language by some people).

The choice between Python/Ruby/Perl is almost a matter of taste. Except that Perl has CPAN which is beyond anything Python and Ruby have right now. Since you are in a start up, the wide selection of modules on CPAN that you can just slap together may provide value to you in getting things done sooner. Personally I like Python over Perl (I find Perl's object system to be ugly when building your own objects, and sometimes it takes me a bit to figure out how code I wrote months ago works). But I can't deny the value of CPAN.

So in short, you probably need a performance language for some of the AI stuff and the ease and speed of development of a scripting language for everything else because a start up is all about getting the product done as soon as possible and beating your competitors to market. I would love to recommend Python, but based on what I know about start ups, you need to evaluate CPAN in your decision process. Just being able to slap a bunch of modules together that do what you want quickly can be of huge value in a start up.

I should also add that Perl and Python (I'm not sure about Ruby but I think that to) can call C code rather easily. So you could use C or C++ libraries by creating a set of bindings to the language. You could also try writing the whole thing in Perl/Python/Ruby and if it is too slow rewriting that part in C or C++ and calling it from the scripting language. With the whole start up thing rewriting like this can be very expensive in terms of getting something done. Also since you are most comfortable in C or C++ or Java it may be worth just going there from the start.

Cervo
If you find Perl's "native" OO ugly (which it is), check out Moose.
Dave Rolsky
I also would suggest you read about Moose (on CPAN), it might make a lot of difference
nav.jdwdw
A perfect example of the value of CPAN :)
Cervo
Let's not hang on what I said about Perl :) Language is a personal preference and I like Python more for my own reasons. The point is that even though I like Python more, I still have to recommend Perl because of CPAN. And that Ben needs to make a decision on his own as to which is best.
Cervo
The other point was that either of Perl/Python/Ruby is mostly a matter of style. But CPAN is something that needs consideration of its own, doubly and triply so because Ben is working for a start up.
Cervo
My point was simply that if you find native Perl OO ugly, there are other options that don't involve switching languages. That doesn't mean Python doesn't have other good points.
Dave Rolsky
And that's okay. In fact I find it to be a great example of exactly why Ben shouldn't be so quick to dismiss CPAN. Different object systems are just the tip of the iceberg.
Cervo
It's a prototype, and speed of development is a major concern. That suggests c++ might not be optimal.
Stephan Eggermont
+10  A: 

All three of Ruby, Python, and Perl are good for quick development, prototypes, and web apps. I'm guessing from your question that the most substantial part of this project is the AI piece. Perl does have quite a number of AI-related libraries on CPAN. Check out the AI namespace for a sampling. There's also modules in other namespaces so make sure to search for specific things like "Bayes" or "SVM".

I don't know much about the AI library options for Python or Ruby. My recommendation is to take a day or two and do some serious research on the libraries for each of Perl, Python, and Ruby. Since you've already used Ruby before, if that has the libraries you need, it's a no-brainer, and Ruby is certainly web friendly.

As far as the web side goes, for Python, I've heard many good things about Django. For Perl, I'd recommend taking a look at Catalyst.

You'll note I've ignored PHP. That's something I try to do as much as possible ;)

Dave Rolsky
Beside Catalyst you might want to check CGI::Application (which is great, also for rapid development), and the new kid in town Mojo (http://mojolicious.org)
nav.jdwdw
A: 

Given that its not a simple CRUD app, Java might be a good option. Take a look at Grails ( http://grails.org/ ) it offers much of the scaffolding and code generation that a framework like rails does, but offers seamless integration with any other Java library or framework out there.

+1 for groovy (http://groovy.codehaus.org/). It's a dynamic language akin to Python/Ruby but with fantastic Java integration.
Aaron Maenpaa
A: 

PHP or even SSI would be my choice for prototyping in this case. My reasoning: I don't have to worry about a templating system, as they both ARE templating systems. No sense wasting time deciding on a templating system for a mere prototype. SSI in particular is a compelling choice, you still have your choice of languages for the CGI processing, and as for returning non-atomic data, you can emit JSON, and then allow the UI to loop over the returned data structure using Javascript.

George Jempty
Most any language have templating systems. It's not a big win for PHP.
brian d foy
News from a seaside developer: you do not want a template system
Stephan Eggermont
+8  A: 

You choose a language because it is the right tool for the job, but you haven't told us what the job is yet. We don't know what sorts of libraries you'll need, what other people in the industry use for the same job, and so on. Most people seem to be recommending something with complete ignorance of what you actually need to do, which means they really have no idea how to help you.

As you already have pointed out:

  • If you are the only person doing your task in language X, you're going to have a tough time getting help from anyone else. Find out what other people have already used to do similar tasks.

  • If all of the good libraries for your task are in another language, you're going to have to reinvent a lot of wheels. Instead of your question, ask about which libraries do the important parts of your task, then research those. "AI" is much too big of a topic to recommend anything.

  • If no one at work knows the language you want to use, even if it is a rapid prototyping language, you'll lose the rapidity as they have to learn the language. Learning a language is more than knowing its syntax; it's knowing its idioms, libraries, documentation, and a lot more. What do the people at work already know? What will they tolerate?

  • Do you really want to make your life easier, or make it easier for your customer? Those things are sometimes at odds, so you should consider if you are really delivering the value the customer needs. Prototypes seem to often turn into the production code, so once you start, you're often stuck with it.

brian d foy
+4  A: 

I agree with the other answers that recommend Java, especially as you may need it's speed in the AI code, and for the libraries etc. that are available.

A combination of Java (servlets) and JSP would probably work nicely.

However, the reason for writing this answer is to most highly recommend:

Go with what you know.

New languages or ones you "sort of" know are great for fun stuff, and even for some development projects and prototyping. But if you need something that will work for you in the long run, use the best language for the task THAT YOU ALREADY KNOW. In this case, I think (from your post) it would be Java.

Also - it's a prototype now, but I can almost guarantee that if it works, it will become the default start of the actual application. I really doubt you will have the luxury of time to rewrite the application from scratch in another language, so again - using what you know now will pay dividends later when they "time crunch" you and you must deliver.

Cheers,

-R

Huntrods
A: 

Something that manages memory for you. They claim it is the technology change that gives the biggest boost in productivity. I think pound-for-pound c# is incredibly hard to beat.

vfilby
+1  A: 

I would second taking a look at grails. It is definitely easy to set up and get working within an hour, and you still have the power of java underneath.

I also agree with those who say make sure you are thinking down the road. I have been the beneficiary way too many times of those who had not.

+1  A: 

If it were me, I would write the whole thing in python, then profile it and write the bottlenecks in pyrex. When you're developing complex AI-type algoritms, it's (1) useful to develop in a high-level language so you can quickly try lots of different approaches and (2) useful to have a reference implementation in a high-level language to test the C/C++ implementation against. I use python/pyrex in this way all the time and it works well for me.

fivebells
A: 

Regarding Python:

If you need performance for compute-intensive stuff, look at Numeric Python http://numpy.scipy.org/ and Pyrex http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ . Numeric Python is a Python extension that provides a lot of old-school numeric facilities as fast C code -- vector math (an essential tool for ANN work), etc. Pyrex is a tool that essentially allows you to compile Python code down to a native executable.

With Pyrex you need to be careful about using reflection, because it can't fully compile code that uses certain reflective constructs (notably locals() and globals()). I mention this restriction only because both AI and exploratory coding (implied by your "prototype" remark) often take advantage of reflection more than other kinds of application areas do.

+2  A: 

Lisp has been mentioned, but I think Scheme (in particular plt-scheme) is in some respects as good a choice as Ruby/Python/Perl/PHP. It doesn't have as many good libraries as some of those, which is a minus, but most schemes have excellent ffi (foreign function interface), which makes it trivial to integrate external (C code) libraries. Another strength of scheme is its performance profile; You can often get near C-code type performance on number-crunching stuff.

troelskn
+2  A: 

You might want to take a look at GLASS: smalltalk, seaside and a gemstone object database. Better web than ruby, no orm, and the best modeling language.

Stephan Eggermont
+1  A: 

If you're whipping up a quick and dirty prototype, then it's probably within your interest to stick to something you already know, particularly if the prototype is to show off some other piece of fancy functionality; performance many not be a massive concern here.

Rob