转载

[英] Quora 为什么选择 Python 作为他们的开发语言?

[英] Quora 为什么选择 Python 作为他们的开发语言?

Adam D'Angelo , Quora Founder

Upvoted by Charlie Cheever , One of the founders of Quora Marc Bodnick , Leads Quora's Business & Community Teams Jay Wacker , Quora Topic Ontology Architect

We were sure we didn't want to use PHP. Facebook is stuck on that for legacy reasons, not because it's the best choice right now.[1] Our main takeaway from that experience is that programming language choice is very important and is extremely costly to change.

Python was a language that Charlie and I both knew reasonably well (though I know it a lot better now than I did when we started). We also briefly considered C#, Java, and Scala. The biggest issues with Python are speed and the lack of typechecking.

C# seemed pretty promising. As a programming language, it's great, but:

  • We didn't want to be on the Microsoft stack. We were up for learning something new, and MS SQL Server actually seemed pretty good, but we knew we'd need to integrate with lots of open source code that has only second-class support for .NET, if it supports it at all. Also, most of the best engineers these days are used to open source stuff.
  • We didn't want to take the risk of being on Mono (an open source implementation of C#/.NET). It's not clear how long funding will be around for that project, and I'd heard of various performance problems. Plus, it seemed like everything else in the C# ecosystem would assume we were on the Microsoft stack.

For a lot of little reasons, Java programs end up being longer and more painful to write than the equivalent Python programs. It's also harder to interoperate with non-Java stuff. Scala had a lot of the downsides of Java and the JVM, although it wasn't quite as bad. The language seemed a little too new and like it would bring some unnecessary risk (for example, who knows how good support will be in 10 years).

Two other languages we very briefly thought about were OCaml and Haskell (neither had big enough ecosystems or good enough standard libraries, and both were potentially too hard for some designers/data analysts/non-engineers who might need to write code).

We decided that Python was fast enough for most of what we need to do (since we push our performance-critical code to backend servers written in C++ whenever possible). As far as typechecking, we ended up writing very thorough unit tests which are worth writing anyway, and achieve most of the same goals. We also had a lot of confidence that Python would continue to evolve in a direction that would be good for the life of our codebase, having watched it evolve over the last 5 years.

So far, we've been pretty happy with the choice. There's a small selection bias, but all of the early employees who'd been working with other languages in the past were happy to transition to Python, especially those coming from PHP. Since starting the following things have happened:

  • Python 2.6 got to the point where enough of the libraries we used were compatible with it, and we made a very easy transition to it.
  • Tornado (web framework) was released as open source, and we moved our live updating web service to that.
  • PyPy got to the point where it looks like it will eventually be usable and will give us a significant speedup.

All together, these give us confidence that the language and ecosystem is moving in a good direction.

[1] What are the horrors of PHP? and Do Facebook engineers enjoy programming in PHP? and Why hasn't Facebook migrated away from PHP?

and

What are some of the advantages of PHP over other programming languages?

for more on that.

8,627 upvotes Updated 260w ago Asked to answer by Quora User and JR Ignacio

Upvote
Downvote
Comments 38+
281,520

More Answers Below.

Related Questions

  • Why did Plag** choose Python for its development?

  • What Python IDEs are Quora developers using?

  • Why did Adam D'Angelo choose Python Django as Quora's server side although he used PHP at Facebook?

  • If you are developing a new startup, should you choose PHP or Python and why?

  • Why did Dropbox choose Python?

[英] Quora 为什么选择 Python 作为他们的开发语言?

Charlie Cheever , One of the founders of Quora

Upvoted by Adam D'Angelo , Quora Founder

A few things to add to Adam's answer:

  • There were a bunch of pretty good frameworks for Python available with good debuggers and reloaders.  (Django, Pylons, and others)  Most of these are well supported and also keep getting better.  Since the main thing we were building to start was a website, this was appealing
  • Python data structures map well to JavaScript data structures so marshaling data between the browser and the server is straightforward and easy.  This is really nice since Quora involves a lot of interactions between the client and server that aren't page loads.
  • Python code tends to be very readable and since we wanted to be able to work on the site with a bunch of people, this was important.
  • There are lots of other libraries that are written in Python so its easy to incorporate things like custom mail servers, task queues, etc. into the rest of our codebase.

Ruby is the other choice that I think would have been reasonable since it has many of the same advantages that Python has but Adam and I both knew Python better than we knew Ruby.

1,932 upvotes Written 260w ago Asked to answer by Adi Raman and JR Ignacio

Upvote
Downvote
Comments 8+
97,376

[英] Quora 为什么选择 Python 作为他们的开发语言? Baishampayan Ghose , Prog Lang Nerd

Because Adam D'Angelo loves programming in Python? Facebook was initially written in PHP because Mark liked programming in PHP; today Facebook uses many other languages apart from PHP, like C++, Java, Erlang. Quora too, uses C++ apart from Python.

This whole argument that Quora should have been written in PHP just because Adam used to work at Facebook is moot.

2 upvotes Written 238w ago

Upvote
Downvote
Comments 1
2,894
[英] Quora 为什么选择 Python 作为他们的开发语言?

Yilun Zhang , Active Python User

Yilun has 20+ answers in Python (programming language) .

Pros in my opinion:

  1. It's free
  2. It is extensible in C/C++, which you can run large-scale data mining faster
  3. It is clean (unlike languages like C++ with tons of brackets for every loop or function) [very subjective opinion]
  4. Extremely convenient and powerful in data mining/analysis
  5. Also has web development framework like Django

Cons in my opinion:

  1. It's slow (but you can always call your code in C/C++)
  2. Lack of static typing.
  3. ... (I will think about more cons)

41 upvotes Written 32w ago

Upvote
Downvote
Comment
9,864

[英] Quora 为什么选择 Python 作为他们的开发语言? Doug Bell , Software architect, Java Guru, lead developer of "Dungeon Master".

You answered your question in your comments: "Since Adam D'Angelo , the founder, had worked for Facebook, which heavily uses PHP."

Using PHP for an extended period of time is probably the strongest argument there is to use something--anything--else .

9 upvotes Written 3w ago

Upvote
Downvote
Comments 2+
3,117
正文到此结束
Loading...