From: Hubert <herrdoktor@fumanchu.com>
Subject: Re: What is your opinion on Global Objects?
Date: Wed, 19 Nov 2014 01:13:17 -0800
Date: 2014-11-19T01:13:17-08:00 [thread overview]
Message-ID: <QaZaw.72298$Ft2.63224@fx27.iad> (raw)
In-Reply-To: <m4h19j$l1v$1@dont-email.me>
On 11/18/2014 19:03 PM, Jeffrey Carter wrote:
> On 11/18/2014 07:50 PM, Hubert wrote:
>> That basically is a vote for global objects. Whether they are accessed through a
>> global variable or some sort of getter function that returns access
>
> Most of us on here are talking about how to do it in Ada. However you do it in
> C++ will be different, because C++ lacks modules. In Ada, there would be no
> functions that return access.
>
> At some point you have some requirements for your game, and somewhere in them is
> something along the lines of "the game will keep track of this, that, and the
> other".
>
> In the design you make from these reqs you decide to meet this req with a DB
> object. It allows you to add new (Key, Value) pairs, update the value for a key,
> retrieve the value for a key, and delete the pair for a key.
>
> In the Ada implementation, you implement this object as a package:
>
> package Game.DB is
> procedure Add (Key : in Key_Value; Value : in Data_Value);
>
> procedure Update (Key : in Key_Value; Value : in Data_Value);
>
> function Value (Key : in Key_Value) return Data_Value;
>
> procedure Delete (Key : in Key_Value);
> end Game.DB;
>
> [I'm sure the reality is more complicated. No doubt there are many different
> kinds of (Key, Value) pairs.]
>
> This pkg would be part of a low-level layer in your S/W architecture. Anything
> in higher layers that needs to access the DB can with the pkg and call its
> subprograms.
>
> This is the "Package as Object" pattern in Ada.
>
Ok this is still an access of the global object directly from a
subprogram. The subprogram then accesses the variable with the data
ijnternally which is the same as accessing a global object. The data
object itself is not passed through the parameters of the subprogram
that uses it.
Sounds like most people are in favor of that method
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
next prev parent reply other threads:[~2014-11-19 9:13 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 1:36 What is your opinion on Global Objects? Hubert
2014-11-18 2:52 ` Jeffrey Carter
2014-11-18 3:08 ` Hubert
2014-11-18 3:16 ` Shark8
2014-11-18 5:09 ` Jeffrey Carter
2014-11-18 11:23 ` Brian Drummond
2014-11-19 2:50 ` Hubert
2014-11-19 3:03 ` Jeffrey Carter
2014-11-19 9:13 ` Hubert [this message]
2014-11-19 10:22 ` J-P. Rosen
2014-11-19 17:37 ` Jeffrey Carter
2014-11-20 16:34 ` Stephen Leake
2014-11-20 21:11 ` Adam Beneschan
2014-11-21 15:25 ` Stephen Leake
2014-11-21 21:53 ` Randy Brukardt
2014-11-21 1:25 ` Hubert
2014-11-21 3:00 ` Brad Moore
2014-11-19 10:11 ` Jacob Sparre Andersen
2014-11-20 6:21 ` Hubert
2014-11-18 8:54 ` Dmitry A. Kazakov
2014-11-20 20:33 ` sbelmont700
2014-11-20 21:35 ` J-P. Rosen
2014-11-21 1:02 ` sbelmont700
2014-11-21 1:31 ` Hubert
2014-11-21 9:01 ` Dmitry A. Kazakov
2014-11-22 7:46 ` J-P. Rosen
2014-11-22 9:02 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox