Sign in to follow this  
Khatharr

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

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. [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

------------------------------------------------------------------
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this