Background : I'm a professional Java developer that does Django on the side.
Java
Java is used mainly in the enterprise, and there are very good reasons for it. Java is a good solution if you need a language that is mature, has good support for concurrency, transactions, access to multiple databases ... Java is also a very stable platform. And by stable, I dont mean that it has fewer bugs than Python or Ruby, I mean that it doesnt change as much.
There is wonderful tool support for Java. Great IDE, great refactoring tools, great static analysis tools ... You probably wont find as many tools of that quality for any other language.
There are a lot of slow Java applications, but in my opinion it comes more from developers using an architecture that they dont understand, trying to do things more complicated than they need to. You can develop high performance, very fast websites with Java.
Django
Django is more light weight, more fun to work with. You can have an application running in a very short time. The admin interface is magical for simple CRUD operation and can be used for even pretty complex logic. You can find a lot of "reuseable apps" that will implements some of the functionalities that you need.
Even if Django is now in version 1.0, it is far from stable. If you need to be still developing your project in 1-2 years, you can expect a lot of changes just to follow the state of Django.
Conclusion
Use Java if you already know it and if you have needs for complex architecture and long term support.
Use Django (or RoR) if you want rapid development and dont care if you need to rewrite a lot of the app in 1-2 years.
Answer from Guillaume on Stack OverflowJava or Python or Ruby for Web Application? - Stack Overflow
What does Ruby have that Python doesn't, and vice versa? - Stack Overflow
Elixir vs Ruby vs Python vs Javascript | Which path to choose?
Ruby vs. Python comes down to the for loop
Your python example is unnecessarily complicated. You can achieve the exact same thing just as simple as you would in your Ruby example. Perhaps you are not aware of the existence of "yield" in python?
class Stuff:
def __init__(self):
self.a_list = [1, 2, 3, 4]
def __iter__(self):
for val in self.a_list:
yield val More on reddit.com Is Ruby better than Python?
Which is more popular, Ruby or Python?
Which is easier, Ruby or Python?
Videos
Background : I'm a professional Java developer that does Django on the side.
Java
Java is used mainly in the enterprise, and there are very good reasons for it. Java is a good solution if you need a language that is mature, has good support for concurrency, transactions, access to multiple databases ... Java is also a very stable platform. And by stable, I dont mean that it has fewer bugs than Python or Ruby, I mean that it doesnt change as much.
There is wonderful tool support for Java. Great IDE, great refactoring tools, great static analysis tools ... You probably wont find as many tools of that quality for any other language.
There are a lot of slow Java applications, but in my opinion it comes more from developers using an architecture that they dont understand, trying to do things more complicated than they need to. You can develop high performance, very fast websites with Java.
Django
Django is more light weight, more fun to work with. You can have an application running in a very short time. The admin interface is magical for simple CRUD operation and can be used for even pretty complex logic. You can find a lot of "reuseable apps" that will implements some of the functionalities that you need.
Even if Django is now in version 1.0, it is far from stable. If you need to be still developing your project in 1-2 years, you can expect a lot of changes just to follow the state of Django.
Conclusion
Use Java if you already know it and if you have needs for complex architecture and long term support.
Use Django (or RoR) if you want rapid development and dont care if you need to rewrite a lot of the app in 1-2 years.
Pick which is familiar to you and run with it.
Or you can pick Django on Jython to get best of Java libraries and Python's speed-coding.
Or pick Java if you need to convince somebody that it is enterprise-y.
I would say if you're working alone / in a small team, then just pick the one that requires least resources (hint: Python).
Ruby has the concepts of blocks, which are essentially syntactic sugar around a section of code; they are a way to create closures and pass them to another method which may or may not use the block. A block can be invoked later on through a yield statement.
For example, a simple definition of an each method on Array might be something like:
class Array
def each
for i in self
yield(i) # If a block has been passed, control will be passed here.
end
end
end
Then you can invoke this like so:
# Add five to each element.
[1, 2, 3, 4].each{ |e| puts e + 5 }
> [6, 7, 8, 9]
Python has anonymous functions/closures/lambdas, but it doesn't quite have blocks since it's missing some of the useful syntactic sugar. However, there's at least one way to get it in an ad-hoc fashion. See, for example, here.
Python Example
Functions are first-class variables in Python. You can declare a function, pass it around as an object, and overwrite it:
def func(): print "hello"
def another_func(f): f()
another_func(func)
def func2(): print "goodbye"
func = func2
This is a fundamental feature of modern scripting languages. JavaScript and Lua do this, too. Ruby doesn't treat functions this way; naming a function calls it.
Of course, there are ways to do these things in Ruby, but they're not first-class operations. For example, you can wrap a function with Proc.new to treat it as a variable--but then it's no longer a function; it's an object with a "call" method.
Ruby's functions aren't first-class objects
Ruby functions aren't first-class objects. Functions must be wrapped in an object to pass them around; the resulting object can't be treated like a function. Functions can't be assigned in a first-class manner; instead, a function in its container object must be called to modify them.
def func; p "Hello" end
def another_func(f); method(f)[] end
another_func(:func) # => "Hello"
def func2; print "Goodbye!"
self.class.send(:define_method, :func, method(:func2))
func # => "Goodbye!"
method(:func).owner # => Object
func # => "Goodbye!"
self.func # => "Goodbye!"
I am completely sure I want to dive into the world of Programming (web dev) and ultimately get a job(in programming) to continue learning to program.
I have to choose a path: to get a Programming job and ultimately support myself.
Why should and shouldn't I choose the Elixir programming path to reach my goal?
I have dabbled into Elixir Programming a bit and I have already started to like it.
I have to choose a language and it's confusing. I like Elixir but I don't know where it will lead me, the other is JS, and Python which seem to have a lot of opportunities but I never got along well with both.
And then there is Ruby, which in terms of Job Opportunities seems similar to Elixir.
My Background: I am from a Commerce Background. Know basic Python, MYSQL, and created a few blog sites using WordPress and managed their backend by myself (cloud hosting), which gave me an understanding of configuring the NGINX webserve.