Which programming language?

Started by Babar, Tue 26/04/2005 13:44:07

Previous topic - Next topic

LGM

I'm deciding if I want to stick with C++, learn C# or Java. I would like to create open-source programs in the future that could be ported easily to other platforms...
You. Me. Denny's.

scotch

I'd learn C++ first, once you know that you pretty much know all you'll need for a smooth transition into Java and C# (the opposite is not so true, imo), took me a few days to get used to Java after coding C++ for a year because it's basically C++ minus the complicated parts, with a very nice and easy to understand standard library (And Java to C# is even easier).  Out of C# and Java I'd say Java is best for cross platform development, there's a JRE for basically any platform you'd want to develop for, and you don't even need to recompile your code to run it on another platform.  I'm currently trying to get a C# app working on a linux server, and I can't even work out how mono (open source .net implementation) works on windows, can't compile a thing so far, at least once I've worked that out it does seem to be quite mature from the documentation, it does require at least a recompile of your programs though.
You won't want to know just one language, which ones you end up using will depend what you are doing, different languages are useful for different purposes, an IRC bot is something that Java would be perfect for, C# is a well designed language, good for tidy development of windows GUI apps, C++ is great for game engine development, C is perfect for writing a cross platform codec library in, assembly is nice for putting inline into your C++ code for fast hand optimised loops, I'm not particularly attached to any one of them, they're all useful languages.  Once you know one it takes very little time to learn another.

Dowland

I discourage anybody from starting programmation with C++. It is true taht once you have mastered C++, going to most other languages is pretty easy ... but in essence, the contrary is also mostly true (what you learn, is how to think in the terms of the computer, then learning new keywords is run of the mill).

However, I believe C++ to be the hardest to get something out of. It's not hard per se, but it is hard to do something tangible. It's FAAAAAAAAR (Pluto<->Sun distance far-like) from being rewarding in the short term, and I am almost sure, that if you plan this as a summer project (2 months?) you'll most likely become disgusted by the difficulty.

Again, C# will easily allow you to make GUI applications, with some you can touch, and feel.

Or if you want to start with a non-interpreted language, C is the way to go. C introduces you to all the problems of memory, pointers, and the habit of syntax, while not going overboard with all the OO stuff (C++'s operators can be endlessly confusing, between ., ::, ->, etc.)

If you want to learn C, look for ALGORITHMIC tutorials. Why? Because they don't require you to learn the fancy pansy stuff that requires a library. You can do algorithmic programming with just the standard library and the most simple, most BASIC programmation keywords.

LGM

Well, I'm already learning the basics of C++, and I started with VB so don't worry about that.

I just was wondering if I should learn Java or C# first. I'm an advocate for cross-platform programs, so it sounds like Java would be easier to do that with
You. Me. Denny's.

Dowland

For C#, recompiling on any platform with Mono is a matter of "mcs mysourcefile.cs" ... I think you'll handle it fine.  ;)

juncmodule

So, I've been "trying" to learn C++ for about 5 years now. I understand a great deal of the concepts but haven't really been able to put anything to any kind of use. I just lack an understanding of enough to really do anything with it.

After reading this thread I got a C# book from the library and downloaded SharpDevelop. I must say, I'm pretty impressed with the layout of the program and the layout of the language. It appears to be enough like C++ that what I have learned so far is not wasted. I like the idea of it being very strict syntax. I really do hope it is an easier language to learn.

I guess my biggest problem with learning to program is that I only want to do it as a hobby. I have no intrest to do it as a living. I also don't have anything practical to work on. Sure, I would love to build my own software synths, samplers, write super programs to help people make games, and even write games themselves. That is all way above what a begining programer can do. So, what the heck are you guys doing with all of this? I mean, what is your immediate goal with the language? Or are you just learning it for fun or just to learn it. Those of you that know some languages, where did you start? I've read that Tetris and pacman are good games to start with (practice with collision and AI). But what if games isn't all I really want to do? Any suggestions?

So, Chris, is your job where you are getting the exposure to C# or are you rewriting AGS in it? Sorry, been out of the loop if this is already well known.

By the way. In regards to starting programming. AGS really taught me a lot about programming. I felt like I could see results much more quickly too. I wish there was a similar environment to learn other languages in. With the recent changes to AGS I'm really excited to get back into things and learn it all over again.

later,
-junc

Dowland

Ah yes!

The “goal” is a big problem of hobbyist programmers.

I find that when you don't have a goal, you just rot.

Also I find that when you don't have a well defined, you tend to drift, and get easily frustrated.

In addition, I discovered that when you have a clear, focused idea of what you want to do (and that idea isn't a general “I want to make a program to solve world hunger”, but rather, “I want a program that can lookup cheapes prices for food through Google”) ... it's a lot easier.

I've been working on network programming for years. At the beginning, it was very amateur. But soon, I had kept wondering how to control the packet flow, how to establish serverless connections, etc. And then I got to analyzing protocols, and reverse engineering them (that's how you learn how to write Telnet, etc.) And then you discover RFCs and then you eventually need to write one.

Since a short period of time, my goal was to write some project on IRC for file sharing ... and I just started writing. Because I had a clear idea of what I wanted to do, I built my classes in a very structured way. Because of the way C# is, building over and over and over is very easy, and my project just keeps getting bigger and bigger (and there are no bugs along the way).

But I don't think I would ever have gone this far without a project (and it wouldn't have been as much fun).

LGM

You. Me. Denny's.

scotch

It really doesn't matter, imo, they're virtually identical as far as I'm concerned, if you can code one you can code the other.  Someone will probably post with a huge list of differences, but honestly I didn't have to read a thing when starting to mess with C#, I just do a quick google now when something unfamiliar pops up.  C# seems a slightly nicer language, possibly, they're about the same as far as ease of learning goes.

Dowland

lgm, I use C#, and I've had to use Java. A few reasons why I don't like the latter have nothing to do with the speed or quality of the libraries, etc.

1) C#'s syntax and keywords, and .NET framework classes' properties and methods have been streamlined. In Java they are not. Java gave me the impression that a whole bunch of programmers had different ideas of what the syntax should be, and just put all their ideas together. As I said before, let's take the "size" for example (in Arrays, Hashtables, Dictionaries, FileStreams, etc.)

While in Java the keyword is sometimes a property named "count", sometimes a property named "length", "len", or "size", ... or even perhaps it could be "getLength", in C# the property to access a size of a dynamic object if always "Count". (And this make it easier).

In a nutshell, I find C# prettier to write and to look at (and for me, that's a big criterion).

2) Java's compiler errors are a *lot* less helpful I find (Microsoft made a special effort to make their errors and warnings very descript), and sometimes make no sense at all (for example, Java requires to catch errors if they MIGHT occur) ...

3) Java wants you to create a new source file for every class, and that the filename of your source code must be exactly the name of the class it defines ... which while it might make sense, isn't practical (it's too artificial a convention to be really helpful, and it turns out to be annoying).

4) While Java doesn't require a recompile, the compilation, as I said, isn't much effort. I also feel like the .NET CLI is faster on Windows, and that this is due to get even more true as time passes (because Microsoft is dead set on supporting this baby, and tinkering it to death to make it more efficient than the Java VM).

5) Whereas Java's windows feel very much like Java, the Mono ports of the Windows namespace uses gtk to give the programs a better feel under Linux (as well as Windows).



BTW, what scotch says is absolutely true. Knowing how to code C#, is knowing how to code Java, and vice-versa (though I find C#, from the naming conventions I talked about above, to be a bit easier).


Also, something I learned only after starting to use C# ... but it's VERY useful to have Rotor under hand, to check for some free code snippets.

LGM

I'm sold! You've been very helpful, dowland (scotch, you smell ^_^). When I need help I'm coming to you.

Thanks for your input (even though I didn't even start this thread.)
You. Me. Denny's.

scotch

#51
Could you tell me how to compile something on mono then? I have an ircbot framework (intended to replace the old AGS Roger bot code) which CJ developed in Visual Studio, and I can't for the life of me work out how to get it to compile on mono.Ã,  There is no documentation anywhere.Ã,  I'm almost ready to port it back to Java (I disagree with most of your criticism, actually, I think it's just a case of which one you're more familiar with, most stuff you don't like in Java makes perfect sense to me, just like Java looks prettier to me.  Not really interested in arguing over which languages are best though, they're all so similar.)
There's a VS project to makefile converter, but how I use the makefile that comes out, I have no idea.Ã,  Compiling the .cs files one by one with mcs doesn't seem to work at all.
http://www.adventuregamestudio.co.uk/ircbot.zip code here, if you feel like taking a look...

Dowland

#52
You want to compile this on Windows or Linux?



EDIT: "C# .NET IRC Framework v0.1 by Chris Jones"

Hey! I didn't know good old CJ (somehow I can't help think of the press secretary nowadays) was tinkering in C#. Boy was I gone a long time.


... Brrrgg ... this code is ugly. No wonder you prefer Java! You're not taking advantage of C#'s extras!!!

scotch

Linux (or both, would be nice), we can compile on Windows with Visual Studio, but we have a linux server to run it on.

Dowland

#54
Well the tough part is to manage to install Mono, because it needs packages which are sometimes not pre-installed on most "dedicated servers".

I do not have a Linux system under hand ATM, but this works fine on Windows:

mcs /target:winexe /out:CJBot.exe /nowarn:168 /nowarn:169 AssemblyInfo.cs Form1.cs Core\DefSinkImpl.cs Core\EventSinkProxy.cs Core\HelperFunctions.cs Core\Interfaces.cs Core\IrcClient.cs Core\UserAdmin.cs Plugins\ChannelControl.cs Plugins\FactStorer.cs Plugins\GenericResponder.cs Plugins\Googler.cs Plugins\Peak.cs Plugins\TellMessages.cs Plugins\WorldTime.cs -lib:"C:\Program Files\Mono-1.1.7\lib\mono\1.0" -reference:mscorlib.dll -reference:System.dll -reference:System.Windows.Forms.dll -reference:System.Drawing.dll -reference:System.Data.dll -reference:System.XML.dll


Run that from the Mono Command Prompt.

(Of course, you'd change the path of -lib)


... and do you really need a form?

scotch

No, we were going to remove the form.  CJ put it in but we'd be administering it through the console remotely anyway.  Thanks, I'll try it :)

Dowland

@ scotch : Well, I was telling you about the Form, because it's just adding links you don't want to have unless their necessary (Windows.Forms namespace, etc.) Furthermore, at this point, GUIs are the only thing that can potentially cause a bit of trouble when cross-platform compiling so ...

How about adding a Telnet interface?


I hope you'll let me know how it goes.


@ lgm : Glad I brought you to the dark side  ;D ... be sure to ask for help if you need it (also CodeProject http://www.codeproject.com/csharp/ is a very helpful site).

Dowland

#57
Quote from: Pumaman on Tue 26/04/2005 17:55:19
I would recommend learning C#, as it's a very clean and nice object-oriented language.

Ooh ... I didn't see that someone had summarized my thoughts in a line (*sigh*  :o My thoughts can be summarized in one line?!!!)

Pumaman

Quote from: Dowland on Sat 28/05/2005 19:05:33
... Brrrgg ... this code is ugly.

...ergo the reason why AGS is not open source :D

Dowland

I mean, it looks like C written in C# : scotch (or CJâ€"I didn't quite understand *who* wrote that bot) doesn't take advantage of any of the “features” of C# sturdy syntax and OO model. Where are the Events? the Delegates, the Properties (with Getter and Setter) ? where's the hierarchy (I mean, OK, the sink thing ... but it could've done so much better with delegates) ?

I wonder what AGS would be in C# ... probably much easier to maintain (for instance, the text script could be ipso facto implemented, thanks to the internal compiler classes).

SMF spam blocked by CleanTalk