Live data from Hacker News

Ask HN: Why not Java?

news.ycombinator.com

71–80 of 112 posts

Re: Ask HN: Why not Java?

#71

Earlier quoted context omitted.

Abstract base classes. See http://www.doughellmann.com/PyMOTW/abc/

Absent static type checking and manifest typing, abstract base classes do much less than Java interfaces.

Ah yes, the age-old static typing vs duck typing argument.

Sure, in theory static typing can catch bugs. But doing it like Java does it is a lot of work per real bug actually caught.

Re: Ask HN: Why not Java?

#72
post #54

It's just that Java is very verbose, and actually I found it particularly horrible for data driven applications (by this I mean apps whose behavior is determined by data/config files, not "Big Data" - I have no experience with the latter). For complex data types you always need to create complex class hierarchies. In other languages you could just write webInfo = {url: "bla.bla", title: "bla die blub", links: ["link1…

link can be a single String? I can see here new "info = new WebInfo(title, url, new String[]{link1, link2,...});" that it can't. This is the kind of thing you get with a typed object. Also, instead of Strings for title, url, etc you could use tiny types. Yes, it is a lot more verbose, but it comes with a advantage (compile time erros over runtime erors). TinyType also documents what you should pass for the constructor. If you need some preparation to get a url (I don't know, like, finding it on some txt), typing would lead you to do it.

Re: Ask HN: Why not Java?

#73
post #71

Earlier quoted context omitted.

Absent static type checking and manifest typing, abstract base classes do much less than Java interfaces.

Ah yes, the age-old static typing vs duck typing argument. Sure, in theory static typing can catch bugs. But doing it like Java does it is a lot of work per real bug actually caught.

Whether or not that's true, it is a concrete difference between Python and Java. Python is not a superset of Java.

Re: Ask HN: Why not Java?

#75
You always can use JS/Python/whatever in your java application as a scripting language.

In such case like web crawler, the main issue with Java is the scalability or rather lack of it. You need to code it yourself, but that's not any different than other languages and platforms.

Re: Ask HN: Why not Java?

#76
post #27

The best reason to use Java is the enormous ecosystem of libraries and resources. The best reason to AVOID using Java is the huge demand for Java programmers and the low supply. At my job we can barely find applicants with Java so we end up hiring .NET people and converting them.

Just curious, where do you live?

Re: Ask HN: Why not Java?

#77
post #49

Earlier quoted context omitted.

I think collectively we should point out the specific Spring modules as opposed to say that "Spring is overbloat and buggy". Some of Spring modules seem to be quite stable enough. Others, the newer modules, will take time to be more mature. Spring's goal have always been to be the 'glue layer' of the Java standards. Of course, now they want to be the 'glue layer' of everything, including Spring-Data for NoSQL (Neo4J…

I pointed one module out - Spring-Velocity integration. "Of course, now they want to be the 'glue layer' of everything, including Spring-Data for NoSQL (Neo4J and co.)." Why do you need this? It's just Java and you can... just use it. Without glue. "Speaking of which, your last statement is partly correct if only Spring == Spring Core. There's no MVC (in the sense of ASP.NET MVC or Rails MVC) in JEE yet (yet because…

You pointed one module, as an example that describes the whole Spring as one unified framework.

Spring consists of multiple modules that you absolutely _don't_ have to use. This is where, I think, you misunderstood Spring.

When it comes to the modules, i.e.: Spring Core, Spring Transaction, Spring-Data sub-modules, Spring eventually use the JDK and/or 3rd-party API (possibility, in the case of Neo4J etc). Yes, you can use JDBC, JTA, JPA, and Neo4J API directly. For sure. But Spring has always wanted to become an alternative to using them directly by providing more features and supposedly better programming experience.

This is what I meant by _glue_. You're absolutely correct: you can use those libraries directly without Spring. But if Spring modules provide me with better programming model, more features on top of barebone implementations, why would I not use Spring modules? This, again, something that you seem don't quite see from Spring.

Let's say MVC is a buzzword and start from there. If you look at ASP.NET MVC and Rails MVC, they provide a programming model where you have a request mapper/route that maps a request to a method in your controller.

MVC Model 2 architecture does not provide you with that. MVC Model 2 architecture provides you 1:1 mapping between a URL with Servlet. Which means if you do a simple CRUD a'la Resource, you can either have 1 Servlet per Resource that acts as a dispatcher for the CRUD operation via either query parameters or multiple Servlets. Again, if you choose to live with that, that's your choice.

Spring offers a better programming model than MVC Model 2 architecture and there are people out there that prefer it. Spring also offers WebFlow, a module on top of Spring-MVC that helps building Wizard or Shopping Chart that involves lifecycle/steps. Can you live without it? For sure. Roll your own.

That's one, second, in Rails MVC, you can set the content negotiation to send back either JSON, XML, or HTML. You can do this with JAX-RS but that is a separate "servlet" per-se. If you want your API to live in a different part of your systems, this is acceptable. But if you want all of the request comes from one entry-point, you have to work harder than that.

Calling Spring as a 'Bug Layer' reminds me of this article:

http://www.codinghorror.com/blog/2008/03/the-first-rule-of-p...

Re: Ask HN: Why not Java?

#78
post #71

Earlier quoted context omitted.

Ah yes, the age-old static typing vs duck typing argument. Sure, in theory static typing can catch bugs. But doing it like Java does it is a lot of work per real bug actually caught.

Whether or not that's true, it is a concrete difference between Python and Java. Python is not a superset of Java.

I never claimed that the two were the same language. My claim was that you can take anything written in Java and pretty much directly translate it to Python.

The fact that there are things Java will flag as errors that a Python translation does not, does not change this fact.

Re: Ask HN: Why not Java?

#79
post #78

Earlier quoted context omitted.

Whether or not that's true, it is a concrete difference between Python and Java. Python is not a superset of Java.

I never claimed that the two were the same language. My claim was that you can take anything written in Java and pretty much directly translate it to Python. The fact that there are things Java will flag as errors that a Python translation does not, does not change this fact.

As I said, you seem to be claiming that Python is a superset of Java, not equivalent to it, and that claim is manifestly false. Errors that are detected in one place and not in another are a manifest difference.

Also, Java threads and anonymous classes do not translate directly to Python.

Re: Ask HN: Why not Java?

#80
Java is suited and even powers some powerful crawlers like Heritrix (archive.org) and Nutch (Apache foundation).

That being said, it doesn't really matter what language you write your crawler in: its performance will much sooner be influenced by other aspects (network latency, storage, etc) than the language you choose.

So pick the language you're most comfortable with for crawling and offload the data processing to a lower level language that is better sooted for that task.

Post reply on HN