2004-07-13

C#

Started to develop a tiny application in C#, a console program. I did this because Delphi Personal edition doesn't seem to have any databased connectivity. Such is life. My experience with C# is ... null. C++ is also null. C however, I have programmed in extensively, both at University and then on one or two projects afterwards. Toxic. Everyone has been talking about .NET and C# and how much better it is.

I created a "Hello World" console app in nearly 0 time, so far so good.

And then I wanted to query an SQL database. Yes, I know this is not usually a task that people who are learning a new programming language would want to start out with but I had a specific task I wanted to do. Reading through the help was hit and miss, but if you hold the frustration and cursing of Microsoft you can uncover some excellent examples. I had some various SQL querying methods copy and pasted rather quickly.

What slowed me significantly was the structure of the language itself. Classes, methods, public private protected friend shadows ansi unicode auto static void lib alias ... what the ... fine. Once I had the function going I wanted to extract a single field from a table one row. It didn't help that the table designer told me it would either be 1 or 0 and I thought "int" when it was actually boolean/bit. So once I figured that out and wrapped my head around the poor type conversion of C#, I finally got the console program working. I am guessing you have to know to the binary level of the structure of each type from the various sources.

Nice little .exe file created down in the bowels of the "my documents" file structure which doesn't sound right - probably a better way of creating and locating the exe file.

I am then told it is to run on every machine in the login script. *sigh*. I don't think everyone will have the right .NET bits installed. I test on running on my machine, fine. I test running on the server, fine. I test running the copy on the server using a UNC path from my machine - FAIL! What!? Test all three again just to confirm this. So builds from C# aren't operable everywhere - just some weird error given and absolutely no explaination on how to fix the problem.

Screw that, I will use a combination of osql.exe and pipe the output to a console delphi program. 5 minutes - done, works on every computer. What is .NET good for then? Back end web page processing?

Not overly happy with C#. Expected better from the main guy on the Delphi team (who was the chief something or other in the whole .NET thing).

No comments: