Style/Structuring question: One vs. multiple global objects

Henning Hasemann hhasemann at web.de
Mon Jul 2 13:22:58 PDT 2007


Deewiant <deewiant.doesnotlike.spam at gmail.com> wrote:
> Henning Hasemann wrote:
> > Well the dependency-inversion thingy I found 
> > (http://www.objectmentor.com/resources/articles/dip.pdf) was really 
> > enlightning, maybe it helps you too. The basic idea is to misuse
> > interfaces to simulate some of the benefits of C++'s header files.
> 
> It incurs runtime penalties and makes the code too cluttered, IMHO.

How big are those penalties? What are the extra steps your machine has
to do when you compare acces through an interface with direct access to
an object?

> One thing I came up with was doing the "tile_and_entity.d" like so:
> 
> module tile_and_entity;
> 
> mixin(import(tile.d));
> mixin(import(entity.d));
> 
> Should work, but quite hacky.

Looks like a good idea for such situations with two modules that need
each other, but if I understand correctly that wouldnt be able to
handle all the things that DIP can, or?

Henning

-- 
GPG Public Key:
http://keyserver.ganneff.de:11371/pks/lookup?op=get&search=0xDDD6D36D41911851
Fingerprint: 344F 4072 F038 BB9E B35D  E6AB DDD6 D36D 4191 1851


More information about the Digitalmars-d-learn mailing list