View unanswered posts | View active topics It is currently Fri Nov 28, 2014 6:44 am



Reply to topic  [ 19 posts ] 
 Java Is Actually Decent! 
Author Message

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Java Is Actually Decent!
Well I have been working on a small little project - education software/game - and I have been writing it in Java because of the need for it to run in so many places. All I can say is wow!

I had used java in some prior projects and found it to be a pain in the ass. Admittedly part of the problem was Java shouldn't have been used for the projects in the first place.

It has also taken me awhile to get used to this whole package concept. Not necessarily the concept of grouping, but the jacked up naming conventions used ... com.blah.etc.

But, during this project I found it to be rather pleasurable. I was mostly surprised at the robustness of their Swing components. The architecture seems pretty well thought out in most places and I found it very easy to customize to suit my needs. I am also loving the extremely simple internationalization support, which was a must have for my app.

I am still annoyed at many things about Java, but at least now I have some good stuff to associate with it as well. [img]images/smiles/icon_smile.gif[/img]

- Chris


Wed Apr 24, 2002 8:36 pm
Profile WWW

Joined: Tue May 02, 2000 7:01 am
Posts: 11
Location: Look behind you...
Post Java Is Actually Decent!
I'm planning on learning Java over the summer. If you like it I suppose it must be getting pretty good.


Thu Apr 25, 2002 12:23 am
Profile ICQ WWW

Joined: Mon Jun 05, 2000 7:01 am
Posts: 25
Location: Conway, AR, USA
Post Java Is Actually Decent!
I'm on a all-out java love-fest right now [img]images/smiles/icon_smile.gif[/img] I've been working on a project at work for about a month.. a fairly large GUI thing..

I'm almost finished, a comparable product would have taken me 6 months to do in C++/MFC.. way cool.

If you don't mind me asking, what are the negatives you see bit?

I have a couple of gripes, mostly having to do with no destructor (although that hasn't been the problem I thought it would be) and worse the automatic constructor calling mechanism..

A couple of small syntatic issues also exist (although I don't remember what they are at this point), but nothing serious and probably more to do with my style than anything else.

Otherwise, I think Java is a significant step forward over C++ in many many many ways...


Thu Apr 25, 2002 3:12 am
Profile ICQ

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Java Is Actually Decent!
My list of complaints about java is as follows, in no particular order:

- Package naming still seems to weird to me, although I am used to it.

- Not being able to change a String unless it is in a StringBuffer. Seems like a large waste of resources because you can't cast between the two. Of course, this may just be something I am missing.

- Javadoc is a pain. I can't stand being forced to comment a certain way. I hate C style comments which is basically what javadoc wants to have. Not sure if there is a way to tell it to use something different. So, no javadoc for me.

- I was pissed about the destructor issue as well until I found out about the finalize() method which the garbage collector calls before deleting.

- Everything is a reference. I think this one bothers me the most. I wish there was a way to turn off this behaviour.

- No #defines or equivalent. I miss this the most from using c/c++. It makes a developers life much easier.

Nothing really serious, just enough to make it annoying depending on the type of project being worked on. [img]images/smiles/icon_smile.gif[/img]

But, yes, I agree that Java is way better than C++ from an OO point of view. A lot of people complain about the lack of templates, but I have never found that much use for them anyway. In all I found java much more straight forward and easy to work/design with.

Obviously speed is still a concern of mine (always is), but it is definitely improving with each release. And, with computing power increasing the lag(s) aren't as noticable. Besides, I would rather give away a small amount of my processor to a VM so my apps can run on all platforms. It is a small price to pay for the abstraction.

- Chris


Thu Apr 25, 2002 9:45 am
Profile WWW

Joined: Sat Apr 21, 2001 7:01 am
Posts: 53
Location: Lexington, MA, USA
Post Java Is Actually Decent!
Since all classes are derived from Object, you can simulate templating quite easily. For example, if you had (in C++) a templated class that looked like:
<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr><pre>
template <class T>
class MyClass
{
public:
...
private:
T x;
...
};
</pre><hr></blockquote>
You could achieve the same thing in Java by doing:
<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">code:</font><hr><pre>
public class MyClass
{
private Object x;
...
};
</pre><hr></blockquote>
Likewise, templated C++ functions could be converted to Java changing the templated parameter(s) to Object(s). The only catch to this is the primitive types - you have to use the classes Integer, Character, etc. to use the primitives (int, char, etc.) as Objects.


Thu Apr 25, 2002 3:05 pm
Profile ICQ

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Java Is Actually Decent!
Sure ... give me a kludge for the one feature I don't give a damn about anyway. [img]images/smiles/icon_smile.gif[/img]

- Chris


Thu Apr 25, 2002 3:13 pm
Profile WWW

Joined: Mon Jun 05, 2000 7:01 am
Posts: 25
Location: Conway, AR, USA
Post Java Is Actually Decent!
--Javadoc

Ya.. I don't use Javadoc for the same reason I don't comment my code in general very much.

--Destructors

The problem is that you have NO guarantee as to when the destructor will be called. It can be useful to call code as an object goes out of scope. For example, I like to use the command pattern to implement undo/redo features in applications. To make this easier I often create a "Transaction" object... you add commands to this object and then have to commit that transaction. If you don't commit it, and the transaction object goes out of scope (maybe an exception was called or something) then you simply undo all of the commands you added to the transaction.. so its like nothing happened. You can't easily do this in Java, because you have no idea when the finalize() method will be called. Its not a BIG deal, you don't have to do this kind of thing very often.. just annoying [img]images/smiles/icon_smile.gif[/img]

--Everything is a reference

Java has no real built-in idea about the stack. This makes sense because many many architectures don't have any type of stack... so you would be really limiting yourself on these platforms. Thus it means everything has to be located on the heap, and as such HAS to be a reference. See it makes sense [img]images/smiles/icon_smile.gif[/img]

I have found that reference semantics is actually kind of nice....

--Immutable Strings

Consider:

public void myFunction(String str)
{
str = "Something else";
}

public void someOtherFunction()
{
String s1 = "My String"
myFunction(s1);
}

After this call the value of the string is "My String" because everything is passed via reference semantics. This is a problem, because all of the other primtive types in Java are actually passed by value rather than by reference... this forces the String object to behave basically like any other primitive type in Java...

It is ALSO much more secure.. and for a network language that's important. Strings have always been a very common attack point.. if a string is immutable that point of attack becomes much more difficult.

--Generics

There IS a Java Generic compiler.. it's in the community approval process right now.. it is completely 1.4 compatible at this point. It uses C++ syntax, but isn't quite as complex or error prone..I really dig it.

I really think generic programming is important. Its EXTREMELY useful and can greatly improve the reliability of a program. I rarely return iterators in Java, because dammit you have NO IDEA WHAT THE HELL TYPE OF OBJECT THEY POINT TO.. and that sucks. Generics fix that.. I completely intend to convert my current project to the generic compiler as soon as I get a chance [img]images/smiles/icon_smile.gif[/img]

Nick


Fri Apr 26, 2002 1:15 am
Profile ICQ

Joined: Thu Sep 23, 1999 7:01 am
Posts: 18
Location: Auburn, CA -- USA
Post Java Is Actually Decent!
Yeah, most of the stuff works out best for Java and its unique set of circumstances. But I am still going to bitch about it, because some of it becomes an inconvenience to me, as a programmer. [img]images/smiles/icon_wink.gif[/img]

I'll have to check out that generics project. It sounds interesting.

Anybody who wants to take a peek at what I have been working on can grab it off the archive site. This is quite far from even being near beta stage, but the word search is working nicely and most of the framework stuff is in place. Any feedback is welcomed.

http://www.jaguarlabs.com/archive/view.phtml?ArchiveID=27&Sheet=display

- Chris


[ April 25, 2002: Message edited by: bit ]</p>


Fri Apr 26, 2002 1:47 am
Profile WWW

Joined: Tue Apr 17, 2001 7:01 am
Posts: 2
Location: Jacksonville, FL, USA
Post Java Is Actually Decent!
I use Java here in FL to do all kinds of eBusiness solutions etc... It's great for that. I learned it by making some games with it.

Personally I feel like it's great for certain kinds of games... like bit said.

If I was writing a game like "You Don't Know Jack"... then java would be PERFECT...

but i think games like "HALO" and "MAX PAYNE" that are very graphic intensive are best written in C++ still, because of the power it provides and the fact that it's not interpreted. I don't think JIT's are quite as good as people want them to be yet.

however, i DO like the object oriented approach that java forces you to use. Lots of people use OO programming part of the time with C++, and then hybrid their code out with procedural programming... while this may sometimes be necessary (I don't really know for sure) I think a lot of times beginning gamers get lazy and don't want to bother with taking the time to go OO. I think that this is a problem and so for beginning game programmer's I'd reccommend java.

Perhaps some would say that I, however, am a wannabe... since I have yet to write a game that I've marketed.

Nevertheless, I would think that using OO design for games is great. Am I wrong?


Fri May 03, 2002 5:05 pm
Profile WWW

Joined: Mon Jun 05, 2000 7:01 am
Posts: 25
Location: Conway, AR, USA
Post Java Is Actually Decent!
I think the blanket "We should only write games like You Don't Know Jack in Java" isn't actually accurate.

Theres a really interesting (and ongoing) research paper floating around that analyzes creating games in Java. Its initial conclusion was that C++ was something like 2-5 times faster than Java in computational power.

Until the code was optimized. It turns out it is actually possible to write optimized Java code that is FASTER than optimized C++ code... the reasons are quite esoteric (having mainly to do with the sun JVM's ability to do generational garbage collection which can virtually eliminate memory allocation in many circumstances). So if you follow the 80/20 rule (80% of the work is done by 20% of the code) then you can probably get away with optimizing 1/5 of the total Java code and be set..

As far as the graphics portion goes.. almost all of the graphic power is handed off to the video hardware.. Most games do amazingly little actual graphics crunching on their own anymore.. that makes it quite language independent.. its the same reason that fast graphics applications can be written in VB... (which is a slow language almost by design:-> ).

Also if you look at the technology emerging in the next sun JVM release... its actually going to be able to analyze code and place real variables on the system stack which I beleive will GREATLY close the speed gap you see between unoptimized C++ and Java...


Mon May 06, 2002 2:59 pm
Profile ICQ

Joined: Tue Apr 17, 2001 7:01 am
Posts: 2
Location: Jacksonville, FL, USA
Post Java Is Actually Decent!
i hope you're right... im more experienced with java than C++... maybe i should start writing games with it...


Mon May 06, 2002 4:00 pm
Profile WWW

Joined: Thu Sep 23, 1999 7:01 am
Posts: 3
Location: New Jersey
Post Java Is Actually Decent!
Damn.. Does that mean I'm gonna have to eventually get that "C++ 4ever" tattoo removed?? Argh. [img]images/smiles/icon_smile.gif[/img] Just as I'm getting good at C++ too.. [img]images/smiles/icon_sad.gif[/img]


Mon May 06, 2002 8:43 pm
Profile ICQ

Joined: Tue Nov 07, 2000 8:01 am
Posts: 11
Location: Urbana, Illinois, US
Post Java Is Actually Decent!
I tried learning Java a while back, it looked like a sloppy version of visual basic, without the visual part. Is it really getting better, because I like making webpages, maybe I should take another look into it if Bit and Enjolras say it's good. [img]images/smiles/icon_smile.gif[/img]

-Fredric


Mon Jul 01, 2002 11:36 pm
Profile ICQ WWW

Joined: Wed Nov 24, 1999 8:01 am
Posts: 10
Location: Columbus, OH
Post Java Is Actually Decent!
Java's not so bad. We're using it as a scripting language in our game...

zc


Tue Jul 02, 2002 6:02 am
Profile ICQ

Joined: Wed Nov 24, 1999 8:01 am
Posts: 10
Location: Columbus, OH
Post Java Is Actually Decent!
Java looking like VB?? You're thinking of Javascript. Not Java.

zc


Tue Jul 02, 2002 3:39 pm
Profile ICQ

Joined: Fri Aug 15, 2003 7:01 am
Posts: 1
Location: the past to avenge my future death
Post Java Is Actually Decent!
I have to agree that the fact that every thing is a reference is one of the most wonderful things about java. It does automatic reference counting so you don't have to worry about it being deallocated prematurely.

Also string is not a simple data type. It inherits java.lang.object. Certain functions like concatenation are overridden in the compiler.

As for defines they can easily be implemented using static final data members;

public class Constants{
public static final int UP = 0;
public static final int DOWN = 1;
}

Then you access them in your code like so:
thingamaObject.setDirection(Constants.UP);
Very simple and flexible.

As for the javadocs. To write they are more work however the payoff in readability is incredible. If you use the Sun One Studio, Previously Forte, there is automated javadoc creation. That software is free btw and actually pretty nice; it is available at java.sun.com in the downloads.

I am sure the more you program with java the more the elegance of the language will be impressed upon you. Like MFC there is a mindset that one must adopt to really efficiently write code in java. Once you instantiate org.enlightenment.JZen you will never go back.


Sat Aug 16, 2003 8:55 am
Profile

Joined: Sat Apr 21, 2001 7:01 am
Posts: 53
Location: Lexington, MA, USA
Post Java Is Actually Decent!
You guys realize this thread is over a year old, right?


Sat Aug 16, 2003 10:38 am
Profile ICQ
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.