A Java GUI for a C++ application - Is this a good design?

5.2k views Asked by At

Yes, I was a little surprised when an interviewer mentioned that they use a Java-swing GUI for a C/C++ application. I was curious and asked him how they actually integrate these together, his answer was "through messaging". Interesting! Well, I am new to this kind of approach and am curious if companies out there really use this kind of design. If yes, then is there a big advantage to this design? It's a bit difficult for me to comprehend how this design would work well, if you have any references please share.

FYI, the product is a data-backup based application (on a Linux/Unix platform possibly). Thank you.

CV

4

There are 4 answers

2
ObscureRobot On

It is hard to tell if this is a good design without more information about the application's requirements.

Another thing to consider is that sometimes interviewers will suggest strange designs to see how candidates react. I'll typically do this when I'm hiring for a role that isn't a personal competency of mine, but where I've had experience (usually f'ing things up). My goal is to see if the candidate is any better at solving the problem than me! Bad candidates will slavishly accept my poor solution. Better candidates will immediately suggest a better solution. Best candidates will compare and contrast my weak solution with their better solution and explore when each option makes sense.

I would guess that the Java front end was selected for portability reasons. I would argue for a browser-based interface to accomplish those same goals, but maybe their UI/UX people really loved Java.

1
SingleShot On

I see nothing wrong with it. It is very common to integrate different components through messaging. I do think its generally better to have a homogeneous environment (for example, all applications written in Java rather than Java and C++), however its often the case where you must integrate with legacy or 3rd-party components written in other languages, either for cost reasons or because there is no other choice.

Messaging is a common way to do this. I consider HTTP under the umbrella of "messaging", and nearly every language has an HTTP library - which makes it a good choice as a common messaging "language". When integrating a very heterogenous system there are dedicated tools/frameworks for not only integrating components, but also for integrating messaging systems (e.g. ESBs).

0
r0ast3d On

There could be constraints as to why they have to call the C++ functions in the first place and then on top of that they could have had distributed client requirements. How would you develop a solution, so you build a messaging system and that interfaces with the C++ on the server side. It is a working solution at the end of the day. I would not expect that the ui has to be built in C++ because the server side is written in C++, at times you need to assemble different technologies together to achieve your solution.

0
Radim Cernej On

It is a workable / OK approach, I saw it used at a very large (Fortune 20 if there is such thing) company when I worked there as a contractor 2005-2006.

When I asked why, I was told:

  1. Need Linux GUI, java/SWING is a respectable choice. I also think that they had some Java developers who needed work.
  2. They had large, performance critical code base in C++/C.
  3. They already used messaging extensively and had libraries for that.
  4. The messaging interface, while more expensive to develop, allows the team write test programs (like replace the production GUI with a python script).

That all said, Qt and GTK/Gtkmm are very good GUI frameworks, why not to use those?