Hacker News new | ask | show | jobs
by beothorn 5049 days ago
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.
1 comments

If you enjoy that kind of programming, sure, go for it. It certainly is possible to program a crawler in Java. Personally I can't go back since I experienced more succinct languages.

Also beware of pseudo work: I suspect Java is partly popular because it makes you feel productive. You are constantly busy creating Tiny Types (as you call them), generating code in Eclipse (cool: one click and you have 50 lines of code in your class) and so on. It is all just pseudo work that accomplishes nothing, but maybe feeling productive is worth it.