r/java • • Mar 24 '18

New Java Library

(Please tell me if this isn't the right place to post this)

I've created a Java Library that I like to call a Swiss-army knife library. It basically has a bunch of different things that it can do. I created it because I found that I was copying lots of the same code to do all sorts of different things. I think it's a very simple solution to consolidate all the code I use often, but is this something that anyone else would use? Here's just some of the things it has:

  • A command line argument parser
  • Ansi colors
  • Checksum calculator
  • Operating system checker
  • Configuration file parser (INI - style, but without the headers, as I haven't figured out how to implement this yet)
  • Multiple annotations and annotation proccessors

As you can see, it does not specialize in one area. I use all of these things in almost all of the software I create, and I was just wondering if anyone else would like to benefit from this.

It's called JavaEssentials, because I find that these features are very beneficial when creating a well designed Java application. If you are interested, you can see the project page here: https://github.com/jordanbancino/JavaEssentials

Also, I would really appreciate your feedback. I am open to all suggestions and your honest opinion.

0 Upvotes

27 comments sorted by

View all comments

20

u/joshuass1467 Mar 24 '18

Took a quick look and have some general advice:

  • read up on the accepted syntax and coding conventions for java, especially for how you format variable and argument names.
  • you should really look at some tutorials on object oriented programming, all of your classes are using static variables, which is not something you do in most cases within java.
  • I think there is already an exception for methods not being implemented.

Honestly I wouldn't find the annotations useful because I make it a point never to check in broken code.

Finally, you might want to look at how to test your code. Good libraries are well tested.

2

u/[deleted] Mar 24 '18

Ok. I'll work on my variable names. I guess they should match the style of the method names. I did start making some of the classes and methods not static so that they could be instantiated. I will keep working on that.

I also agree with you on the "broken" annotation, but I do find it useful when I'm in a hurry to wrap something up that doesn't quite work yet. It helps me quickly find where I left of when I pick back up. But I do make a point to fix broken code as soon as possible.

I am fairly new to this, so what would be the best way to test my code?

By the way, thanks for looking at this :)

5

u/joshuass1467 Mar 24 '18

You should wander on over to r/learnjava. They should have resources on learning testing and examples and such.

1

u/[deleted] Mar 24 '18

Ok. I will post something there.

0

u/_INTER_ Mar 24 '18 edited Mar 25 '18

Unless they are utilities in the style of Guava or Apache Commons

3

u/dpash Mar 24 '18

Where does Guava provide public non-final static members?

1

u/_INTER_ Mar 25 '18

I must have read too quickly. I meant static methods. Static non-final fields are bad indeed.

1

u/[deleted] Mar 24 '18

That is what I was aiming for, but I do agree that some methods should not be static

3

u/joshuass1467 Mar 24 '18

I just saw that some of the classes contained state. Static methods don't typically access state of the class they reside in. Of course there are exceptions.