Up to Main Index                              Up to Journal for June, 2012

                      JOURNAL FOR WEDNESDAY 20TH JUNE, 2012
______________________________________________________________________________

SUBJECT: Moving locations
   DATE: Wed Jun 20 21:53:46 BST 2012

Once again I'm finding myself changing the structure of packages in WolfMUD.

I know! I know! - It's just a prototype, get it out there already!

It's also supposed to be a solid platform to move forward with. The issue was
I had something like this:


  wolfmud.org
  `-- entities
      `-- location
          `-- location.go


Typically I've been using the following conventions:

  location.Interface - Location Interface
  location.Location  - Default Location type implementation
  location.New       - Creates a new *Location

This produced 'stutter' only on the type. Then I added the starting location
under the location package:

  startingLocation.Interface
  startingLocation.startingLocation
  startingLocation.New

Bleugh! :( So what to do? Well what I finally (currently) descided on was:


  wolfmud.org
  `-- entities
       `-- location
           |-- location.go
           |-- basic.go
           `-- start.go


Now I have:


  location.Interface - a location interface

  location.Basic     - Basic location type
  location.NewBasic  - Creates a new *Basic

  location.Start     - Starting location type
  location.NewStart  - Creates a new *Start


I think these read better than before? Then it's a case of cleanup and fixup
the documentation - again.

Still it's easier to make sweeping structural changes like this now than six
months down the road.

--
Diddymus
______________________________________________________________________________


SUBJECT: Tim Toady visits
   DATE: Wed Jun 20 22:13:31 BST 2012

Ouch! Argh! Bugger it...

I've just had a TMTOWTDI moment *sigh* - pronounced 'Tim Toady'[1]

I currently have a Broadcast interface that allows messages to be sent to a
group of Responders:

  type Broadcaster interface {
    Broadcast(omit []Responder, format string, any ...interface{})
  }

Currently it's implemented by:

  Location   - send messages to all players at a location
  PlayerList - send messages to all players
  Command    - shortcut for current Location

However I'm now wondering if this should actually be implemented as:

  func (list []messaging.Responder) Broadcast(format string, any ...interface{})

In other words should Broadcast be to a slice of Responders? Means we could
drop the omit slice and only put Responders we are interested in into the list
slice - hrm...

Now I'm going to have to work out the pros and cons to see which would give
the simplest and most elegant/natural solution.

--
Diddymus

  [1] It's a Perl thing - There's more than one way to do it
      https://en.wikipedia.org/wiki/TIMTOWTDI


  Up to Main Index                              Up to Journal for June, 2012