Feeds:
Posts
Comments

Ever wonder why the C++ STL uses an external, non-member function model for implementing algorithms for containers? The following article sums it up. Although a few of the “no less efficient” examples are debatable, the underlying principles definitely have merit.

Monoliths “Unstrung”

One downside to the functional approach outlined in the article–that I didn’t see mentioned–is the fact that the interface is actually being split in a few cases, which is actually detrimental to cohesion. This happens when you have multiple overloaded forms of a function, and you keep one “flexible” one as a member function, but make the others external functions. Why not keep those as members for the sake of consistency? You can still implement them in terms of the one “flexible” member function, thereby continuing to ensure good encapsulation.

A few thoughts on applying the spirit of the law discussed in the article to other languages:

  • C# – Use extension methods, but the “this” type should be as generic as possible. You still get the benefits of DRY but in a more object-oriented fashion that works well with Intellisense and cohesion. I like the extension  method approach better than the old static-methods approach (e.g., string.Join) because it still enforces good encapsulation, and is less verbose and more cohesive than the alternative.
  • Ruby – Use mix-ins that use duct-type delegation to other methods. These can be automatically mixed into all applicable classes when the mix-in is “required”.
  • Lisp – Brilliant! All you have are functions!

It’s also important to note the power you derive from combining this functional approach with lambda functions, function objects, and covariance.

See also: How Non-Member Functions Improve Encapsulation

Come on, admit it. You started programming because you wanted to make games. Really cool ones with things that go bloop in the night.indie game munch man

Then, somehow, life came along and you had to be practical and, well, pay the rent. So now you make websites or program database access layers, or whatever.

But there is an indie revolution brewing. You’ve got tools such as Unity. Platforms like the iPhone. Indie-friendly publishing on major consoles for the first time ever.

Gammeta is the last piece of the puzzle. It’s the trump card that lets you compete with the big game shops.

Gammeta wants to make it easy for your indie game players to connect with friends and other players. We believe that bridging the gap between the virtual and real worlds is the future of gaming.

So, rather than spend a lot of time and money to develop and run a one-off backend server for your game, you can have Gammeta take care of it for you. Simple. Neat. Fast and easy. Magically delicious.

Are you an indie game developer? Let us know what you think.

While testing some web services, I was not-so-pleasantly surprised to find that WCF cannot disambiguate two methods when one is a GET nd the other a POST:

[OperationContract]
[WebDispatchFormatter]
[WebGet(UriTemplate = "/{encodedGameId}?startDate={startDate}&endDate={endDate}&tag={tag}")]
Contracts.Out.Statistics GetStatistics(string gameId, string startDate, string endDate, string tag);

[OperationContract]
[WebInvoke(UriTemplate = "/{encodedGameId}", Method = Verbs.Post)]
void AddSample(string gameId, Contracts.Sample newSample);
[WebDispatchFormatter]

If you leave off any of the query parameters for GetStatistics, WCF cheerfully returns “Method not allowed”. I wanted to make the “tag” parameter optional, and worried this would be a deal breaker.

Fortunately, I came across this WCF post by Ron Jacobs.

The basic idea is to leave off the optional query parameters in the UriTemplate, instead manually pulling them from the current request context. This approach is actually similar to the way you access query parameters in RoR, so I should have thought of doing it like this in the first place.

In fact, if you beef up Ron’s QueryString class, it can clean help you DRY up your code by taking care of data type conversions on the sly.

The moral of the story is that a framework’s design can induce sneaky biases that you only discover as they jump out of the shadows to bite you.

Thanks Ron!

Recently I realized that one of the main reasons I like Windows is that I build my own boxes. Most of the PCs sold are lame, including those by Dell, HP, and Acer. You can build your own computer using similar specs to anything from these manufacturers and generally (1) save money, (2) get better performance, and (3) avoid all the low-quality, resource-hogging software that comes pre-installed on retail PCs.

One other significant reason that I like Windows is that I haven’t been running Windows XP for a long time. I was one of the brave few who decided to give Vista a try and I have to tell you, XP is absolutely archaic in comparison. Even more so when you compare XP to Windows 7. Windows 7 is very, very good.

A simple example of what you get when you upgrade from Windows XP is the ability to mute annoying system sounds, like those “online/offline” dings that I can’t seem to turn off in Trillian. I know this feature may seem trivial, but all these little goodies add up to a great experience.

Don’t get me wrong, I also like Mac OS X and Linux. If only PC manufacturers would raise their standards, more people would like Windows as well. Fortunately, looking at the announcements coming out of CES last week, things are trending in the right direction.

Indie Gamers: Help Me Choose

I’m getting ready to launch my new indie game services project, Cupcake, but I need a good domain name. The general idea of Cupcake is to provide tools and services that take the pain out of making high-quality indie games.

What do you think is a good domain name? Vote for one of the ones I’ve already come up with, or enter your own.

Note: I would LOVE to use cupcake.com but someone is squatting on that name.

« Newer Posts - Older Posts »

Follow

Get every new post delivered to your Inbox.