Rotghroth Rhapsody Prince of Kitties Posted May 3, 2013 Share Posted May 3, 2013 Last night I made another experimental attempt to start a CBoE Java port. I began with the PC headers, creating a PlayerCharacter class based on the existing PC class and filling in a bunch of empty methods. Then I created an interface for holding the numerous constants... After which I started filling in methods, basing my code on what I saw in the relevant C++ source file. I got about halfway through the "kill" method before I realized I was doing something dreadfully wrong. Shortly thereafter I gave up. Clearly I was not using the right approach. The code base is pretty dreadful to look at, and perhaps Java was not a good choice of language for the job; but it seems to me I could do better than this... Does anyone here have experience with porting large programs from one language/paradigm to another? With refactoring big projects? What kind of techniques are usually involved? A top-down copy based on the existing program's data structures is not a good way to do this, I take it? Quote Link to comment Share on other sites More sharing options...
Easygoing Eyebeast keira Posted May 3, 2013 Share Posted May 3, 2013 Well, given the many numerous Bad Things happening in the code, it would definitely be prudent to remove some of said things while porting, rather than just rewriting the same things, but in a different language. Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody Prince of Kitties Posted May 3, 2013 Author Share Posted May 3, 2013 Well, given the many numerous Bad Things happening in the code, it would definitely be prudent to remove some of said things while porting, rather than just rewriting the same things, but in a different language. I did try to do some of that, though clearly not enough... It seems to me that part of the problem is that the code needs a top-down redesign, which I don't think I have time or the know-how to pull off at the moment. Edit: gods though, I think this code is hurting my sanity. I mean typedef char Boolean; seriously? Quote Link to comment Share on other sites More sharing options...
Hatchling Cockatrice Randomizer Posted May 3, 2013 Share Posted May 3, 2013 Jeff has said elsewhere that he isn't a great programmer so he recycles code and documentation even when there are problems with them. It took him several games to fix the pathfinding algorithm. Quote Link to comment Share on other sites More sharing options...
Rotghroth Rhapsody Prince of Kitties Posted May 3, 2013 Author Share Posted May 3, 2013 Umm yeah, apologies to Jeff there; I realize this is very old code. I'm just used to seeing bitflags used for anything boolean in C/C++. (See for instance the Angband code base.) Quote Link to comment Share on other sites More sharing options...
Understated Ur-Drakon Celtic Minstrel Posted May 15, 2013 Share Posted May 15, 2013 typedef char Boolean; seriously? This is actually standard C practice. Or at least, it was standard C practice before a real boolean type was added to the language in C99. At least it wasn't "typedef int Boolean;". The BoE code does also use bitflags in some places. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.