DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Does Java Make You Less Productive Than Dynamic Languages?

Does Java Make You Less Productive Than Dynamic Languages?

Axel Rauschmayer user avatar by
Axel Rauschmayer
·
Oct. 10, 10 · Java Zone · Interview
Like (0)
Save
Tweet
12.35K Views

Join the DZone community and get the full member experience.

Join For Free

I still hear from many people that dynamic languages make them more productive, but my experience is exactly the opposite: I used to prefer Python to Java. But then along came Eclipse with its refactoring and code browsing and afterwards, I could not go back to simpler editors. Many of the advanced Eclipse features are possible precisely because Java is not dynamic. But in many ways, Python feels more polished than Java. The irony is that this has nothing to do with Python being dynamic. All of the following things could be easily added to Java.

Standard library.
The good news is that Java has libraries for almost anything you can imagine. The bad news is that dynamic languages tend to come with much more useful stuff built in:

  • URL-decoding
  • JSON encoding/decoding
  • UU-encoding
  • Joining strings
  • Command line argument parsing
  • CSV file parsing
  • Complete HTTP client implementation (multipart POST, cookies, ...)
  • Iterators: for loops over iterators, combinations (filter, append, etc.), conversion to collections
Literals:
  • Collection literals: Java 8 will have collection literals, so we will have to wait a while. In the meantime, Arrays.asList() is good enough for lists and a chainable put() (return type = Map) would be good enough for maps.
  • Triple-quoted strings: If a string is triple-quoted in Python, it can contain multiple lines of text and single quotes.
  • Raw strings: In Python, prefixing a string quote with an 'r' means it is raw and slashes are interpreted as is, and not used for escaping. This is very useful for text that contains backslashes (regular expressions, LaTeX).
Slicing and dicing complex data structures:
  • List comprehension: great in Python, easily added to Java, once it has closures.
  • Accessing the n-th last element (arrays, strings, lists, ...): In Python, the index -n can be used for this purpose. In Java, you have to resort to mylist.get(mylist.size()-n).
Miscellaneous:
  • str() and ref(): Python has two kinds of toString() methods. str() returns a human readable representation, while ref() returns something that can be parsed (i.e. this method serializes to Python source code).
  • Keyword arguments, optional arguments: useful, but might be too cumbersome to add to Java.
Exploring code: Having an interactive command line in Python helps. Eclipse has sheets, but I’ve always found them a bit awkward to use. I am thinking more along the lines of BeanShell, but it does not seem to be updated, any more. I would also love Eclipse to become even better at code browsing (ideas, more ideas).

Most of the other Java warts, I can live with. That Java will have closures sometimes in the future is great, because currently it is difficult to encapsulate a way of iteration, where the operation that is applied to each element can be configured.

From http://2ality.blogspot.com/2010/10/does-java-make-you-less-productive-than.html

Java (programming language)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Modernize Legacy Code in Production: Rebuild Your Airplane Midflight Without Crashing
  • Java: Why Core-to-Core Latency Matters
  • Deployment of Low-Latency Solutions in the Cloud
  • Open Source Security Risks

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo