Jump to page: 1 24  
Page
Thread overview
D vs. C#
Nov 23, 2006
Andrey Khropov
Nov 23, 2006
antonio
Nov 24, 2006
Ary Manzana
Nov 24, 2006
Bill Baxter
Nov 24, 2006
Chad J
Nov 24, 2006
Dave
Nov 24, 2006
Walter Bright
Nov 24, 2006
Ary Manzana
Nov 24, 2006
Dave
Nov 24, 2006
Serg Kovrov
Nov 25, 2006
antonio
Nov 26, 2006
Bill Baxter
Nov 26, 2006
Dave
Nov 26, 2006
Bill Baxter
Nov 27, 2006
JohnC
Nov 27, 2006
Antonio
Nov 26, 2006
Lars Ivar Igesund
Nov 24, 2006
Dave
Nov 24, 2006
Antonio
Nov 23, 2006
Hasan Aljudy
Nov 24, 2006
Hasan Aljudy
Nov 24, 2006
Marcio
Nov 24, 2006
John Reimer
Nov 25, 2006
Marcio
Nov 26, 2006
Daniel Keep
Nov 24, 2006
Dave
Nov 24, 2006
Samuel MV
November 23, 2006
I want to write an article about D. Therefore I want to show more details and advantages of D compared to C++, Java and C#. But I never used C#.

What are concrete things that are better in D or C#? Can you make examples?
November 23, 2006
Frank Benoit (keinfarbton) wrote:

> I want to write an article about D. Therefore I want to show more details and advantages of D compared to C++, Java and C#. But I never used C#.
> 
> What are concrete things that are better in D or C#? Can you make examples?

I think the biggest thing is that you have no metaprogramming support in C# (only type-parametrized classes and functions via generics) whereas you have templates in D.

Plus DbC and built-in unit testing.

Another good thing C# lacks is aliases (AFAIK only namespace aliases are supported) and strong typedefs.

Anyway there's a comparison page http://www.digitalmars.com/d/comparison.html

-- 
AKhropov
November 23, 2006
Frank Benoit (keinfarbton) wrote:
> I want to write an article about D. Therefore I want to show more
> details and advantages of D compared to C++, Java and C#. But I never
> used C#.
> 
> What are concrete things that are better in D or C#? Can you make examples?

best on c#

framework
documentation
debugger
Microsoft Integrated Developement Environment (IDE :-) )

Very good "guides" for framework extensibility (ex: connection with a different SGBD are very standardized...you can find really good implementations of ado.net for PostgreSQL, Firebird.  D Database access is ridiculous... because D has not a proposal for standard database connectivity )


D:
*has not an standard framework (has not the "rules" for a standard framework extensibility)
*documentation:  if you are not talking about D compiler, you have not really "massive" framework/libraries/extensions to document... and the ones you have are poorly documented (forums are the main "documentation" repository)
*not native debugger.
*Poor IDEs(syntax highlight and so on... nothing really ).


D weakness... is just the things you need to be productive:  No one want's to work in a unique framework... in a unique "path"... in a required D-Fundation: D people is more worried about Linux vs Windows than D productivity.



November 23, 2006
Andrey Khropov schrieb:
> I think the biggest thing is that you have no metaprogramming support in C# (only type-parametrized classes and functions via generics) whereas you have templates in D.
> 
> Plus DbC and built-in unit testing.
> 
> Another good thing C# lacks is aliases (AFAIK only namespace aliases are supported) and strong typedefs.
> 
> Anyway there's a comparison page http://www.digitalmars.com/d/comparison.html
> 

Thanks for your reply.
I am aware of the comparison table on digitalmars.com.

But I am very interested in more detailed points of view, because a simple YES/NO is not really sufficient for an article.

So, if you know C# or even C# 3.0 I appreciate to hear about your experience and opinions. With these I can go to mr. google and do a more specific and deeper investigation.

Your listed points are a good start for me, thanks again.
November 23, 2006
Antonio,
the points you listed are very good. Well "good" because I know nothing
about C#, and this is also true for the things around C# and Dot NET.
First time I hear about those "rules".

What do you think if you put the focus on the languages itself? Ignoring existing libs, IDEs ...



November 23, 2006

Frank Benoit (keinfarbton) wrote:
> I want to write an article about D. Therefore I want to show more
> details and advantages of D compared to C++, Java and C#. But I never
> used C#.
> 
> What are concrete things that are better in D or C#? Can you make examples?

I honestly think you cannot write an objective comparison if you don't have experience writing C# applications/programs.

I just wanna comment on what Andrey wrote as well:

Andrey Khropov wrote:
> Frank Benoit (keinfarbton) wrote:
> I think the biggest thing is that you have no metaprogramming support in C#
> (only type-parametrized classes and functions via generics) whereas you have
> templates in D.
>
> Plus DbC and built-in unit testing.
>
> Another good thing C# lacks is aliases (AFAIK only namespace aliases are
> supported) and strong typedefs.

Well, so what? Just because it doesn't have meta programming doesn't mean D is better than C#. Maybe it actually means the opposite.
I mean, you can't put that kind of thing in an article and hope that it will attract programmers to D.
One might even argue that having a unittest framework is better than a built-in unittest construct.
Same applies for aliases and string typedefs.
November 24, 2006
Frank Benoit (keinfarbton) escribió:
> Antonio,
> the points you listed are very good. Well "good" because I know nothing
> about C#, and this is also true for the things around C# and Dot NET.
> First time I hear about those "rules".
> 
> What do you think if you put the focus on the languages itself? Ignoring
> existing libs, IDEs ...

I think this days a language isn't just "the language", i.e.: the syntaxis and semantic.

Questions I want to ask to a language:
1. Does it have a great power of expresiveness?
2. Will I have to program all the *so common* classes like collections, io, network, etc., or instead of focusing on my problem I'll have to invent the wheel again?
3. Will I get my job done quickly?
4. Will my programs require some other annoying frameworks, virtual machines and on on the target machine?
5. Will my programs be fast?

My answers would be:
1. Yes, and I think it beats C#, although reflection is widely used nowadays, and D dosen't have this (I don't know if this is possible for a compiled-to-native language).
2. Well, you'll surely find some good libraries out there. But integration with other systems that use some other libraries will be very painful. And choosing a library is also some time you'll loose. If interfaces (like the ones in java.util) are defined in D, together with a good core library, everything should be easier to do. But I think interfaces are not that efficient in D... am I wrong? And yes, you'll feel that poor performance in your 2Ghz double core processor.
3. Not as quick as programming in C# or Java, because you don't have powerful IDEs, and point 2 is also a thing to consider.
4. No, and it's one of the things I like most of D: a great power of expressiveness compiled to native binaries.
5. Yes, very fast, and that's another point for D.

But, as far as I know, speed is not (that much) a concern, and everybody has a virtual machine, so...
November 24, 2006
Ary Manzana wrote:
> Frank Benoit (keinfarbton) escribió:
>> Antonio,
>> the points you listed are very good. Well "good" because I know nothing
>> about C#, and this is also true for the things around C# and Dot NET.
>> First time I hear about those "rules".
>>
>> What do you think if you put the focus on the languages itself? Ignoring
>> existing libs, IDEs ...
> 
> I think this days a language isn't just "the language", i.e.: the syntaxis and semantic.
> 
> Questions I want to ask to a language:
> 1. Does it have a great power of expresiveness?
> 2. Will I have to program all the *so common* classes like collections, io, network, etc., or instead of focusing on my problem I'll have to invent the wheel again?
> 3. Will I get my job done quickly?
> 4. Will my programs require some other annoying frameworks, virtual machines and on on the target machine?
> 5. Will my programs be fast?

6. Will my programs be portable?

> 
> My answers would be:
> 1. Yes, and I think it beats C#, although reflection is widely used nowadays, and D dosen't have this (I don't know if this is possible for a compiled-to-native language).
> 2. Well, you'll surely find some good libraries out there. But integration with other systems that use some other libraries will be very painful. And choosing a library is also some time you'll loose. If interfaces (like the ones in java.util) are defined in D, together with a good core library, everything should be easier to do. But I think interfaces are not that efficient in D... am I wrong? And yes, you'll feel that poor performance in your 2Ghz double core processor.
> 3. Not as quick as programming in C# or Java, because you don't have powerful IDEs, and point 2 is also a thing to consider.
> 4. No, and it's one of the things I like most of D: a great power of expressiveness compiled to native binaries.

Amen to that.  Java, C#, python etc may have great libraries, but you basically have to install the whole dang library collection on any machine that you intend to run your program on.  "Hey I've got this great little 10 line script"... kind of loses its cool factor when you have to install 50MB or more of other stuff just to use the script.

> 5. Yes, very fast, and that's another point for D.
> 
> But, as far as I know, speed is not (that much) a concern, and everybody has a virtual machine, so...

6.  D code is fairly portable between Windows/Linux/Mac, so with care, and judicious selection of external libraries, a recompile for the target machine is all that is needed.   Java has an embedded version.  D lacks any sort of embedded strategy right now, AFAIK.  Though it should be great for embedded stuff.


--bb
November 24, 2006
Andrey Khropov wrote:
> Frank Benoit (keinfarbton) wrote:
> 
>> I want to write an article about D. Therefore I want to show more
>> details and advantages of D compared to C++, Java and C#. But I never
>> used C#.
>>
>> What are concrete things that are better in D or C#? Can you make examples?
> 
> I think the biggest thing is that you have no metaprogramming support in C#
> (only type-parametrized classes and functions via generics) whereas you have
> templates in D.
> 
> Plus DbC and built-in unit testing.
> 
> Another good thing C# lacks is aliases (AFAIK only namespace aliases are
> supported) and strong typedefs.
> 
> Anyway there's a comparison page http://www.digitalmars.com/d/comparison.html
> 

Aliases are supported on C# 2.0 although a lot more limited than in D.

// Alias a namespace
using Utilities = System.Collections;

// Alias a class.
using List = System.Collections.ArrayList;

// Alias an instance of a generic class.
using IntegerList = System.Collections.Generic.List<int>;

That's about all you can make an alias for on C#.
November 24, 2006
Frank Benoit (keinfarbton) wrote:
> I want to write an article about D. Therefore I want to show more
> details and advantages of D compared to C++, Java and C#. But I never
> used C#.
> 
> What are concrete things that are better in D or C#? Can you make examples?

I'm just going to compare languages because a comparison between .NET's Base Class Library and Phobos isn't fair anyway. This isn't an exhaustive list, is just what I remembered at the moment.

D vs C# 2.0

Generics / templates are a lot more powerful in D. In C#, for a generic parameter you can only call methods defined on Object unless you tell the compiler that it will be of a predefined (base) class witch pretty much defeats the purpose of a generic class in most cases.

This limitation makes generics useful mostly for container types and impedes advanced meta-programming like what's available on D.

Properties in C# are declared explicitly using special syntax. D looks for methods with certain signatures to implement properties. Some people prefer one style over the other but the result is pretty much the same.

C# has partial classes witch allows split a class in several files. This can be handy, for example, for a code generator to safely modify a file while the user modifies another for the same class. D doesn't has any way of doing this.

Events are a native construct on C#. D recently got a standard library module that implements Signals & Slots witch is a similar concept but it's not in the language like in C#.

C# has anonymous delegates as does D but they managed to implement them as real closures so you can return them from a function. I use these a lot, they cut down work every where. In D returning a delegate or using it after the function ended is undefined and probably will get you an Access Violation.

D has lazy parameter evaluation where one or more parameters of a function aren't evaluated until they are needed. Very useful feature and one coming straight from functional languages. C# doesn't have this feature.

C# things that don't have an equivalent in D.
* Syntax for nullable types.
* Operator ?? for null testing.
* yield operator

D things that don't have an equivalent in C#.
* Tupples.
* Unions.
* Mixins.
* DBC.
* Inline Assembler.

D vs C# 3.0

Release date for C# 3.0 hasn't been announced yet. Walter announced a 1.0 version for January 1 of 2007.

Extension methods in C# will allow you to add new methods for any type. So, if you want the String class to have a method that converts to camel convention you can add it and call it like s1.ToCamelCase(). D supports something like extension methods but only for arrays of any type, just declare a function with a parameter of the type you want to extend.

Lambda expression are supported in both languages although the C# syntax is a little better.

In C# 3.0 we will have Query Expressions. These are a kind of run-time syntax tree of any code block you declare as a query expression and pass it around to methods, serialize it or compile and execute it. If you've programmed in Lisp, you'll recognize this. In D... Not yet but we are getting there with Tupples. Je je.

Language integrated query (LINQ) witch more or less is SQL integrated in the language. In C# 3.0 it is implemented as syntax-tree transformations to the features described before. Cool stuff. Nothing like this in D has been discussed.

As far as I know, generics weren't improved much on C# 3.0 so D still beats C#s a** on this.

Hope this helps.

--
Julio César Carrascal Urquijo
« First   ‹ Prev
1 2 3 4