Home » MODDING HQ 1.13 » v1.13 Coding Talk » (More) questions regarding coding style and cosmetic changes
(More) questions regarding coding style and cosmetic changes[message #317364] Fri, 12 April 2013 16:41 Go to next message
feynman

 
Messages:38
Registered:October 2010
Hello coders,

I've got some more questions regarding coding style (-modifications).

As I'm currently in the process of designing a new AI architecture, I'm familiarising myself with what seems to become the larger part of the source code. And in doing so, I've noticed some code properties I dislike, but before 'fixing' them, I'd like to ask if that's OK...

- The indention a mess. I have set my editor (vim) to re-indent all files I open automatically for this project. While reading them, it would be no big trouble to adjust the auto-indent where needed (which is seldom enough, at least line breaks are inserted consistently), and save the result. I for one think that this would increase the readability quite a bit.

- A lot of source code is commented out, via comments or #if 0 directives. This "old" (?!) code is available via svn, so why keep it in the source, too? (There are situations where it is useful, I agree. But in most of the cases that doesn't seem to be true here). Again, for the files/functions I have to understand anyways I volunteer to throw that stuff out, if it is OK with you... (otherwise I'll see what I can do to fold it away in my editor)

- Same goes for empty line. Sometimes they are good to add structure. But some functions have more empty lines than ones with statements. That isn't helping. Again: do I commit changes I make on my local copy in order to improve readability, or is that intended? (Fun fact: of 994714 lines in .cpp and .h files in the svn sources, 152161 are blank lines, which is just above 15%)

- Comments are somewhat "un-standardized". I just ran doxygen over the files, and noticed that the networking coders used it (thumbs up!). I'm going to use it for the AI as well; is there any chance to put the documentation on-line (~100MB)? And if so, update it automatically on svn commits? (If the svn runs on a *nix machine we can access, I can contribute a buildbot configuration performing said updates)

Of course, all the above isn't something I'd work on actively, but I might as well commit what I adjust anyways. Eventually, the code could be lifted to a new maturity level.
Re: (More) questions regarding coding style and cosmetic changes[message #317365] Fri, 12 April 2013 18:07 Go to previous message
tais

 
Messages:807
Registered:February 2008
Location: NL
Hi,

you're free to change whatever you like to the code but there's a few things you should keep in mind,

- Yup, the code is a mess if you look at the indentation and white lines, the original code was already a mess afaik and working with lots of people on a project where you havent set any standards will not make it any better.
- When you do start cleaning up stuff, dont do that in one big bang please
- I'm pro cleaning out commented old code, it's only extra weight and like said it'll still be available in SVN
- lol... comments.. there was something about that...


Previous Topic: STOMP ( v1.2 )
Next Topic: Tactical AI: architectural redesign
Goto Forum:
  


Current Time: Sat Aug 18 15:48:12 EEST 2018

Total time taken to generate the page: 0.00979 seconds