Archive for May, 2008
Are magic MVC frameworks really helping me? 2
As a preface, please read this about “magic” code.
It wasn’t that long ago that I gushed about Cake. But after doing some development with it (beta sites for Mockingbird), and after recently working on our current site (which runs on top of Pligg, kinda), I’ve started to kinda think, “hey, what are these guys actually doing for me?”
First, I am still baffled that with all of the auto-sniffing-magic that these frameworks (Rails, et al) do I still have to describe by database schema in two places. I mean, come on, Microsoft solved this problem in .NET. Sure, they do it through code-generation (XML database schema creates the actual underlying database as well as generating all of the C# classes used to interact with it in a completely typed, validated way). But with Cake (and with Rails, AFAIK) I have to go off and do DB admin creating tables and indices and such, and then I have to come and create some parallel classes in the framework. Sure, I don’t have to specify the individual fields, it’ll automatically attempt to map unknown properties for me… unless I want to build-in validation, or relationships, or serialization… you know, trivial little things that only serious webapps would need… ahem. Sure.
Second, I’m just terrified by the amount of decision-making that is made each time “through” the framework when one of my pages is served up. Sure, op-code caching alleviates some of this, but really, should I be executing 10x the necessary amount of code to save me from having to write out a dozen lines of completely self-explanatory, easy-peasy lines of code?
Maybe I’m missing something… maybe these guys are doing a lot of stuff for me I’m not realizing. But I get the itch’n feeling that they’re really just providing a different syntax (with some defaults that make building a bare bones blog in 15 minutes a snap) on bits that are already there, at a lower level.
Routing — mod_rewrite/.htaccess is the only routing tool you need. I almost guarantee you’re not doing anything in your webapp that requires some kind of routing logic that can’t be handled elegantly with mod_rewrite/.htaccess.
Controller — this is the PHP file that your mod_rewrite directs queries to. All you need to do is practice some self-control and keep all of the aesthetic bits out of this PHP file. Just do the work, the logic of the user’s request. When you done all your work, just pass the results off to the view.
View — go download Smarty. Just use it. Flickr uses it and they get more traffic than you ever will. It’s a templating engine designed with the viewpoint that the template should *only* be the view and that the designer and programmer are at least independent tasks if not entirely different individuals.
Model — I was very frustrated with Cake when I tried to combine it with Pligg. Pligg had a particular table/field naming scheme, and Cake had a similar (but different enough) scheme. There was no combination of tweaking that would get one to be compatible with the other. Writing the necessary SQL queries to bridge the gap manually was trivial. And I knew them all along – in fact, I used them when debugging the naming scheme in an attempt to work backwards.
Just grab ezSQL, that’s as simplified and automatic as your database interaction should be, because the database is critical (and powerful) if you don’t discount it as just a big property list.
Helpers, Components, Behaviors &mash; these frameworks all have a bunch of additional “utility” features that basically just make life easier as a webapp developer. These could be worth it, if they’re you’re particular flavor. But I bet for each one there’s a strong, healthier open-source version that does more.
Maybe I should put my money where my mouth is? Maybe so. How cleanly could I build a webapp without a framework (and without implicitly building one myself)? In other words, have we heaped one abstraction too many on the pile?
It’s a beautiful thing. 0
From From Little Things, Big Things Grow, an A List Apart essay by George Oates, UI Designer, Flickr:
Treat your place like your home: welcome people, fix them a drink and make them feel comfortable. Before you know it, your guests will be chatting amongst themselves, the party will be pumping, and people will be making plans together.
Are you making a game, or are you making a game? 1
An oft-encountered problem when discussing “games” is that we don’t have a fully-developed, universally understood terminology. We’re getting there… we’re much closer than we were just a few years ago, and lightyears ahead of where we were ten years ago. But there’s still a significantly sticky term that we seem to be permanently stuck with: the name of our medium, games.
The term “games” has been around for Really Long Time&tm; (I couldn’t find a reference indicating the date of the origin of the word, buts it has its roots in Olde Englishe&tm;). When we use it today we’re generally referring to video games, board games, card games, sports, etc., i.e. structured (however loosely) activities with interaction, rules and goals. There’s a ton of academic writing on the specific definition that I don’t care to go into… we all know what we’re talking about.
Or do we? The problem with the term games is that for 99% of its history it referred to a formal structure of rules with some goal. But we use it far more liberally these days, particularly in the indie or academic game circles, meaning more generally interactive entertainment (as opposed to films/books/music being passive entertainment).
Randy Smith (EALA) raises this issue in a recent Next-Gen column. Actually, he doesn’t directly raise this issue, instead he raises the issue that we used to have games where the player was allowed to fail, didn’t have a clear path for success, and in general had a much “grayer” experience. He cites Ultima V, which to be honest is cheating, as that game is much more the exception than the rule in regards to “gray” games.
His larger point is that “modern” game design, borrowing heavily from the good designs perfected in the casual market, dictates clear paths to success, objective scoring, concise rules, etc. (you can read his article). His question is whether or not we’re losing something by focusing on these things exclusively, i.e. have we overcorrected and lost something powerful?
The problem is the definition of what we’re doing, what we’re making. If you’re making a game that’s similar to a sport (Quake, practically any FPS with a military-theme, practically any RTS, virtually all casual games, all arcade games, etc.) then all of the elements of modern game design are totally appropriate. On the other hand, if you’re making a game that’s more akin to a simulation or a toy, then all the tenets of good usability, user interface design and accessibility (all different ways of saying the same thing) are critical.
But what if you’re making a game that’s like Ultima V, or Passage, or Super Columbine Massacre RPG, or the Olympic Torch Relay Game? These games are more about the message than the mechanism. The mechanics aren’t elements of structured play, but rather the necessary elements in order to get a specific emotion or point across to the player.
So, we’ve got serious games, casual games, hardcore games, just plain ole games… and message games? These are really our “art” games, games that focus on message or mechanics. They don’t dispense with mechanics, the mechanics are just secondary to the message. And as a result, they often have unoriginal mechanics because it’s not the point.
Note that I’m not dismissing mechanics as important in a “message” game. Cinematography is still critical to good film even if it is secondary to a message in many instances.
What are some examples of message games? I’d love to hear them in the comments. I’m looking for games where the point was the message they conveyed, not the mechanics with which the user interacted with them. I’ll start with the obvious ones I’ve already mentioned: Ultima V (and IV), Passage, SCMRPG… Planescape is probably one, though I’ve never played it. Others?
Magic Thinking 0
Amen, brother.