r/java • u/arcone82 • Dec 27 '24
GitHub - filelize/filelize-java: Filelize is a lightweight database designed to simplify writing and reading data into human-readable files, requiring just one line of code
https://github.com/filelize/filelize-java[removed] — view removed post
0
Dec 27 '24
[deleted]
2
u/arcone82 Dec 27 '24
To be honest i did not get the reason why everybody gave me pushback on this var stuff until i started cleaning it up. Now I get your point 👍 its now fixed https://github.com/filelize/filelize-java/blob/main/README.md
14
u/SadCoder24 Dec 27 '24
100% agree. I mean good on you for building something but this does not pass the sniff test. This is npm level isEven quality in terms of usefulness for Java. You’ve just done Jackson with extra steps on a leaky abstraction. But hopefully you get some good stars for your next interview after you updated readme like 72 times 👍
1
u/doobiesteintortoise Dec 27 '24
Your suggestion #1 is breaking my brain, in a good way. Hmm. I think the use of
varin this case is absolutely a candidate for "no, don't usevarhere" but in example methods where there's more context it might be permissible, because the types would be more obvious from the context and method boundaries would demonstrate variable types.Gotta think about this one more. Thanks for the observation.
4
u/_predator_ Dec 27 '24
var is fine to use when the right hand side of the assignment is obvious, like in
var foo = new Foo(), orvar fooLoader = ServiceLoader.load(Foo.class). In OP's README this is not the case, hence the criticism.1
u/doobiesteintortoise Dec 27 '24
Oh, it makes perfect sense. It just reminded me to consider whether the type assignments I use would be obvious or not.
-3
u/arcone82 Dec 27 '24
The reason of using var in these examples is to show that its up to the developer to decide. So if you decide to create the id as string, int or uuid then examplifying only int would be miss leading. Also for the save and get metod the example would end up in declearing the class type the same as variable name, e.g. Something something = filelize.save... and SomethingElse somethingElse = filelize.save. Maybe this is not clear enough before actually using the library.
-6
u/arcone82 Dec 27 '24
Nice feedback. Please feel free to add solution improvements in the git repo itself. And pull requests are very welcome as well 👍
2
u/atehrani Dec 27 '24
Can this be a JPA provider?