问题
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?
回答1:
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.
回答2:
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 ;)
回答3:
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.
回答4:
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.
回答5:
AI? Definitely LISP
回答6:
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.
回答7:
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
回答8:
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 )
回答9:
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.
回答10:
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.
回答11:
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.
回答12:
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.
回答13:
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.
回答14:
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.
回答15:
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.
回答16:
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.
回答17:
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.
回答18:
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.
回答19:
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.
回答20:
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.
来源:https://stackoverflow.com/questions/269417/which-language-should-i-use