Jump to content

  • Log In with Google      Sign In   
  • Create Account

TorbenC

Member Since 22 Jun 2013
Offline Last Active Oct 21 2014 09:05 PM

Topics I've Started

Managing Decoupling Series - Questions on Part 1

09 May 2014 - 08:33 PM

Hello, I have recently begun re-reading the Managing Decouplingseries on Gamedev and after finishing part 1, I found myself stuck with a couple of questions.

 

1) The author mentioned that things such as RTTI/reflection systems, serialization systems and more importantly reference counting systems, are bad because they force upon the code a "global system" that all systems must abide by. This makes perfect sense, however later in the article the author mentions his use of IDs to refer to external objects.

 

This is great, however does this not apply the same "global system" that reference counting would? I imagine that all systems that contain resources would need to allow access, the only difference I see is that reference counting isn't done and it gives systems the ability to completely control all resources they govern. This is great, but how can the author support the argument that this does not offer a "global system" of sorts?

 

All systems that contain resources support some way to access them (in the use cases he is citing imo) and considering the programmer doesn't use the same type for each one, how would reference counting apply any more of a "global system" to these systems than this ID without ref counting method?

 

I just don't see the difference between the two other than one gives the system complete control over the resources it governs (big benefit).

 

2) I understand the benefit that this ID system allows the systems to govern their resources without hassle of reference counting and having to worry about references accessing the wrong resources upon moving... however.

 

Reference counting has a massive benefit in that it allows constant access speed and minimal memory consumption as far as I'm aware. But with this, you would pass an ID which would allow the constant access speed, but then you have to use the unique identifier to make sure the system didn't screw with the index you entered and change the resource. At which point if it has, you must find the new index or reload the resource, otherwise you get the resource.

 

But with reference counting, sure there is less control over the system itself, (considering the indexes aren't an array of pointers) but you don't have to worry about taking extra time to worry about the unique ID comparison and possibly having to search all for the new index, etc.

 

Can someone explain the advantages of this ID system over the ID + reference counting system?

 

 

-----------------

 

I hope I explained this all properly, if I didn't please let me know so I can re-tool this post. Thank you in advance.


PARTNERS