Live data from Hacker News

Show HN: Effective java – A tool to explore your Java code written in Clojure

github.com

11–20 of 22 posts

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#11
post #2

Looks like a nice side project. But the first question that popped into my mind was, doesn't SonarQube already covers these rules?

Yes and no. If you consider this as a linter there are many others out there. Most of them in my opinion generate too much noise. I think that effectivejava is useful to explore your codebase, run a few queries and find out some facts about your code: how many utils classes do you have? How many methods are taking more than 5 parameters? You can run easily the queries on the whole project or just some packages and correct your aim as you find facts (for example, you may start asking how many methods take more than 5 parameters and realize they are 1000, then you want probably to start focusing on the methods taking more than 10 parameters. Or you can find that some classes with this problem are generated code and you do not want to consider them).

About the usage as a linter it tries to keep rules to a minimum of sensible rules, the ones explained in Effective Java. We chose them because they are rules well understood and accepted by the vast majority of developers so we hope to reduce the number of questionable findings returned to the user.

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#12

I like the aesthetic of using Clojure to fix Java.

Like many, I have fun using Clojure but during the day I have to pay bills by using Java :D

Jokes aside I think that Clojure is fantastic to manipulate data quickly. By the way this project is built on top of Javaparser (https://github.com/javaparser/javaparser) and that is written in Java.

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#13
Just tried running it and got this, I'm guessing I'm doing something wrong...?

[me@localhost myapp]$ java -jar effectivejava-0.1.2-SNAPSHOT-standalone.jar -l -d "/home/me/myapp"

Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method)

...

at app.core.(Unknown Source)

Caused by: java.lang.NullPointerException

...

Could not find the main class: app.core. Program will exit.

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#14
post #2

Looks like a nice side project. But the first question that popped into my mind was, doesn't SonarQube already covers these rules?

Yes and no. If you consider this as a linter there are many others out there. Most of them in my opinion generate too much noise. I think that effectivejava is useful to explore your codebase, run a few queries and find out some facts about your code: how many utils classes do you have? How many methods are taking more than 5 parameters? You can run easily the queries on the whole project or just some packages and co…

This is pretty cool. Are you planning on extending the querying ability at all? I would love to be able to use this like Hoogle, point it at my scala code and query for all methods that take a list and return an int, for example.

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#15
post #13

Just tried running it and got this, I'm guessing I'm doing something wrong...? [me@localhost myapp]$ java -jar effectivejava-0.1.2-SNAPSHOT-standalone.jar -l -d "/home/me/myapp" Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) ... at app.core. (Unknown Source) Caused by: java.lang.NullPointerException ... Could not find the main class: app.core. Program will…

never saw this error but current version is 0.1.3-SNAPSHOT.

The instructions are probably confusing, I will fix them. You can run: lein jar java -jar target/effectivejava-0.1.3-SNAPSHOT.jar and then the options.

Thank you for reporting this!

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#16
post #13

Just tried running it and got this, I'm guessing I'm doing something wrong...? [me@localhost myapp]$ java -jar effectivejava-0.1.2-SNAPSHOT-standalone.jar -l -d "/home/me/myapp" Exception in thread "main" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) ... at app.core. (Unknown Source) Caused by: java.lang.NullPointerException ... Could not find the main class: app.core. Program will…

never saw this error but current version is 0.1.3-SNAPSHOT. The instructions are probably confusing, I will fix them. You can run: lein jar java -jar target/effectivejava-0.1.3-SNAPSHOT.jar and then the options. Thank you for reporting this!

quick google shows someone else had the same error:

https://www.reddit.com/r/Clojure/comments/31uqab/writing_a_t...

Thank you for this though, hopefully I'll get it working...

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#17
post #7

Earlier quoted context omitted.

I just recently saw a story about using a pseudo-static compiler to improve the Clojure startup time. Maybe it's about to get better?

Were you perhaps talking about this article [0]? If not, it's a good read about the state of Project Skummet and improving Clojure load times on Android. [0]: http://blog.ndk.io/2015/04/23/state-of-coa.html

Yes, that's the one. I came away thinking that I'm still not too interested in developing for Android, but that any tool to reduce Clojure/JVM startup times is promising.

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#18

Earlier quoted context omitted.

Yes and no. If you consider this as a linter there are many others out there. Most of them in my opinion generate too much noise. I think that effectivejava is useful to explore your codebase, run a few queries and find out some facts about your code: how many utils classes do you have? How many methods are taking more than 5 parameters? You can run easily the queries on the whole project or just some packages and co…

This is pretty cool. Are you planning on extending the querying ability at all? I would love to be able to use this like Hoogle, point it at my scala code and query for all methods that take a list and return an int, for example.

Well, I am very interested in parsing and static analysis and if you idea and suggestions feel free to open as many tickets as you want on the project.

Yes, Hoogle is super cool, it would be definitely useful to have something like that.

I wrote in the past tools to manipulate ASTs of several languages but I have never looked in a Scala parser. Can you suggest one?

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#19
post #6
post #4

Earlier quoted context omitted.

Small standalone command-line tools are a good place for a language like that, although it's a shame Clojure takes so long to start.

The nice thing about Clojure development is that you really only need to start the JVM once, after that, you can eval anything you need instantly. And really, startup times aren't that bad. Here's Travis CI for a small project I made. Time to start the JVM and run tests? 2.76 seconds. The entire build completes in ~12 seconds. https://travis-ci.org/film42/rinok#L99

How is three seconds to run tests on a "small project" "not that bad"?

Re: Show HN: Effective java – A tool to explore your Java code written in Clojure

#20
post #19
post #6

Earlier quoted context omitted.

The nice thing about Clojure development is that you really only need to start the JVM once, after that, you can eval anything you need instantly. And really, startup times aren't that bad. Here's Travis CI for a small project I made. Time to start the JVM and run tests? 2.76 seconds. The entire build completes in ~12 seconds. https://travis-ci.org/film42/rinok#L99

How is three seconds to run tests on a "small project" "not that bad"?

well, it is not that bad because as part of the tests it also parse all the code of Javaparser and spring-jdbc (by no means small projects). Parsing it is an expensive operation also because the Java grammar is quite ambiguous
Post reply on HN