Which language should I use?

2020-02-06 03:07发布

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?

20条回答
我只想做你的唯一
2楼-- · 2020-02-06 03:12

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.

查看更多
Juvenile、少年°
3楼-- · 2020-02-06 03:13

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.

查看更多
兄弟一词,经得起流年.
4楼-- · 2020-02-06 03:14

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.

查看更多
We Are One
5楼-- · 2020-02-06 03:14

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.

查看更多
We Are One
6楼-- · 2020-02-06 03:15

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.

查看更多
男人必须洒脱
7楼-- · 2020-02-06 03:16

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.

查看更多
登录 后发表回答