C# – How do programmers deal with low level software development in high level languages

assemblyclow-levelsystemsystems-programming

I am somewhat new to programming and the best way I can ask this question is with an example.

I know how to do basic things in Java and C#. Things like a small windows forms application or make a generic class. I've basically been learning and haven't tried to do anything big yet. Anyways, I've always been curious about how things are done "under the hood" I guess you could say.

I know it all gets boiled down to 1s and 0s and that assembly languages basically give commands to patterns of 1s and 0s, but its seems like there's this jump from there to: use a library for this a library for that. It seems to me like all C# can do without a library is arithmetic and binary logic. To get input or output, you use libraries, etc…

I know this question probably seems obvious to some and I know that I have a lot to learn but I don't even know where to begin with a question like this. Thank you.

So my question is this:

If someone were going to make a
virtual machine or a Playstation
emulator, or an operation system, or a
driver, or add mp3 support to a media
player, or make your own file type,
etc… How? I can't see the way that
would be done with C# or Java.

In other words, if I read a book like Professional C# by WROX or Programming C# by OReilly, would I know how to do these things? Or do you have to learn assembly language or something more low level like C++?

Best Answer

Interesting question! You'll find that languages like Java and C# do in fact support fairly low level programming. For example look at some of the I/O source code in the OpenJDK for Java. You'll see that the higher level methods are implemented with lower level socket technologies, byte arrays and bit twiddling.

With regards to C# and Java, those languages compile down to bytecode, which gets eecuted on a virtual machine. You can actually quite happily view and learn from the bytecode (e.g. Seeing how Java deals with concatenating String objects).

If the environment you are developing in does not host one of these higher level VMs (often due to space and performance requirements), then you need to use a 'lower level' language.

I believe that C/C++ still rules the roost in the area of writing low level drivers etc as you can tweak the memory management and the data structures to the nth degree.

Assembly is pretty specialised these days, it's good to take at least a quick course in it to appreciate what happens at that level. When you write some Assembly to back fill a register while it's emptying, you start to appreciate the sorts of lengths that each programming language layer has to go to.

HTH