Here, in the Comments to a
Dave Buck posting Darren Oakley sings the praises of statically typed languages such as C#. I wont waste time rebutting his assertion that
... that protection makes programming EASIER because your program works. First time and every time. You don't have to spend weeks debugging.
because that's nonsense and anyone who's done any programming at all knows it's nonsense. But I will rebut his assertion that statically typed languages make life easier. If I want to print a set of invoices in
Smalltalk I can write the following code...
#(Invoice1, Invoice2, Invoice3)
do: [ :invoive | invoice print]
To do the same thing in C# I have to write...
foreach(Invoice i in MyArrayListOfInvoices)
{
Invoice inv = i as Invoice;
Invoice.Print();
}
In the C# example I have to add the cast, an extra step which has no baring on the logical solution, it's just there to satisfy the compiler. How is that easier? It's not just when handling dynamic collections either, one of my all time favourite wastes of time, is having to cast the return from sql output parameters, (as in the code below), as the values are always of type object!
//...
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
_Id = (int)cmd.Parameters[0].Value;
_OLToken = (byte[])cmd.Parameters[1].Value;
}