Just commenting ... :D
Just commenting ... :D
Likewise with Amazon. My understanding, from chatting with some Amazon engineers at a conference, is that they have a pretty heterogeneous portfolio, even including some Perl and Oracle PL/SQL.
Others who are better informed, please correct.
http://google-opensource.blogspot.ca/2009/01/opengse-release...
(I think Google Sites is also written in Java).
Amazon is pretty much a big Java shop (don't forget the companies they acquired as well). Check out their jobs site.
On top off edwinnathaniel's list, add Google Sites, Google Docs, and Mapreduce frameworks such as Flume Java.
Seibel: As a Java guy at Google, do you think it could be used more? Leaving aside the force of history and historical choices, if somehow you could wave a magic wand and replace all of C++ with Java, could that work?
Bloch: Up to a point. Large parts of the system could be written that way, and over time, things are moving in that direction. But for the absolute core of the system - the inner loops of the index servers, for instance - very small gains in performance are worth an awful lot. When you have that many machines running the same piece of code, if you can make it even a few percent faster, then you've done something that has real benefits, financially and enviromentally. So there is some code that you want to write in assembly language, and what is C but glorified assembly language?
Sure it is. But I won't use Java for web stuff. I might use it for some background services, but for regular CRUD functionality, Java buys me nothing. I generally use Python(Flask)/Jinja2/Flask-SqlAlchemy. Flask is intuitive; Jinja2 is pleasant and fast; Flask-SQLAlchemy is concise with the option of exploring the raw power of SQLAlchemy. For regular use cases, nothing in Java beats this combination. I have looked at Play; it comes closer but it's still not there.
Checkout this toy benchmark that was doing the rounds 2 months ago https://github.com/grahamking/Key-Value-Polyglot The naive python solution https://github.com/grahamking/Key-Value-Polyglot/blob/master... performs dog slow. Java has real threads, JIT; but guess what, the naive Java solution still is dog slow https://github.com/grahamking/Key-Value-Polyglot/blob/master...
My specialized python solutions are magnitudes of times faster than both naive Python and Java solutions:
https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m... https://github.com/rahulkmr/Key-Value-Polyglot/blob/master/m...
The naive solutions were taking around 20 seconds to do 500 writes followed by 500 reads. My changed solution does 5000 writes followed by 5000 reads in under 2 seconds. The 500 and 5000 aren't typos - the naive solutions was taking about 20 seconds for 1000 operations, whereas tailored solution was doing 10000 operations under 2 seconds.
This is the discussion thread http://news.ycombinator.com/item?id=3733090
I get it that this is an IO bound problem, and naturally an epoll based solution will totally smoke a thread-per-request solution, but that's the point I am trying to make. If at the end of the day, intuitive solutions don't work and I have to do custom implementations, I am not getting much out of using Java. I might use it for something which is CPU bound about 70% of the time, but anything other than that, the pains far outweigh benefits.
Better keep up with the latest frameworks and libraries.
I know Rails and Django and I used cherrypy, cheetah, and sqlalchemy as well, and Java is on par with both modern frameworks if you know to choose the right frameworks.
In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go.
... And you are asking me to check out a "toy benchmark"?
I care more for the overall solutions from deployment, tools, etc. End to end baby...
What are these frameworks in Java you talk about which are as expressive as Django and Rails? Less verbose that it was before isn't the same as as expressive as Rails/Django.
> In fact, I do not have to deploy multiple processes one for Rails and one for sinatra or node.js. Just some app server or web container and I am ready to go.
Rails/Django deployment isn't that hard. If you are talking about a large app, deployment is a very small consideration compared to other aspects.
As far as multiple processes go, more often than not, large apps are run as collection of co-operating services. That is by choice, irrespective of whether it's implemented in Java or Python. Which one of the examples you listed you think runs as some app server and container?
> ... And you are asking me to check out a "toy benchmark"? > I care more for the overall solutions from deployment, tools, etc. End to end baby...
All benchmarks are toys. If you want "end to end", the only way is to do it is to implement the same app in Python and Java, and then compare them. Doing that would be batshit insane(sure, we are going to do too versions of pinterest to compare whether we write it in Java or Python), nobody does that, nobody should do that.
As far as benchmark goes, I only claimed that out of box code in Java performs like dogshit, and I am to jump hoops, I would rather jump hoops in Python, Ruby, Clojure et al.
Spring MVC is on par with Rails VC (let's leave ActiveRecord for another time) or Django TV minus Django ORM.
Testing? Spring has a really good testing library that plays with both straight up Java EE components (Servlet, Portlet, etc). Functional, Integration, Unit-Test, name your game.
Migration? Flyway works nicely and I don't have to spend days to set it up, just less than an hour for multi-year project. Minuscule in terms of effort. It just works.
I'll give you that ActiveRecord is nicer than JPA 2 (but not by a lot). The rest are... indifferent, same stuff, same type, same ol' same ol'.
JAX-RS can spits both XML and JSON easily with no code changes. I don't have to use Sinatra (or node.js) for web-api and deploy it separately from Rails: just deploy JAX-RS project as a separate WAR to the AppServer and I'm done. Done.
I don't need to spin up a different process, write a script to do X,Y,Z, maintain another infrastructure, etc etc.
Regarding your mark about benchmark: then don't start flashing numbers and stuffs if they are toys. If OOB Java is like dog stuff then Python, Ruby are like snail or turtle.
Wait, what am I doing trolling like redditors or slashdotters over mindless debate.
sigh technology has never been the problem, the people are sigh always holds true.
For me, expressiveness is the sum of language expressiveness, framework, culture and api design.
For example, see this crime against humanity
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:choose>
<c:when test="${emails.unread != null && fn:size(emails.unread)}">
You have ${fn:size(emails.unread)} unread email(s)!
</c:when>
<c:otherwise>
You have no unread emails!
</c:otherwise>
</c:choose>
Now, the designers could have very well implemented: You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !
> I think you have a different mindset on that one but I'm not sure what you're trying to achieve.I am not trying to achieve anything, and it's not just a matter of mindset. See my example above. Expressiveness isn't just something which is confined to the language. Horrendous apis and frameworks are a bane for any language.
> Migration? Flyway works nicely and I don't have to spend days to set it up, just less than an hour for multi-year project.
I don't follow your remark that you don't have to spend days to set it up. Which migration lib takes days to set up? I am not contesting there isn't something bad out there(see my JSP example above), but since we are talking Rails/Django, I don't see how it is relevant here.
> JAX-RS can spits both XML and JSON easily with no code changes. I don't have to use Sinatra (or node.js) for web-api and deploy it separately from Rails:
Umm what? Rails needs Sinatra to produce JSON?
def foo
respond_to do |format|
format.html { }
format.json { }
format.xml { }
end
end
> Wait, what am I doing trolling like redditors or slashdotters over mindless debate.
> sigh technology has never been the problem, the people are sigh always holds true.I won't bother responding to this.
A typical setup is to use Rails for front-facing website and Sinatra for web-services (RESTful).
What I'm saying is that that can be done with Spring MVC + JAX-RS:
@Produces("application/xml")
@Produces("application/json")
// Want more? add your own? very flexible
// @Produces("application/atom")
// @Produces("text/plain")
// @Produces("application/something+xml") <-- custom
public Employee get(@Parameter("id") final int id){
// code no need to pepper with respond_to
}You said frameworks don't decide expressiveness. I was quoting an example that they do. Whether you use jsp or not is tangential. Java isn't anywhere near python or ruby in terms of expressiveness, neither are the frameworks.
EDIT: Like another commenter pointed out, if you can get a 55k LSoC Java project down to 8k Python project, that says something about expressiveness.
FYI, you can mount your sinatra app in your rails app and run them in the same process.
Nothing against Java, it's the best tool for the job on many occasions but launching quickly and scaling fast are not it's forté.
I find Java to be much more modular and adaptable to different web paradigm: old school MVC, one page JS style (GWT or pure JS), asynchronous (Netty or Servlet 3.0), scalable web api that can spit both xml and json without extra coding (JAX-RS), component oriented (JSF).
The integration between business logic and let say if you somehow need to use message queue are quite good via EJB 3.1 (very minimum coding) and JMS.
Java took a beating a few years ago, fast forward to 2012, they have improved quite significantly. In the next two years, multi tenant architecture will be available in JavaEE 7 out of the box.
Many people who keep complaining about Java typically are those who have wayy past experience.
Last year, we switched a 55k loc Spring MVC (with JAX-RS for the json api) over to Django (using tastypie for the api side and celery for offline tasks). The result ended up being little over 8k loc of Python. Closing a ticket has gone from taking on average around 5 days to a little over 4 hours. That was the third project we ported over, the others having had similar success. YMMV.
Why Django not Rails since Rails seem to be more popular?
I found it hard to believe that you can switch 55k LoC of Spring MVC + JAX-RS to Django with resulted of 8k. Because from what I've learned over the year, the amount of code requires to write Spring MVC + JAX-RS is very minimum and very close to Rails (my experience is more with Rails) at the very least from the Controller point of view. My personal like of the paradigm is to re-use the code between Spring MVC and JAX-RS. Love it so much.
That is of course if you discount everything else: imports, comments, parentheses, configurations. What about the actual logic?
We typically use JS heavy on the front end and less on JSF/JSP.
But you're right, YMMV. Projects have different requirements and skillset/experience. We typically don't have technical bugs but more of requirement bugs: someone forgot to handle the case of X,Y,Z and as such, it requires about a day or less to plug the issues.
I hadn't started when the decision to go Django instead of Rails was made (Rails & .NET MVC were also considered) but I've been told it came down to a number of things:
* This is in Europe, generally Ruby is not used very much over here, Python has been used in some shape or form in every company I've have experience of but I've only seen Ruby recently and then mostly for Chef or Puppet.
* Lack of explicit imports did not work in Ruby's favour.
* If needed numpy & scipy don't have a analogue in the Ruby ecosystem.
* General negativity towards the religious zeal permeating through the Rails community.
ASP.NET MVC won't have much gain over Spring MVC/JAX-RS. In fact, there's nothing similar to JAX-RS in ASP.NET MVC (you'd have to write your own stuff here and there and wire them together, not as straightforward as JAX-RS).
This is an excellent story to share both from technical perspective (Java+Frameworks => Django+Python+Pythonic mindset) and from recruiting perspective. I hope one day you could share (perhaps in slides/presentation style) the actual code and technique in details.
Mind if I ask you where in Europe? (Country/City?) For a while I thought Europe is Rails heavy.
While comparing loc, take into account the fact that there were no unknowns - you are simply porting functionality. You generally don't have to solve a problem when you are re-writing a Java codebase in Python, just pythonizing the existing java solution. I would wager if the same system was re-written in Java, it would shave some bloat(provided you are re-implementing and not adding features).
With that said, 55k to 8k is still very impressive.
I mean really we're all just moving 1's and 0's around.