Sign in to follow this  

combining Java and C++

This topic is 3574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im currently taking a course called "Project IT".. which basicly is about creating some kind of application in a team... our "team" have decided to make a simple game... im in charge of the graphics and the others handle stuff like game logic and network... the problem however is that im programming in C++.. and they in Java... is there a way we can combine our code?

Share this post


Link to post
Share on other sites
No, no an no again. You can bridge Java and C++ through C and the JNI, but it is a huge amount of work, and ridiculously hard to do in robust fashion.

And in fact, your 'team' has missed the whole point of working as a team. Get the team together as soon as possible, and work out between yourselves which language you are going to use for the project. Either one is equally feasible, although graphics is likely easier in C++ and networking easier in Java.

Share this post


Link to post
Share on other sites
ok... yea i guess we'll have to figure something out...

the thing is that they have only read Java..

i pretty much know the basics of Java and Swing... and i dont have the slighest idea how to do graphics in Java... which i guess means we'll have to do something else...

my largest problem here is that the course requirements was "experience with an objectoriented language"... ive done C++ for a couple of years and know it well... but everyone else knows Java... which ive only done simple applications in and dislike... if there is no way i can combine C++ and java in some project... ill have to pick up a Java book and put time that i dont rly have into that...

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon_Strike
ok... yea i guess we'll have to figure something out...

the thing is that they have only read Java..

i pretty much know the basics of Java and Swing... and i dont have the slighest idea how to do graphics in Java... which i guess means we'll have to do something else...

my largest problem here is that the course requirements was "experience with an objectoriented language"... ive done C++ for a couple of years and know it well... but everyone else knows Java... which ive only done simple applications in and dislike... if there is no way i can combine C++ and java in some project... ill have to pick up a Java book and put time that i dont rly have into that...


You certainly can use JNI or Swig to communicate between C++ and Java. However, I think what the other posters are mentioning is that it's possible that binding your APIs back and forth could be more work than you learning some Java and contributing to the team.

Binding between languages is a very useful technique. But, you need to be very particular about where you make the split. It has to be a better reason than language preference.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon_Strike
i pretty much know the basics of Java and Swing... and i dont have the slighest idea how to do graphics in Java... which i guess means we'll have to do something else...


Just let someone else work on the graphics part. If your code is properly designed (a property that does not depend on the language you are using), then there should be clear separation of game-update and rendering logic, so that shouldn't be a problem.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon_Strike

the problem however is that im programming in C++.. and they in Java...


Is there a technical reason behind this?

Quote:
is there a way we can combine our code?
Yes, multiple. Depends on whether it's worth it.

Quote:
Project IT


Working on a project like this isn't about some perfect end result.

It's about learning first-hand how to *complete* something in a team.

This means that entire team will be most productive if they work in Java. A consequence of this is - you will need to yield. Either accept a simpler task, or work as a mentor to someone proficient in Java.

One of the biggest obstacles to team work are soloists. They know something, and they refuse to accept the reality that their contribution or expertise on that part is not worth the effort.

Let's say you get sick. Your team won't know how to build your sources. They won't be able to run your unit tests. They won't know why they are suddenly getting a 500-page error during build.

And besides, since this sounds like software oriented course, the first lesson you'll learn that getting to choose a language or API is a luxury you'll likely rarely have in your career.

So learn how to learn languages fast.

Share this post


Link to post
Share on other sites

This topic is 3574 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this