[cap-talk] Confessions of a C programmer

Ben Kloosterman bklooste at gmail.com
Mon Sep 21 02:31:09 PDT 2009


Wrote ASM/C/C++ for 10 years finally made the break 8-9 years ago moved to
C# and I write user apps in half the time and they run faster ( as I easily
profile them and implement better collections and multi threading than I did
with C). With C I was always cutting to make a deadline , what I find with
C# is I need to stop myself exploring new ways  of doing things ( nTier ,
IOC ,TDD ,WPF ,WCF , LINQ etc) to stay efficient it's hard to stay with the
basics but learning all those things wastes so much time.    Honestly when I
write C now im scared even with ref counting/GC libs just so many ways you
can stuff things sup .

Sing# and F# intrigue me. 

>Familarity - I learn languages slowly, and time spent learning a new
>one
> needs to be justified.

It takes years being comfortable in a new language there is no way around it
so it's a big commitment. At least C# and Java are pretty easy as the
language is almost a simple subset , learning the libs/framework is the
pain. Some are huge.  At the moment nearly all device drivers and OS are
written in C/C++ , CLR and Java are written in C++ , for the rest most
application development is going type safe/"managed" whether its Java , Net
, Perl or Python.  Only you can make the call whether it's worth the time
investment.


>  Reliability - I don't want to spend time debugging the compiler and I
>  really don't want to debug a code generator which changes the semantics
>  of my program.

This is not a major issue with .NET I have never heard of a compiler issue
on any team in the last 8 years of .NET . It was an issue with C++ . If your
working on type safe OS then you are at the bleeding edge.

>
>  Minimal environment - The compiler and runtime should not depend on
>  anything but the non-privileged architecture of the hardware platform.
>  All privileged instructions/system calls should come from library
>  routines[1].

Singularity showed how you do this by using new libs the language needs very
little, Cosmos does it via plugging Mono ( there is a lot to discuss which I
won't go into) . 

>
>  Library routines for required subsystems - I needed a SSL/TLS
>  implementation and ended up using OpenSSL, which is written in C. Being
>  able to call C programs would cover a lot of this requirement.

All Windows C# code ends up calling c programs using pinvokes , this is
especially common on handhelds.  This is most of the 10% performance cost
you pay. 
You don't need to use any file system and use you pinvoke calls to call a c
file system. 

>  Support for the target platform(s).

I did quite a bit of C# work for ARM. Have also run Java on ARM.

Away from Windows platforms you have to rely more on open source eg for Mono
you install the Mono environment and can use the AOT( Ahead of Time) non JIT
compiler. 

Regards, 

Ben 



More information about the cap-talk mailing list