Can Java Web Frameworks Work with Ruby? (And How?) - A Newbie’s Guide!
Hey everyone,
I’m pretty new to Ruby, but I’m really excited about it, especially with frameworks like Ruby on Rails that make building web stuff so much easier. I’m starting a new project and trying to figure out the best way to build it.
I’ve also heard a lot about Java and how powerful it is, especially for big, complex applications and for things that need to be super fast. Java also has a ton of existing tools and libraries.
My big question is: Can I use Java web frameworks (like Spring or Hibernate) together with my Ruby applications? I’m not looking to rewrite everything in Java, but rather see if I can get the best of both worlds.
Specifically, I’m wondering:
- Can my Ruby application “talk” directly to a Java web framework? Like, can they share information or use each other’s features easily?
- What are the common ways people make Ruby and Java work together in web projects? Are there special tools or approaches I should know about? (I’ve heard mentions of things like JRuby or microservices, but I’m not sure what those mean in this context.)
- What are the good things and bad things about mixing Ruby and Java? What kind of benefits might I get (like better performance for certain parts, or using cool Java tools)? And what challenges might I run into (like things getting complicated, or deployment headaches)?
- Has anyone actually done this successfully for a web application? Are there any examples out there I could look at?
I’m trying to figure out if this is a smart idea for a new project, or if it’s just going to be too much for someone new to Ruby. Any advice, stories, or tips would be super helpful!
Thanks a bunch!
(topic moved to main Developers category- thanx Nab)
This is most likely in the wrong category, and may not really even pertain to SketchUp coding.
Please (at the least) reassign to the parent developers category unless you can show this relates to using the SketchUp Ruby API.
If this question just about web app programming in general, perhaps one of the StackOverflow sites would get you more responses from experienced coders. (Ie, SketchUp extension developers mostly use JavaScript not Java for Html dialog interfaces. But you can use whatever frameworks you desire on your server-side.)
It’s not exactly the same, but we have done something along those lines with Sefaira and Add location.
You can use an HtmlDialog in your Ruby extension that opens up a web application, and then the back-end of the web application is written in e.g. Java Spring boot. You have to have a way that the Ruby extension can send the model data to your Java back-end, and get the results back to do something useful with them, so you’ll need a bunch of Ruby code to handle that back-and-forth for you.
microservices is an architectural concern for your back-end. We have used both microservices and monoliths successfully, microservices have a bunch of interesting advantages but come with their own pain. To start with you probably don’t want to focus on that too much.
One big advantage of this approach is that you can easily update your web application without needing users to update the extension, if you have coded al the interactions that you might need in the Ruby extension. This is what we do with Add Location (and Sefaira), and is why we make so few extension updates but we can keep adding new features / fixing issues.
Other good things about moving away from Ruby:
- The back-end can do considerable calculation on cloud computing servers meaning that your application is less constrained by user’s PCs. Of course there is a $ cost to that.
- Java is compiled so faster than Ruby
- Static type checking in Java, which can avoid some run time errors
- Strong existing libraries for all sorts of things on Java, including 2D and 3D geometry. Ruby also has library support, but maybe less general as a lot of its popularity is with rails, but I don’t know the Ruby library ecosystem well so this may just be an assumption
Bad things: mainly that now you have to convert the SketchUp data into something you can deal with on the Java side. Also you still have some Ruby code, so keeping on top of multiple languages and their differing deployment methodologies can be painful, especially when the SketchUp API changes.
If you can make it to DevCamp 2025 (in UK this October), we’ll be there and can talk a bit more about these kind of concepts and also future directions.
Dan
2 Likes
Thank You for the Reply!
Hey everyone,
Just wanted to give a huge thank you to everyone who replied to my post about Java and Ruby!
Your insights, have been incredibly helpful for someone new to Ruby like me. It’s really clarified a lot of my questions about how these two languages can work together.
I’m starting to get a much clearer picture of the possibilities and the best approaches. Thanks again for taking the time to share your knowledge!
1 Like
A lot of links to helpful Ruby info …