Refactoring Farseer

Coordinator
Aug 22, 2008 at 4:49 PM
@Crashlander (if you are still alive :) )

I've been looking at the farseer source code and I see a lot of unused variables, unlogical code, small duplicates and so on. The pleasure of open source is that the community can have a look at the code, learn from it and improve it.

As a favor to your contribution, I would like to have a go with the source code and clean it up.
I have a lot of tools that I've build to help me accomplish this, so it will be done in a uniform way.

If I get your approval, I have one question to ask:
Would you like to preserve your current source code formatting?
Alternatives are:
Build in VS2008 source formatting (curly brackets on new lines, etc)
Lance Hunt's C# coding standard (This is the one I've always been using) Download specification

I do have a change that i thing should be applied to Farseer source code. private members of classes should be named with some kind of prefix. (I use _ and camelCase from Lance Hunt) This prevents the confusion of a private field instead of a parameter in a method. I have an example here:

private int number = 5; //bad, should use prefix; _number = 5;

public void Hello(int number)
{
Console.WriteLine(number.ToString());
}

Also, if you wanted to change something in the source code formatting since you first build Farseer, but never got the time. Please tell me and I will incorporate it.
Developer
Aug 22, 2008 at 11:50 PM
That sounds like a great idea. I'd be willing to help. I'd also like to see possibly some different integrators. I believe farseer uses Euler's method. I'd like to see a Midpoint method and possibly a Runge-Kutta method although that seems a little to accurate.
Coordinator
Aug 23, 2008 at 11:16 AM
@genbox

Yep, still alive. :-)

I think this would be great as long as anything that is introduced works accross all the platforms: Silverlight, xna, and plain old .Net 3.5

For now I'd like to stick with just syntax and code clean-up.

As soon as I get the changes back from dp2208, I'll send you the source and you can scrub it to squeaky clean shine!

I'll try to keep an eye on the forum a bit closer.  I'm nearing completion of my game so I've been focused on it lately.

-Jeff

Coordinator
Aug 23, 2008 at 11:19 AM
I just noticed there is an RSS feed for the discussions now. That should make it easier to keep up.  

I still won't be able to answer everything but at least I can try to get to the ones that involve source changes.
Coordinator
Aug 23, 2008 at 6:33 PM
@mattbettcher - Refactoring does nothing to the implementation of the code. This makes sure that nothing is broken and it does not create bugs.
If you have any new features to Farseer or implementations that improves the current state, such as optimized algorithms, I think you should try implement them in the most current release and keep us posted on your progress.

I would be very happy to have a look on what you might come up with.

@crashlander - Good to see that you are still alive :) We all love to have you around.
As I said to matt, refactoring should not break any implementations and it should still work on all platforms.

Might I suggest that for example the XNA release of the code does not contain files such as Vector2.cs and others? This will be much more easy to maintain when it's implemented correctly in source control. I will compile a list of things that could / should be changed and send it to you before changing anything.

Just waiting for dp2208 to have his birthday and release the changed code for farseer. :)
Developer
Aug 24, 2008 at 2:21 PM
I apologize genbox. Can't wait to play with clean code.


Coordinator
Aug 24, 2008 at 2:24 PM
Don't apologize. I hope you had fun at your birthday.

I'm in the progress of splitting the code up into the diffrent platforms. A lot of work is being done. Thanks for the code again.