Fwd: Steve Yegge Article About Property/Prototype Design Pattern

18 views
Skip to first unread message

Nathan Forget

unread,
Oct 24, 2008, 1:02:01 PM10/24/08
to misinformed...@googlegroups.com
On Gourlay's advice, I am forwarding this email to the Cognoscenti.

/**
 Nathan Forget
 nathan...@gmail.com
 nfo...@360ed.com
*/


---------- Forwarded message ----------
From: Nathan Forget <nfo...@360ed.com>
Date: Mon, Oct 20, 2008 at 12:07 PM
Subject: Steve Yegge Article About Property/Prototype Design Pattern
To: Michael Gourlay <mijag...@yahoo.com>, Tom Carbone <tcar...@360ed.com>, 360Ed Programmers <pr...@360ed.com>


It's a pretty good, but long, read. A lot of the article is about an extensible game engine architecture. The architecture sounds sort of similar to InteSiVis and Tenjin (360Ed's engine). The article is giving me some ideas about things I would like to do differently next time I design a game architecture.

http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html

/**
 Nathan Forget
 nathan...@gmail.com
 nfo...@360ed.com
*/

Michael Gourlay

unread,
Oct 26, 2008, 12:14:05 PM10/26/08
to misinformed...@googlegroups.com
While reading this article, I surfed through links to LinkedHashMap into a few web pages discussing C++ imlpementations of something analogous.  One of the articles I ran across (http://www.ddj.com/cpp/184406207) describes a hash map with a fast iterator.  His solution involves a node which I find a bit bloated.  I had written an implementation of HashMap which uses a singly-linked list as its underlying struct.  The iterator therefore resembles that of SList::Iterator.  I've attached the code.  (Note that the code has 2 implementations of HashMap: array-based and list-based.  Internal comments explain their relative merits.)
 
Note that this does not satisfy the requirements described in the Yegge article since my implementation does not preserve insertion order.  I'm on a tangent here; I'm just providing something close to what the DDJ article presents.
--
-- Michael J. Gourlay
hash.h
slist.h

Michael Gourlay

unread,
Oct 26, 2008, 2:25:18 PM10/26/08
to misinformed...@googlegroups.com
The Yegge article mentions using interned strings for optimization.  Turns out, I do this also, when strings are used as keys in the HashMap.  (See attached code.)  This is particularly useful when the property (attribute) names are common (which they are).
rstring.h
rstring.cpp

Michael Gourlay

unread,
Oct 26, 2008, 6:10:39 PM10/26/08
to misinformed...@googlegroups.com
Wow, you guys should read this and tell me if it sounds familiar:
 
Reply all
Reply to author
Forward
0 new messages