Box2D is a 2D physics engine for games
Why is 600 lines too long? How are you able to make that judgment call without first knowing what the algorithm is even doing? People setting arbitrary limits like this is what leads to convoluted spaghetti, instead of just taking things on a case by case basis. Here’s a function from the Box2D code running a particularly complex algorithm for solving contact velocities https://github.com/erincatto/box2d/blob/411acc32eb6d4f2e96fc... .
It’s 310 lines long. It reads very well, and it looks very maintainable. It has very clear comments explaining the reasoning behind the harder parts of the code. Would you reject this code because it’s pretty long? I wouldn’t.
There is no such thing as too long or too short. There’s overengineered and there’s underengineered and there’s a sweet spot in the middle that has the perfect amount of engineering with the least amount of complexity (preferably no additional complexity than the original problem warranted). Sometimes, the problem at hand is inherently a large algorithm and requires many lines of code. Don’t split it up! It just makes it harder for future maintainers who now have to figure out if the additional functions are actually being used elsewhere or if they’re just there to make the code “pretty”.
Solving Advent of Code with jq
I realize this is tongue in cheek, but really: Read code!
If you ever start plateauing in your code skills, start digging into the code of your favorite open source project. Accept that things have been done in another way than you would for a reason and try to understand that reason.
Try joining advent of code, and make sure to spend half you time block on reading and understanding alternative solutions.
Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
mirror of git://git.tartarus.org/simon/putty.git, used for client testing
This function is 1830 lines long. It's reasonably well structured I think. Although the #if 0 are maybe not so good.
1 project | /r/datascience | 5 Dec 2023
Advent of Code - anyone partaking?
1 project | /r/PowerShell | 5 Dec 2023
The Advent Of Code challenge started
1 project | /r/PowerBI | 4 Dec 2023
Using __import__() for the same package multiple times within the same line of code?
2 projects | /r/learnpython | 4 Dec 2023
Advento do Código em Golang
1 project | /r/ProgramadoresBrasil | 4 Dec 2023