codingben / box2d-netstandard

C# port of Box2D - Erin Catto's 2D Physics Engine
https://box2d.org
MIT License
271 stars 53 forks source link

Improved code readability #20

Closed codingben closed 4 years ago

codingben commented 4 years ago

@HughPH This branch is not yet ready to merge. We have multiple folders with many script files, what do you think is the best way to do this? (In terms of PR and commits, let's say 10 files per commit, etc)

I haven't changed the logic of the code or anything similar, which can lead to bugs. Code formatting only.

HughPH commented 4 years ago

If you don't want it to be merged, you can "Convert to draft" at the top of the column on the right.

I think the number of files depends on what changes have been made. If it's code style, it will often affect a large number of files. If it's a logic change, it might only affect a few files - depending on what the change is. If we decided to change the namespace, it would affect all .cs files. If we decided to put a using statement in to alias System.Numerics.Vector2 as b2Vec2, to simplify porting, it would affect a significant number of files.

The problem with arbitrary rules is that people will bend them in strange and unforeseeable ways to adhere to them. For example, if we had a large team and made a decree that no PR should have more than 10 files, people would find ways to get their changes into 10 files at the expense of code quality.

The most valuable thing for the PR process is unit test coverage. If all the tests pass, you know the code works, so your review can focus on coding style and the quality of unit tests.

codingben commented 4 years ago

Looks fine. Do you use Resharper? That has autoformatting options which will be saved with the project, preserving formatting when others make changes.

I'm using Visual Studio Code and C# extension. When I click CTRL+S it works magic. And the same thing with Rust extension (When I develop with rustlang).

I don't see a way to do something similar to ReSharper (the reason is you need to install ReSharper).

C# Extension - https://github.com/OmniSharp/omnisharp-vscode

codingben commented 4 years ago

@HughPH Done.

HughPH commented 4 years ago

Why use VS Code when Visual Studio Community Edition is free? :)

codingben commented 4 years ago

Why use VS Code when Visual Studio Community Edition is free? :)

I've been using "Visual Studio Community Edition" since 2012, it's time to move on. :)

I'm using VS Code since April and it seems much faster and easier to use, it also has a git console built in and supports other languages (like rust extensions) - all in one package.

It's also very quick to install VS Code on your computer. I have an extension called "Sync Settings" that contains all of your settings and extensions in your GitHub profile.

There are also many great other extensions - and the C# extension, which is great, for me it replaced ReSharper.