Code center > Darwinbots Program Source Code

DB ports

(1/3) > >>

jknilinux:
Hey everyone,

I once heard there was a Cpp port of DB2... Is this true? Are there other ports? Why hasn't this become the main DB2 program?

Peter:
I believe it failed.

jknilinux:
oh... Also, how hard is it to port a C# program to another language, like java? Is there some sort of automated converter available for anything?

Numsgil:
There was a C++ port (far more a straight port than DB3 is).  It was mostly finished (feature complete for the most part, but really buggy), but I abandoned it after realizing that I had inherited lots of the problems from the VB source, so the port wasn't really worth the effort.  That was early to mid 2006.  I then played around with .NET to get used to it (wrote the DNA system late 2007, for instance), and played around with a physics engine attempt in C++, before starting the current DB3 effort in earnest in early July 2008 (4th of July weekend).

The C++ code still exists.  You can browse it here, but it's a weird hybrid between the VB source and some new inventions.  I think you had worked a bit on the code, jknilinux, right?  It's been a few years so I don't quite remember.  Basically I had not really thought about architecture when I started the C++ source, and I was a pretty green programmer in general.  The current C# source for DB3 is built with more best practices in mind.  It's unit tested, strictly modularized, and I'm especially careful to favor readability, maintainability, and big O over "performance" and low level optimizations.

All .NET code from one language can be converted to any other .NET language, as long as the languages in question implement the entire .NET feature set.  C# doesn't quite implement all of it, but I think it does most of it.  So if there's a Java compiler that compiles to CIL, there's probably something there to convert the C# code to Java.  From a practical standpoint, the C# language and Java are all but identical, but they target different runtime libraries.  This guide might be helpful.  It's far easier to approach C# from Java than from C++.  Most of the learning curve is learning the .NET libraries, not the language.  You can think of C# as Java targetting Microsoft's .NET libraries.  I think that's basically how the language started.  There are some new features in C# from about 3.0 onward that have no analog in Java (LINQ, Lambda expressions, dynamic typing, var, to name a few), but for the most part it would feel very familiar to a Java programmer.

Also, because the code targets the .NET platform, the different modules don't have to be in the same language, even.  There's not extra overhead to interface VB.NET code and C# code, for instance.  Although for consistency (and the ability to target the XBox through XNA) I'll probably insist that core modules be written in C#.  But side modules (graphics, different DNA languages, etc.)  could easily be written in different .NET languages.

jknilinux:
Sorry to keep bringing this up, but would running the java version on unix be faster? I think that in order to evolve interesting behaviors, we may need to run an order of magnitude more cycles than even the longest-running DB sims we've made. So speed is my main concern.

Also, isn't there such a thing as an optimizer for C# code? Could we use that?

And finally, can we convert it into a really low level language, like C, easily?

Navigation

[0] Message Index

[#] Next page

Go to full version