If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Design issue (loose vs strong coupling)

I have a function, but not a method, that is used to generate skinned meshes from it.
The object that is calling it will grasp a copy of this skinnedmesh from the out parameter,
which is not likely to be desired in today's software engineering practice.
But It is not very logical to encapsulate that function into that class since I want that generated skinned mesh
to be transient. Therefore, I need to pass more parameters to it, which increases the coupling.
Anyways, on a conceptual level, how can I improve this design?
Thanks
Jack

Re: Design issue (loose vs strong coupling)

I don't see why you would complicate the design in that manner. Why not just expose GenerateSkinnedMesh(Device*, SkinnedMesh*)? Free the memory as soon as you don't require the mesh anymore, if you desire transient existence of the object.

Best Regards,

BioPhysEngrhttp://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Re: Design issue (loose vs strong coupling)

I meant to say, why not just allow that method (which returns a pointer to a SkinnedMesh as an out parameter) to be directly called? You seem to want to avoid out parameters, but there is not a compelling reason to avoid them (other than perhaps they are not fashionable - which I am not sure is even true). I think it is best to use a more simple and logical design, without complicating it with another layer of encapsulation.

Best Regards,

BioPhysEngrhttp://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Re: Design issue (loose vs strong coupling)

Hi BioPhysEngr,
One mo question for you, so now I have a certain thingy known as the skinning method, this object is specific to certain mesh. So it should be encapsulated into a class. But as GenerateSkinnedMesh is a function, it isn't capable to encapsulate anything. Don't you think I should wrap this function inside a class? I think and re-think, and I gradually believe this "function" should belong to a class.
Thanks
Jack