GPWiki.org
GPWiki.org
It is currently Mon May 20, 2013 7:21 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Wed Nov 23, 2005 5:22 pm 
Paraskavedekatriaphobic

Joined: Sat Aug 27, 2005 12:24 pm
Posts: 1325
Location: aaaaaaaaaaaaaa
I feel like learning Java, because it seems relatively fast, and I'm too lazy to learn C/C++. I've used perl in the past write a game engine, and it's great, but it's waaay too slow to be practical (I hear Perl6 is going to be pretty fast though...), and the object-orientedness is kind of badly done (once again, I hear Perl6 will fix this.... but that's too far off into the future). I also have lots of experience with UnrealScript (which, if you're not familiar with it, is a Java-like (or at least that's what they claim on the UnrealWiki here: http://wiki.beyondunreal.com/wiki/UnrealScript ) programming language used for programming most (not all, more complex things are handled by C/C++ code) of the features of Unreal Engine games (it has some limitations to prevent malicious use (similar to Java on websites), as every time you connect to a game server, modified UnrealScript code is often downloaded onto your computer and run automatically. I also know the braindamaged TIBasic programming language used in calculators. But anyway, back to the point. Any tutorials/suggestions/links/etc. for a semi-experienced programmer who wishes to learn Java.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 6:12 pm 
P2k
User avatar

Joined: Tue Sep 14, 2004 8:34 pm
Posts: 2168
Location: Aarhus, Denmark
Java is really a great language, so I'd encourage you to learn it. As with learning any programming language it usually involves large quantities of reading and coding. Either get hold of a good book or find a comprehensive tutorial online. Also try coding some small applications or games - you will learn more by doing that than anything else, but you still need to know the basics before you start coding ;)

Good luck! :D


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 6:22 pm 
Paraskavedekatriaphobic

Joined: Sat Aug 27, 2005 12:24 pm
Posts: 1325
Location: aaaaaaaaaaaaaa
Sion wrote:
Java is really a great language, so I'd encourage you to learn it. As with learning any programming language it usually involves large quantities of reading and coding. Either get hold of a good book or find a comprehensive tutorial online. Also try coding some small applications or games - you will learn more by doing that than anything else, but you still need to know the basics before you start coding ;)

Good luck! :D


Right now I'm looking at this:
http://gpwiki.org/index.php/Java:Tutorials:Basics

Quote:
The first word, "public", is a visibility modifier. A public function can be called by anyone. The second word, "static", is of particular notice. A static function can be called directly from a class withoutout having to create an object of a class. What this means will become more clear as you learn more Java, but for now, know that the main method must be static. All functions have the opportunity to return a value, the word "void" simply means it does not. Finally, we get to the name of the method, in this case, "main". The "main" method is special, because it will be called by the system when the program is first run.

Question: Wouldn't this normally return an int or something like that for error status or whatever it's called?

Also, I never really could see the point of the strange philosophy that objects should be little black boxes that you can't touch directly (private functions/variables/etc.). :confused


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 6:51 pm 
P2k
User avatar

Joined: Tue Sep 14, 2004 8:34 pm
Posts: 2168
Location: Aarhus, Denmark
T-1 wrote:
Quote:
All functions have the opportunity to return a value, the word "void" simply means it does not.

Question: Wouldn't this normally return an int or something like that for error status or whatever it's called?

No, unlike in C and C++, the main-method in Java does not return an int. Therefore it's marked with void.

T-1 wrote:
Also, I never really could see the point of the strange philosophy that objects should be little black boxes that you can't touch directly (private functions/variables/etc.). :confused

Wait untill you start playing around with classes, heiritence etc. and it will become clear to you why it's very important to encapsulate data and functionality :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 7:06 pm 
Paraskavedekatriaphobic

Joined: Sat Aug 27, 2005 12:24 pm
Posts: 1325
Location: aaaaaaaaaaaaaa
Quote:
Wait untill you start playing around with classes, heiritence etc. and it will become clear to you why it's very important to encapsulate data and functionality :)

UnrealScript is 100% object oriented, so I've been playing around with classes and inheritance for a while (ever since Unreal Tournament and now with Ureal Tournament 2004). :)
I've also seen good and bad ways of doing things.

For example (the bad way), this comment says it all about the UT2003/2004 (they didn't fix this in 2004) UDamage/Double Damage powerup code (this is in the TakeDamage function (self-explanatory name) of the Pawn class (all players/monsters/vehicles/etc. are subclasses of the Pawn abstract class)):
Code:
    if ( (InstigatedBy != None) && InstigatedBy.HasUDamage() ) // FIXME THIS SUCKS
        Damage *= 2;


Now, considering that all weapons and projectiles have a "DamageAtten" variable and all damage is multiplied by it, they could have just multiplied DamageAtten by 2 when you pick up the UDamage, divide by 2 when it wears off. But... no, they couldn't do that.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 7:43 pm 
P2k
User avatar

Joined: Tue Sep 14, 2004 8:34 pm
Posts: 2168
Location: Aarhus, Denmark
T-1 wrote:
Now, considering that all weapons and projectiles have a "DamageAtten" variable and all damage is multiplied by it, they could have just multiplied DamageAtten by 2 when you pick up the UDamage, divide by 2 when it wears off. But... no, they couldn't do that.

Here is an important lesson in using encapsulation. Suppose you just directly modified the damage variable to reflect the double-damage effect when picked up. When what if the level designer decides to place two double damage modifier powerups next to each other in a level?
Scenario:
- Player picks up double damage modifier.
Damage = Damage * 2 = 100 * 2 = 200.
- Player picks up double damage modifier.
Damage = Damage * 2 = 200 * 2 = 400.
- Double damage modifier wears off.
Damage = Damge * 0.5 = 400 * 0.5 = 200.
Not very desirable.

If the double damage powerup were instead created as DamageModifier-classes, then the player could have an array of damage modifier objects. When the player picks one up, an object is added to the array and when the getDamage() method is called, the comultative damage is calculated. When a DamageModifier class expires, it automatically removes itself from the list and things are back to normal. It's dynamic and it's flexible.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 23, 2005 9:46 pm 
Grossly Helpful

Joined: Sat Sep 03, 2005 4:55 pm
Posts: 165
Java is great, yeah.

C++ is pretty picky where java isnt, but then again java is where C++ isnt.

You kind of get a trade off. Simplicity for some functionality, but this functionality gap is rapidly closing (especially with JNI).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 3:43 am 
Gamer Geek
User avatar

Joined: Wed Jan 26, 2005 4:43 am
Posts: 29
Location: Ontario, Canada
Buying a good, solid, up-to-date book is where my recommendation goes. With most of the top results for "Java tutorials" on Google as a secondary backup. ;) And of course the Java APIs documentation.

Regarding the first point, it's very important to make sure you purchase a recently-printed Java book, because API changes and deprecation brought a lot of change between the < 1.1 and > 1.1 eras. I've got an ancient copy of Java Programming for Dummies, and a large portion of its contents is totally covered by new APIs in 1.4-1.5.

If you're familiar with Perl, than it should be a bit of an interesting 'jump' to Java, but still hopefully won't be that bad. As with all programming, sticking to it and practising often are the keys to getting good with it. :)

Good luck!

_________________
"Oh great, Dr. Blair switched the dental floss with barbed wire again.."


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 4:56 am 
Game Programming Guru

Joined: Sat Aug 21, 2004 8:44 pm
Posts: 1149
Location: Waterloo, Ontario
I'm not a big fan of the book-based learning. I find that the best way for me is to find an introductory tutorial, learn the basics, and then look at the API references to find out how to do what I want to do. Knowing another language before hand, especially a similar language, helps a lot.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:31 pm 
Paraskavedekatriaphobic

Joined: Sat Aug 27, 2005 12:24 pm
Posts: 1325
Location: aaaaaaaaaaaaaa
HopeDagger wrote:
Buying a good, solid, up-to-date book is where my recommendation goes. With most of the top results for "Java tutorials" on Google as a secondary backup. ;) And of course the Java APIs documentation.

Regarding the first point, it's very important to make sure you purchase a recently-printed Java book, because API changes and deprecation brought a lot of change between the < 1.1 and > 1.1 eras. I've got an ancient copy of Java Programming for Dummies, and a large portion of its contents is totally covered by new APIs in 1.4-1.5.

If you're familiar with Perl, than it should be a bit of an interesting 'jump' to Java, but still hopefully won't be that bad. As with all programming, sticking to it and practising often are the keys to getting good with it. :)

Good luck!

Yeah, I'm probably going to end up buying a book... but I might not. I learned perl using books, however the book only was really needed so I could get basic programming concepts off the ground... After that I learned stuff like the SDL module for perl and unrealscript on my own. Though It shouldn't be that big of a jump, I understand that Java was one of the major inspirations for UnrealScript, and from what I've seen of Java code here and there, it's pretty similar.


Sion wrote:
Here is an important lesson in using encapsulation. Suppose you just directly modified the damage variable to reflect the double-damage effect when picked up. When what if the level designer decides to place two double damage modifier powerups next to each other in a level?
Scenario:
- Player picks up double damage modifier.
Damage = Damage * 2 = 100 * 2 = 200.
- Player picks up double damage modifier.
Damage = Damage * 2 = 200 * 2 = 400.
- Double damage modifier wears off.
Damage = Damge * 0.5 = 400 * 0.5 = 200.
Not very desirable.

If the double damage powerup were instead created as DamageModifier-classes, then the player could have an array of damage modifier objects. When the player picks one up, an object is added to the array and when the getDamage() method is called, the comultative damage is calculated. When a DamageModifier class expires, it automatically removes itself from the list and things are back to normal. It's dynamic and it's flexible.


Ahh, that's where the right way to do it (as done in Unreal Tournament 1) comes in. There you can check if someone already has UDamage.
Here's the classes involved in UT2003/2004:
--Pawn (handles some of the timer stuff, the damage multiplication, and the overlay effect on the weapons)
--UDamageCharger (respawns/spawns the pickup)
--UDamagePickup (the item you pickup)
--UDamageInfo (handles the other part of the timer (this does the actually counting down and setting Pawn.bHasUDamage to false, Pawn just holds the variable that contains the time))

Whereas in UT it was a single class, UDamage. UDamage handled all of these functions. While separating out those classes might have made sense in the case of UDamageCharger and UDamagePickup, splitting UDamage between Pawn and UDamageInfo wasn't such a great idea. A better implementation would've removed the UDamageInfo and the double damage code from Pawn and created a UDamageInventory class, which would count down, modify the relevant DamageAtten values, and using the CheckPickup function (IIRC, that's the name of, UnrealWiki's google-based search is temporarily broken), to simply add to the timer whenever you pick up more UDamage, and also to do the purple glowy overlay effect over your weapons. Though you have a partially better idea, the Inventory abstract base class should have a function like (this is unrealscript (without any of that crazy network replication stuff the Unreal Engine uses for multiplayer games):
Code:
function float GetDamage(float Damage) {
    // Do stuff to damage here in subclasses.
    return NextInventory.GetDamage(Damage); // Every Pawn instance has an  Inventory linked list like this
}


So therefore UDamage would do this:
Code:
function float GetDamage(float Damage) {
    Damage *= 2;
    return NextInventory.GetDamage(Damage); // Every Pawn instance has an  Inventory linked list like this
}


The Unreal Engine seems to have been made by a brilliant guy (Tim Sweeney, I believe) with the help of an army of morons.


Top
 Profile  
 
 Post subject: for dummies
PostPosted: Sat Jan 27, 2007 6:11 am 
is java 2 von dummies worth es


Top
  
 
 Post subject: Re: for dummies
PostPosted: Sat Jan 27, 2007 6:13 am 
yabberyabber wrote:
is java 2 von dummies worth es


sorry i wrote that in german. (whell some of it)
is java 2 FOR dummes worth ES


Top
  
 
 Post subject:
PostPosted: Sat Jan 27, 2007 9:35 am 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
Probably not (the dummies books are generally well written, but don't go into much depth).

Also, for something like this, please create a new topic rather than necro posting in a thread that isn't really on the topic you are asking and is almost 2 years old. Thank you.

GPwiki Mod

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 27, 2007 8:56 pm 
Rookie

Joined: Fri Apr 27, 2007 8:24 pm
Posts: 4
i just have no idea what any of this means... :( i wish someone could show me what to do....


Top
 Profile  
 
 Post subject: course
PostPosted: Thu Feb 11, 2010 1:41 am 
do what i did and take an online course working for me


Top
  
 
 Post subject: online course
PostPosted: Wed Apr 07, 2010 9:11 pm 
Sorry if i'm cutting into the posting, what online course are you taking and how much is it?


Top
  
 
PostPosted: Fri Apr 23, 2010 10:38 pm 
There's a web site called 'Ozar.net Developer Blog' where you can find free tutorials from the ground-up for Java, PHP, ASP.Net, C++ and Objective-C

The URL is http://devblog.ozar.net


Top
  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 3:32 am 
Fish Doggy
User avatar

Joined: Mon Jun 27, 2005 4:50 pm
Posts: 1705
Location: Ontario, Canada
Oh, hi spam bots. How are you today? I'm fine, thanks for asking.

_________________
In brightest day, in blackest night. No evil shall escape my sight. Let those who worship evil's might, beware my power... Green Lantern's light!
Twitter!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 24, 2010 2:37 pm 
Bibliotherapist
User avatar

Joined: Wed Dec 21, 2005 6:23 pm
Posts: 6210
Location: Manchester, UK
Isn't it nice that the lovely spam bots now have conversations with themselves? :D

I think these may be real posts though... spam bots don't normally take 2 months to have a conversation like that :)

_________________
God must love stupid people, he made so many.
theraje: 'God doesn't love stupid people, they're just easier to make'
http://sharedillusions.blogspot.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 26, 2010 4:37 pm 
Rookie

Joined: Wed May 26, 2010 4:26 pm
Posts: 2
Here is the best way I've found to learn Java. Here's how you get it.

1. Go to iTunes.

2. In the iTunes store search for "Programming Methodology".

3. Here you will find maybe 30 videos, an hour each. They're actually recordings of Stanford University lectures that teach you two things.

Software Engineering - Improving your approach to programming, programming conventions and readability of your programs.
And of course Java.

The videos are a brilliant way to learn. Now if you do not want to buy the two required books, here they are in .pdf format.

Karel Learns Java
(Down at the Moment)

Art and Science of Java

Give it a try.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

All times are UTC


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group