Jon said:
I'm outlining a chapter on choosing between Delphi and C# for .NET
programming.
I know why I prefer C# over Delphi ;-) but would love to hear from
other ex-Delphi programmers.
Here's an example:
C1 void Foo()
C2 {
C3 int i = Bar();
C4 if (i != MagicNumber) {
C5 ProcessNonMagicNumber(i);
C6 }
C7 }
D1 procedure Foo;
D2 var
D3 i: Integer;
D4 begin
D5 i = Bar;
D6 if i <> MagicNumber then
D7 ProcessNonMagicNumber(i);
D8 end;
Just off the top of my head, looking at fundamental syntax, I prefer:
- Delphi's 'procedure' keyword (D1) to a 'void' return type (C1);
- C#'s braces (C2) as opposed to Delphi's 'begin'...'end' pair (D4);
- C#'s variable declaration syntax (C3), and the fact that declarations
and assignments can take place on a single line;
- the fact that C# method calls allow parentheses even when the
method doesn't have arguments (C3 - D5);
- the fact that 'if' constructs in delphi doesn't require parantheses
for the condition (D6 - C4);
- Delphi's '<>' operator (D6) to C#'s '!=' operator (C4).
- Delphi's assignment operator - ':=' - to C#'s - '=';
- Delphi's implicit 'result' variable, as opposed to C#'s 'return'
construct; and
- the fact that Delphi code just seams to be easier on the eye.
I still can't decide which language I prefer overall