Stop Coding in C#

08/22/2011 00:23 Spirited#1
F# is better for what we want to do in a lot of different ways.
It's 10% - 15% faster to execute and it's easy to use Async with them.
You can also use C# libraries and .NET Framework.

[Only registered and activated users can see links. Click Here To Register...]

I'd upload my 10-minute F# project, but it doesn't do much.
I'm not going to work on it any longer either. College classes start tomorrow.

C++ is better but if you like C# and references, use F#.
Cyah.

Sincerely,
Fang
08/22/2011 00:37 PataxX#2
I don't even know CO2 but if you still depending on C# libaries and you'll use them in F# it wont be faster!
08/22/2011 00:41 Spirited#3
Quote:
Originally Posted by PataxX View Post
I don't even know CO2 but if you still depending on C# libaries and you'll use them in F# it wont be faster!
That's what I'm saying o.o
F# is faster. Thanks for the addition though because you're right.
C# libraries will be executed in the same way as regular C#.
08/22/2011 02:19 Korvacs#4
Beyond the improvements in parallel programming and async/similar systems the languages performance is near enough the same as C# only the syntax for it is awful, so chances are while you may be able to get improvements you wont be able to understand the code your trying to write anyway.

I looked at F# as a scripting language because apparently it can be used as one and a few people had suggested it and it is just a horrible language =/
08/22/2011 07:13 xBlackPlagu3x#5
Quote:
Originally Posted by Korvacs View Post
Beyond the improvements in parallel programming and async/similar systems the languages performance is near enough the same as C# only the syntax for it is awful, so chances are while you may be able to get improvements you wont be able to understand the code your trying to write anyway.

I looked at F# as a scripting language because apparently it can be used as one and a few people had suggested it and it is just a horrible language =/
Totally right about the syntax. If you can understand it however, you should use whatever makes shit faster, right? As long as it is stable and you know what you're doing. (If I could make a server out of sarcasm, I'd have the best server on the forum for example)
08/22/2011 07:16 BaussHacker#6
Quote:
Originally Posted by Korvacs View Post
Beyond the improvements in parallel programming and async/similar systems the languages performance is near enough the same as C# only the syntax for it is awful, so chances are while you may be able to get improvements you wont be able to understand the code your trying to write anyway.

I looked at F# as a scripting language because apparently it can be used as one and a few people had suggested it and it is just a horrible language =/
F# syntax looks so ugly.

Stop coding in F#.
The performance in C++ is much better.
See where I'm going?

Also OOP in F# is really crap:
[Only registered and activated users can see links. Click Here To Register...]

Also:
[Only registered and activated users can see links. Click Here To Register...]

As c# is procedural and F# is functional, hence the name F#.

"C# has some implicit conversions that F# cannot afford because of type inference."
^ I use implicit conversion a lot.
08/22/2011 12:14 -impulse-#7
Here's a nice idea, if u are really going to use F, use it only where its better than C# and import it into your solution. You are able to call from C# to F# and the other way around F# and C#. Apparently F# has better performance @ math. (I am not going to take this advice because I really don't like the syntax.)
08/23/2011 01:24 CptSky#8
Quote:
Originally Posted by -impulse- View Post
Here's a nice idea, if u are really going to use F, use it only where its better than C# and import it into your solution. You are able to call from C# to F# and the other way around F# and C#. Apparently F# has better performance @ math. (I am not going to take this advice because I really don't like the syntax.)
Yes, one advantage of .net is that you can use any language you want for your library and calling them. But for the faster thing. F# will produce a bytecode like C++/CLI or C#. I don't think it will produce something faster. Except if at the generation, F# will be more optimized than other language.

And yes, I agree, F# syntax is really ugly.
08/23/2011 02:11 Spirited#9
Yah, I'm thinking that I'm going to do major math in F# and import them into my C# source using libraries. I really don't like F#'s syntax at all.
08/23/2011 08:57 BaussHacker#10
Quote:
Originally Posted by Fаng View Post
Yah, I'm thinking that I'm going to do major math in F# and import them into my C# source using libraries. I really don't like F#'s syntax at all.
No no. Stop coding C#. I want to see you do a source in F#.
08/23/2011 09:02 Spirited#11
Quote:
Originally Posted by BaussHacker View Post
No no. Stop coding C#. I want to see you do a source in F#.
I don't think I can do an entire source in F# yet.
Plus, I'm starting C++ tomorrow.
.-.
08/23/2011 09:14 BaussHacker#12
Quote:
Originally Posted by Fаng View Post
I don't think I can do an entire source in F# yet.
Plus, I'm starting C++ tomorrow.
.-.
F# is really fucked, just look at the compiler source code. It's like lolwut.

And C++ is amazing :3

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Teach Yourself C++ In 21 Days
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...] (download)

Thinking in C++ vol1/vol2 (Get these only if you have some previous programming experience)
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Microsoft Visual C++ Beginners Guide
[Only registered and activated users can see links. Click Here To Register...]

Various C++ books:
[Only registered and activated users can see links. Click Here To Register...]

Videos:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

STL tutorial
[Only registered and activated users can see links. Click Here To Register...]

Microsoft Visual C++ .NET tutorial
[Only registered and activated users can see links. Click Here To Register...]

Windows compilers:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

(I strongly suggest Code::Blocks or DevC++.)

Linux compilers:
[Only registered and activated users can see links. Click Here To Register...]
08/23/2011 11:42 xBlackPlagu3x#13
Quote:
Originally Posted by BaussHacker View Post
F# is really fucked, just look at the compiler source code. It's like lolwut.

And C++ is amazing :3

[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Teach Yourself C++ In 21 Days
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...] (download)

Thinking in C++ vol1/vol2 (Get these only if you have some previous programming experience)
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

Microsoft Visual C++ Beginners Guide
[Only registered and activated users can see links. Click Here To Register...]

Various C++ books:
[Only registered and activated users can see links. Click Here To Register...]

Videos:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

STL tutorial
[Only registered and activated users can see links. Click Here To Register...]

Microsoft Visual C++ .NET tutorial
[Only registered and activated users can see links. Click Here To Register...]

Windows compilers:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

(I strongly suggest Code::Blocks or DevC++.)

Linux compilers:
[Only registered and activated users can see links. Click Here To Register...]
a7a, someone's a little happy huh? ^.^

I don't understand the logistics of C++ and why it's better, but not many will argue against that fact that it is better. (Except for some who say C is better) I personally find F#'s syntax like I find a pile of shit. Disgusting. Clean it up microsoft.
Let var program_langauges = enoughForOnce;

Like what I did there?
08/23/2011 11:57 BaussHacker#14
Quote:
Originally Posted by xBlackPlagu3x View Post
a7a, someone's a little happy huh? ^.^

I don't understand the logistics of C++ and why it's better, but not many will argue against that fact that it is better. (Except for some who say C is better) I personally find F#'s syntax like I find a pile of shit. Disgusting. Clean it up microsoft.
Let var program_langauges = enoughForOnce;

Like what I did there?
C++ can do almost anything C can and most C++ compilers compiler C perfect.
C++ was derrived from C. C does not support classes, but is struct-based, where C++ support both. Not too sure about C.

The performance in C++ is better than C#, because it's native and does not require any frameworks (Only if you use managed, which I don't recommend at anytime!). It can run on all OS's Windows, Linux, Mac etc. It has a huge library of a lot things + it can work with low level things, however C is better to work with, if you want to work with hardware. C++ is one of the main language in game developement, however Python has got a lot popular in game programming as well, games such as Battlefield is coded in Python and a lot other popular games. C++ is handling things much better, but it's also a harder language as well. I may not be 100% correct about what I say, but it's how I see the things. It doesn't matter much in private server development, because the performance may be 10% better or something, unless you really hard code the things. Those 10% are not something you really need here, because if you know what you do, then you can get a fine or almost as good performance in C#, but if you were serious about developing a game or whatever, then those 10% better performance can do a lot. C# is good for the reason you can develop something fast, where in C++ it will take much longer time, but once you get a grab around C++, then you will like it.
08/23/2011 13:35 unknownone#15
The stuff about F# being faster is really nonsensical - it compiles down to the same thing as C# (CIL) and runs on the same VM. The so-called performance gain is not some inherent property of the language - it's due to a shift in style of programming - one where you don't modify state.

The core concept of functional programming is that state is immutable. If you wish to modify a value, you don't, you instead call a function which returns the newer value. Even operations like adding an item to a list are immutable, so instead of mutating the list, you return a new list with the new element added. It might seem slow to do such thing, but there are numerous benefits to it. Mutable state is the devil and must be avoided, at whatever extra cost.

Well, not strictly true in F#, since it's mutli-paradigm and can use mutable structures you're familiar with in C#, and you *can* introduce mutable state into F# with the mutable keyword (although highly discouraged.)

There are reasons why F# syntax is the way it is, which is certainly alien to C# users. You do get used to it though, and at some point you'll not want to go back to C# - the syntax of F# is more compact, and you can do more in less.

As for the improved use of async in F#, that's largely true, although the next version of C# will have similar capabilities, which you can already try out with the [Only registered and activated users can see links. Click Here To Register...] - two new keywords, async and await, which add a lot of capability. The C# approach to this problem is a lot less flexible than the F# approach though - as async in F# is not a built in language feature, but an application of a more powerful feature, workflows. These can do a lot more than just async.

On using F# to write a server - someone has already mentioned that a mixed approach would be suitable. F# alone isn't really ideal for a game server, because a game server happens to be based on a huge collection of mutable state - something actively discouraged in F#. Although a message passing approach can be suitable for solving those problems (But then, there are better languages than F# for message passing.)

I would recommend every keen C# programmer also learns F# anyway, even if they don't intend to write complete applications in it.

Quote:
Originally Posted by BaussHacker View Post
C++ can do...
The problem with C++ is it's not type-safe, it only pretends to be. You can nuke the type safety anywhere. (Although the same is kind of true for C# with reflection.)

The other problems are lack of higher level features like lambdas, reflection, coroutines, and lack of a standard threading model. A lot of these features have been added and finalized, but the new specification is not yet published, and no compiler has fully implemented the new spec. You can get parts of the new version of C++ in MSVC++, GCC and Clang though.

And then comes the problem with libraries. There are many, but they are generally all incompatible with each other, or have some essential features missing. You end up juggling through many libraries to get exactly what you want. (And as for running on all platforms - that's a joke, due to the library situation). Actually C# is way easier to port between major platforms now, due to more consistent libraries.

To give a library example, take boost::asio for networking. It's been considered a defacto standard for async networking in C++ due to it's portability and ease to use. The problem? It uses boost::shared_ptr<>, which is incompatible with the now standardized (and massively improved) std::shared_ptr<>. Meaning, whenever you need boost, you can't use some standard library features which are incompatible.

I was trying to get back into C++ after years hiatus learning and using C#, but the number of problems just put me off. It's in an awkward state until the C++0x specification is implemented properly in compilers, and many libraries, particularly boost, shift to using the new smart pointers and other newer features of the standard library. Then there's the tooling - IDEs, debuggers, profilers etc need updating to work with the new language. If all that is done, the language will return to a state where it can compete with C# in terms of high level abstractions.

Oh, and as for Battlefield using Python - it only uses small amounts of it. The game engine will still be written in a low level language like C or C++, and languages like Python are only used to script some game logic, AI and such, which doesn't require intensive computation. Python is very slow compared to even C#, let alone C++, and you'd be lucky to get 1 frame per second of high quality 3d graphics in it alone.