Lately I have been writing a game engine, and I have been writing a lot of "foundation stuff" (standard interfaces, modules, a message system ect.), but I have noticed a pattern, a lot of the stuff is interdependent and I can not debug until everything is done, hence I do not debug for about 3 to 5 hours at a time. I am wondering if this is an acceptable practice for this part of the project, and if not, if anyone can give me some advice?

-----Update-----:

I downloaded some code metrics tools, and my programs cyclomatic complexity is 1.52 which as I understand it is good, and should correlate to high cohesion, if I am wrong please correct me/

有帮助吗?

解决方案

This is called coupling. You can reduce coupling by breaking everything into smaller pieces, which should increase the cohesion of each piece. It will make it easier and faster to develop and test each piece.

If you are developing something with dependencies on other pieces, try designing with Dependency Injection in mind. This should let you develop each piece individually, without needing to create all of its dependencies first.

其他提示

Stop. No really, stop. Stop and read about Test Driven Development.

The system you are implementing will have a difficult time being tested, debugged, maintained, updated, etc.

Take TDD to heart and spend the time now to understand how TDD can drive your design to a system that can be tested, debugged, and maintained.

TDD has changed the way that I develop.

许可以下: CC-BY-SA归因
scroll top