PDA

View Full Version : Java or C?


Graeme
11th Nov 2001, 11:41 PM
I've been fiddling around with uscript for a while now, and I'm not progressing with it as well as I'd like to be. I know that it's similar to both C and Java, so I decided I'm going to learn one of them first. Which one would be more useful to know?

If the answer is C, then should I learn C++ instead? And if it's java, do you recommend java2?

thanks

Brood_of_Evil
12th Nov 2001, 12:59 AM
Well, UScript is based on C++, all the different properties of object oriented programming is found in UScript, like polymorpysm, encapsulation and inheritance.

You can see how each mayor class is derived from the Actor class, Projectile, Pawn, Inventory, etc, all these classes are subclasses of Actor, which show a good example of how inheritance it's used in UScript, a method of object oriented programming not found in C.

People often ask if they should learn C before learning C++, but it's not only uneccesary but it's an advantage not to do so. So hit the C++ I think it's the best programming language ever made.

Graeme
12th Nov 2001, 01:27 AM
ok, thanks.

why is it advantageous to not learn C before C++?

Euphoric Beaver
12th Nov 2001, 01:52 AM
I've been learning Vb at college and learning two languages confuzzles my head. :( It's proberly not worth knowing something that you will never use or be applicable in Uscipt.

I've learnt all I've known by having no shame and asking the dumb questions here. Thanks guys. :D:tup: I'll buy you lot a cold one after. http://67.161.162.235/cicid/smillies/cheers.gif

BTW Graeme, love your sig. How did you do the shading on the lettering?

Brood_of_Evil
12th Nov 2001, 01:56 AM
well C++ can be learned from scratch, all the functionality of the C language with an object oriented approach, so there's basically no need to learn C first.

Graeme
12th Nov 2001, 02:14 AM
ciced: for the shading on the letters, I think it's Filter > Render > Lighting or something like that... if you get a window that allows you to position a light source you're in the right place.

And don't worry, I've got plenty of dumb questions up my sleeve :)

Euphoric Beaver
12th Nov 2001, 02:24 AM
hehe...Thanks :D:tup:

Graeme
12th Nov 2001, 02:32 AM
np :)

btw, I love your combination of :D and :tup:

:D:tup:

Syri
12th Nov 2001, 09:17 AM
C++ is probably the best language to use, it's rapidly becoming the largest used language. C++ is basically C, but with the addition of object orientated programming. If you learn C++, you will get a pretty good idea of C in the process

TaoPaiPai
12th Nov 2001, 10:39 AM
I'd say Uscript is based more on java than C.Java is mentioned in the introduction to Tim SWEENEY's page on uscript(http://unreal.epicgames.com/UnrealScript.htm )

Learning the basics of Java will be more helpful for your Uscript than learning C++,definitely.But Java is a bit more complex to understand at first.

As said before,if you want to make a carreer in programing it would be wiser to learn C/C++ rather than Java.
Sadly Java is an underused language and it's future is not very optimistic,mostly because of Microsoft's attempts to kill what they can't use to control people and make money.
The language Java was created with a real philosophy behind it ,It was meant as the highest level language possible and with the idea of being hardware independant and time-independant.Yet it could be bettered at the way it works (using a precompiler rather than an interpreter).

IntRed
12th Nov 2001, 10:52 AM
C++ is probably the best language to use, it's rapidly becoming the largest used language
never heard of cobol?

Graeme
12th Nov 2001, 01:30 PM
dammit, now I have people contradicting other each other :)

I am planning on make a career out of prgramming, but since I'm only 15 I think that in the long run I'll have enough time to learn them both, so I just want the one that will be more useful to me for learning uscript.

I already understand inheritance, but I've never even heard of polymorpysm, and encapsulation. I know how to make functions, loops, timers, switch statements, conditionals, class declaration etc. But when I want to code something, even though I usually have a really good idea of how to structure it and what method to use, I don't know how tell if the player killed somebody, or how to find out what someone's score is and stuff like that. Knowing this, does it change anybody's opinion on which language would be more helpful to me?

Jesco
12th Nov 2001, 02:12 PM
Just to bring pluralism into this round:

Delphi / ObjectPascal

:D

Hehe, ok. Seriously, I'd go for C++. It's a bit, uhm, uglier than Java, but industry standard. And the concept of OOP is the same in both languages.

Graeme
12th Nov 2001, 02:26 PM
ok, so that's 3 for C++ and 1 for Java

Papapishu
12th Nov 2001, 05:38 PM
Java is totally worthless unless youre doing cross-platform web apps.
C++ is the king of all programing languages, and it'll probably never be dethroned, cause it's infinitley scalable and can do anything.
Althoug it does not have the same standardised class-structure as UScript does.
In c++ you can choose among several different approaches and classes that do virtually the same stuff in different ways.
There's hard to learn what's standard, semi-standard and 3rd-party stuff, which means It can bite to learn it because of that.
Uscript has only one class-structure and you learn it quickly.
Technically it's more similar to Java than C++.
(Java comes from C++ in the first place)
In fact, i think you should learn UScript first, since you learn the principles fast.
Then if youre coding java for the net, use Java, if youre making regular programs, use C++...

Delphi/Pascal is often used for programming paralell to micro-computers and assembler, because it has a nice, easy interface to assembler...

If you're a "real" programmer in business, you HAVE to know c++

Anyway, if you get the principle, yoy learn a new language within a month, so Once a programmer, always a programmer, nomatter what language...

And TaoPaiPai, long time?
Here's an avatar, I'd like you to have:

Graeme
12th Nov 2001, 05:53 PM
ok... the reason I didn't want to go straight to uscript is that there's a lack of documentation... I learned VB, Javascript and PHP easily with books. But there aren't any books on uscript :(

So you think I should just hack away at uscript?

Papapishu
12th Nov 2001, 06:04 PM
Ofcourse, it's easy!
There's no documentation, but then again, I've never learned anything from a documentation book, just hacked my way there... :)
And there's de facto documentation all over the net.
Just look at the faq. (http://forums.beyondunreal.com/showthread.php?threadid=81840)
Search the web, check planetunreal, unreal.epicgames.com e.t.c.
they all link to eachother...

TaoPaiPai
12th Nov 2001, 08:35 PM
The only way to learn Uscript is to decompile the HUNDREDS of classes from UT (and mods) and see how it works.That's the only way to learn.
Use UNDOX (http://www.planetunreal.com/undox) it helps a lot (although buggy).

Graeme
12th Nov 2001, 08:58 PM
yeah, I already knew that. and I tried using undox but it kept giving me error msgs when every time I tried to do anything... I'll try reinstalling it.

Brood_of_Evil
12th Nov 2001, 10:47 PM
Originally posted by TaoPaiPai
The only way to learn Uscript is to decompile the HUNDREDS of classes from UT (and mods) and see how it works.That's the only way to learn.

Well as I was about to say before my computer crashed...What TaoPaiPai said it's true. Check out all the Engine, Botpack, UnrealShare classes. If you have an idea but don't know how to implement it, then look out for some mod or mutator that implements a similar idea, download it and open it up in UnrealEd or export it to .UC. Then look for the code and modify it if you want. Most UScript programmers don't mind people taking part of their code and modifying it, but if you do you should give them credit for the code, as they worked hard to make it. Some people write "Copyright (C) 2001" or something like that...which I think it's pretty lame, most of us are programmers at heart, and don't get paid diddly. Anyways, I sugest you that if you're plannign to use USript, then learn to use the UCC method, as I think it's more flexible than compiling in the edito. In UCC you can modify classes more easily, and change their superclasses, or delete them (as long as they're not referenced in some other class).

Also check out these links for tutorials and references:
http://www.unrealscript.com
http://www.planetunreal.com/wod/
http://www.planetunreal.com/mutation/

and if you have any questions, drop us a line in the forum, we'll be glad to help.

Syri
13th Nov 2001, 05:26 AM
Originally posted by TTRStryker8

never heard of cobol?
yes, i have heard of cobol, that's why i said becoming the most popular

2COOL4-U
13th Nov 2001, 10:29 AM
I would recommend you Java, it looks way more like UnrealScript. But C++ is a good way too, depends on what you want to do. If you want to make programs sometime too, it's better to learn C++

Hugh Macdonald
13th Nov 2001, 10:10 PM
I'm intrigued...

Brood_Of_Evil - how does UScript have polymorphism?

I have yet to find a useful language which supports polymorphism (Haskell, which we're having to learn at uni, doesn't class as useful in my book)

Proper polymorphism is a lovely feature... Do explain where it is used..


Oh yeah, and I'd recommend that you learn C++ - If you're planning on going to university to study Comp Sci (which I would expect, if you plan on making a career out of it), they may well make you learn Java. So far, in the past year and a bit, I've had to learn C, Java and Haskell, and am now doing a project in C++ (I only knew UScript before going to uni)
One of the most important programming skills (in my mind) is being able to adapt to other languages - if someone can hand you a book on a language that you've never seen before, and you can be proficient in it by the end of the day, then you're on your way. I would recommend getting used to functional (Haskell), OO (C++, Java, UScript), and procedural (C) languages.


Thanks

Brood_of_Evil
13th Nov 2001, 10:53 PM
Fuction redefinition (overriding) in a subclass, that itself is polymorphism right away.

Graeme
13th Nov 2001, 11:02 PM
I'm not a total uscript newbie... I just want to learn it more comprehensively... I've already made some pretty basic mutators and weapons.

thanks for the help everyone
I know that I'll end up learning java and c++ eventually... i just wanted to know what I need now :)

Hugh Macdonald
14th Nov 2001, 06:13 AM
That's not proper polymorphism - I agree, polymorphism can be faked using OO techniques, but proper polymorphism would allow you to not specify what type of variable is coming into a function, and it will still work on it....

That didn't really make sense to me, so I'll give an example...

remove :: Eq a => [a] -> [a] -> [a]
remove xs [] = xs
remove xs (y:ys) = remove (filter (/= y) xs) ys

That is a haskell function - normally, where the 'a's are in the top row, there would be the types that are coming into the function. However, as this function can work on any type, 'a' is used, so remove can be used on a list of anything

With OO languages, you still have to write a function for each type that you want to be able to use.