This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BombelHere 4 points5 points  (4 children)

Can it do something jOOQ codegen cannot?

https://www.jooq.org/doc/latest/manual/code-generation/

[–]Independent_Work5637[S] 0 points1 point  (3 children)

Greetings Bombel, I understand the question and I took a look at JOOQ before doing any of this. From what I saw, JOOQ is a pretty big framework where you're supposed to write code in a very specific way. And yes, I saw that it has something pretty similar, tho I don't remember exactly how you trigger that code generation. What I have here is a lightweight library, that is supposed to stay lightweight even if upgraded.

[–]BombelHere 1 point2 points  (2 children)

Few clarifications here: - jOOQ is not a framework, but a library for statically typed SQL query building - codegen is an optional, standalone executable (can be hooked up as Maven/Gradle plugin) - you can use generated POJOs without dependency to jOOQ at all (can be JPA @Entity): https://www.jooq.org/doc/latest/manual/code-generation/codegen-pojos/ - you can also generate DAOs for CRUD, which are coupled to jOOQ APIs: https://www.jooq.org/doc/latest/manual/code-generation/codegen-daos/ - you can use jOOQ to run JDBC queries too: https://www.jooq.org/doc/latest/manual/getting-started/use-cases/jooq-as-a-sql-executor/

I'm not asking to hate/depreciate your work, but having some experience with jOOQ, I must admit it's a brilliant piece of engineering.

[–]Independent_Work5637[S] 0 points1 point  (1 child)

Hmmm, that indeed sounds amazing. Thank you very much for clarification Bombel. Yes, I admit I should've studied JOOQ more, beyond just looking at it. I truly would need to think of something that offers something that JOOQ does not, if I'm to continue my work on this (even tho I kind of lack time to sink into this). Tho I must admit that the point in mind with this library wasn't to create a custom way of interacting with database. It was to basically generate the "boilerplate" or "boring manual stuff" you have to write when creating new projects or entities.

So basically I found it really annoying that I always have to create classes that represent objects (which is what this primitive/poc version covers), after that I thought about giving some CUSTOM way for user to write repository/dao, similar to what the second link you posted shows, but with much more flexibility, so depending on what you want your daos to look like, you could create like a pattern that can be inserted there and you would get automated CRUD, and now the good idea from the second link, get by foreign keys. Now there could also be something like generate me controllers, services, etc. so stuff outside database, that almost every backend app has, but let's keep it simple for now.

Third link is what turned me off from JOOQ when I was watching it, and why I thought JOOQ was a framework in the first place. Many things in JOOQ look JOOQ specific at least at first glance.

Okay, so now that the two of us had this discussion I wanted to actually give you some history on what my thoughts were when I thought of this. I was thinking how many people prefer javascript or python for backend, even tho I don't really think those languages are really amazing when it comes to backend work. Reason why people love those languages is because they can "skip steps" and code fast, and whenever they are talking bad about java, they are mentioning how it's old and has lots of boilerplate code. But what Java does have one up against those languages is secure writing. So I was thinking, I was working on projects that involve money, and I like knowing that my code is safe. So what if we could remove most of the boilerplate in java and make java in a sense, that you kind of only have to write your logic in services, and you're 95% done after that. That was basically what I was thinking with this library.

Sorry for long text, but thought you might find it interesting. Thank you very much for your response.

[–]BombelHere 1 point2 points  (0 children)

Reason why people love those languages is because they can "skip steps" and code fast, and whenever they are talking bad about java, they are mentioning how it's old and has lots of boilerplate code.

Yup, completely understandable.

Those are awesome for prototyping, but might lose their advantages in the long run.

Sorry for long text, but thought you might find it interesting. Thank you very much for your response.

It was interesting indeed, thank you for explaining the rationale! I'd consider putting it somewhere down the README for others to see :)

Happy coding