Jump to content
  • Advertisement
Sign in to follow this  
Khatharr

Running into problems while using new (to me) design patterns

This topic is 2171 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello.

I recently posted a project in the business forums and asked for a code review. I got a lot of good advice and I'm trying to recreate the project accordingly, but I'm running into some design problems and would like to ask for advice concerning this.

Specifically, I'm having trouble in the following areas (more detail in the readme in attached zip):

RAII - I think I may be designing RAII incorrectly or too aggressively. I'm ending up with a lot of RAII classes that seem like they're just doing the ctor/dtor work for the class already associated with managing the resource in question. I'd like to know if I'm doing this correctly.

PIMPL - I read about the PIMPL idiom, and since I'm exposing classes in a public interface I'm trying to apply it but I'm getting a slew of disturbing compiler warnings and a lot of really long pass-through stuff that's making it seem like a lot more trouble than it's worth. Is PIMPL really a good idea, or should I just abandon it?

Exception Propagation - While trying to prevent exceptions from crossing module boundaries I'm getting pinned against the wall by class constructors. I'd like to avoid using factory functions if possible. Is there a clean way of doing this?

Avoid Dynamic Allocation - I'm told that dynamic allocation is not preferred, so I'm trying to avoid it as much as possible, but the result of my efforts so far is tight vertical coupling of almost all my member objects. I think I may have misunderstood something, because the code I'm writing this way feels very brittle. I guess I'd like to ask when and why to avoid dynamic allocation. Is there a specific guideline I should use?


Attached is a zip file containing a DX9/VS2008 project and its dependencies. If anyone could glance over the code in the engine module and let me know if (where) I'm going wrong or offer any kind of advice I'd really appreciate it.

[attachment=10562:Regenesis.zip]

Thank you in advance for any response. smile.png

------------------------------------------------------------------
Just by way of update, I set aside my 'Bricks' project for a minute and started fiddling around with small projects and I've gotten a pretty good grasp on most of this stuff now. Edited by Khatharr

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!