Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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/

share|improve this question
1  
How interdependant? Can you mock/stub out the other part so that you are able to test just one part? You sound like you have very tight coupling which can be a bad thing. –  MichaelT Jun 25 '13 at 17:07
1  
Is it an acceptable practice to whom? I'm fine with it. If it takes you 3 hours, it takes you 3 hours. You're probably saving time not going back and forth between development and debugging. –  GrandmasterB Jun 25 '13 at 17:16
    
@MichaelT It is sort of like (example): The engine class is composed of instances of the module class and is pretty much meant to handle them. But both the engine class and the module base class require interfaces and stuff from the "core" (utility stuff). Or another example: I have a "message" class and a "mailbox" base class and I need some sort of management system to test them properly. –  The Floating Brain Jun 25 '13 at 17:23
    
You don't need "some sort of management system to test them properly". What does the mailbox class do? If it interacts with another class, you can mock the other class and verify that the mailbox works as designed, before you have any implementation of the other class. –  kevin cline Jun 25 '13 at 21:02
    
@kevincline True. :-) –  The Floating Brain Jun 25 '13 at 23:09

2 Answers 2

up vote 8 down vote accepted

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.

share|improve this answer
    
Thanks! I was a tad worried about the cohesion of my engine, but I did not know how to deal with it. –  The Floating Brain Jun 25 '13 at 17:24
2  
Unit testing, especially with TDD, can help with the coupling and allow you to test much more rapidly. –  Allan Jun 25 '13 at 20:05

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.