This has nothing to do with programming, but it’s still something that’s been on my mind lately because I like to game. I like to play all sorts of games, from board games, card games, pen and paper role playing games, to video games. I’m going to focus on that last one here.
Prompted perhaps by the recently released PSP Vita, I’d like to talk a bit about dedicated handhelds and their place in the market. This mostly has to do with how the mobile game space has as of late been thought of as a replacement of dedicated handhelds. However, due to the price and lack of features of mobile games, I think dedicated handhelds still have a very important place in the market.
The PSP Vita launch in Japan didn’t fare so well. Many members of the media mention that a dedicated handheld has no place in current society where everyone has incredibly powerful phones able to play games. They also note that the prices of games on dedicated handhelds (often $30-$50 per game), is a losing prospect in consideration of mobile games typically costing $1-$5. Why would I buy a single game for $50 when I could buy 50 games for $1? There is some sort of consumer perception shift over the value of a game, and mobile games have traditionally been very inexpensive so the mantra is that portable games are worth the cost of a coffee or donut.
I think this is really unfortunate for several reasons. The main reason is that the value of a game being shifted to very low prices ($1), means that the development costs and production values of those games will need to stay in line with those budgets. Most games do not sell as many copies as Angry Birds (I’ll get to my problem with that game a bit later), but instead might sell a few thousand copies. Even a well executed game from a small independent developer might sell 10′s of thousands of copies. However, with each copy costing $1, and apple taking 30 cents of each of those dollars, even a game that sells 100k copies which should be considered a fairly large success, instead only covers the salary of $70k that a median developer might make in a single year. This is just one person with no additional work done in art, sound, etc. You can easily imagine the quality and depth of such a game, they pretty much take up the top 100 games apps on all of the mobile stores. Ad supported games just piss me off, so I won’t get into those.
Now of course many could point out that one of the interesting benefits of mobile gaming and the inexpensive prices of games is that it allows for more independent developers to shine where there was once only major corporations pushing games. In the current market, it is difficult for an independent developer to publish a game on the Xbox 360, PS3, or Wii. Granted with advances such as Microsoft’s XNA and indie marketplace that’s becoming less of an issue, but on the mobile front it’s still very prevalent. Getting a game to [legally] run on a PSP or DS is an expensive proposition. The development tools aren’t free and easily accessible, and the knowledge of how to develop in those environments isn’t as well known. However, on the mobile front such as with the iOS and android devices, the cost to develop is fairly low. So naturally they make the target platform for independent developers.
And this is a wonderful thing. We can be exposed to and discover new and interesting things by passionate people who are willing to take chances. However it also means that the market is full of cheap knock-offs and rushed, shallow games that are just striving for a quick buck. Finding the gems in the pool of slag is a depressing prospect. The quality to quantity ratio is skewed incredibly towards the later. The fact that prices are so low that a true creative endeavor will hardly ever be attempted because the chance of recuperating the production costs of such a product becomes quite low. In essence what we are left with is a marketplace that is full of very cheap, very shallow, low quality games that mostly are clones of one another. Gameplay is often incredibly simplistic (see Angry Birds), and often lacks any real challenge or sense of accomplishment. They’re fodder that are useful for minor diversions, but rarely a good rewarding experience that one can get from deep stories and deeper gameplay.
Other than the economic problems with mobile games, there exists another significant one relating to functionality. Mainly in that most mobile platforms being touch-screen only phones or tablets, the primary interface to interact with games on these platforms is through touch. Unfortunately for many genres of games, touch is a very poor interface. Often times games will use an on-screen controller; sectioning off portions of the screen with mostly transparent overlays that are visual representations of physical controls that you slide or tap as if they were an actual controller. These are often cumbersome and obviously trying to make up for something that is lacking: physical controls.
I noticed this acutely yesterday when I was on a shuttle heading towards the train. I took out my iPad and decided to try out Sonic The Hedgehog 4 Episode 1. The game is actually quite well done. Graphically it’s very pretty. The levels are well constructed. But the controls are terrible. One has to use a virtual controller that’s been mapped to the screen which makes playing a fast paced platformer like sonic very difficult and frustrating. A single analog stick (or even a D-pad) and one physical button would have made the game great. However, due to the poor controls, the experience was sub-par. Mostly just a ‘meh’ game that’s disappointing in its execution due to limited inputs.
Those two factors is why I am buying a PSP Vita and why I hope that dedicated handhelds are never truly overtaken by games on touch-screen only devices such as mobile phones and tablets. The depth of a game made on a higher budget that is supported by a higher price can vastly supersede a game made on a 70 cents per sale mobile game budget. Games such as Jeanne D’Arc for the original PSP, while technically could be created for a touch device, are not due to the convention of $1-$5 game prices. Experiences like ones found in a quality game such as Jeanne D’Arc are ones that I crave however, and that bring fun and excitement to events like my commute where a mobile game may only stave off bordom for a few minutes. Sometimes I want to just play something quick and mindless like Angry Birds, but sometimes I want something of quality. A GOOD game that I can immerse myself in to the point where I miss my train stop and end up in Gilroy. Something that I’m having so much fun with that it becomes dark when I’m playing on my couch and I don’t realize because I’m so involved. That has never happened for me on a mobile device, but it’s something that’s more probably on a dedicated handheld with the types of games those devices attract.
Having physical controls is another very important point to a dedicated handheld GAMING machine. Entire genres just don’t work well on touch-only devices. Fighting games, shooters, action games, platformers, and many types of hack and slashes, are all improved with the addition of physical buttons and analog sticks. If Sonic The Hedgehot 4 Episode 1 were on the Vita, it would double the fun of the game over the iPad version just because of the controls. This is a need that has been recognized by the 3rd party peripheral manufacturers who now make controllers and additional input devices for the iPad such as the iCade. OnLive has a universal controller that works on android and may someday work on iOS to play streamed games and use real controls.
In essence, dedicated gaming hardware has a niche that it serves outside of the general ‘mobile gaming’ space that has been very popular lately. Mobile games are big money right now because it’s capturing a huge casual game market that hasn’t been exposed before. However, there is still a ‘core gamer’ market that, while not as large, is usually willing to spend more money for a higher quality experience. Knowing that these two segments can exist independently is why, I think, products like the PSP Vita and 3DS are still very important and relevant in today’s society. Not all games need to be shallow and cheap.






Why You Should Comment
I almost wonder why I would even have to make a post like this. It seems like common sense doesn’t it? When you write new code, you should write comments with your code to explain what the code is doing. Sometimes the comments should be inline for a tricky algorithm, but often it’s sufficient to place comments at the start of a method/function or class just to describe what it is so that the reader doesn’t need to step through your code to understand what it’s doing. When you make significant changes to a method/class, you update the comments. Seems simple and pretty obvious doesn’t it?
Then why don’t more people add useful comments to their code? Often I’ll see this:
Ignore the fuzzed out bits, NDA and all. Note however that there's a default comment made by the IDE (IntelliJ in this case) and that the IDE itself even recognizes that the default comment should be changed by marking it yellow. Yet people still ignore this and just leave it be.
The fact that this BugzillaGrouper class was created on October 11th, 2011 at 5:01:37 PM in IntelliJ IDEA tells me… well not really anything about the class itself. The IDE even recognizes that this is just the default template comment and marks it as a warning (signified by the yellow bar on the right) as something that should be changed. Yet many developers will just ignore this and move on to writing code rather than ever changing the default comment. This brings up two points that I’d like to make.
Firstly, default comments are bad. They leave the developer with a false sense of documentation. I mean, the code has a comment on it, it’ll even generate documentation if you run it through JavaDoc or a similar tool. However, that documentation is worthless. The default comment is less than worthless because the developer sees that there is something up in the comment field and just ignores the fact that it’s a useless bit of fluff. If no default comment were in place, the developer might look at his/her code and thing “Gee, I don’t see any of those green comment boxes at all. This file seems really short. I should add a succinct, well thought-out, and useful comment so that other developers (or even myself) will later look at this file or the generated documentation and be able to easily understand the purpose and usage of this class. Perhaps I’ll provide an implementation example if I’m feeling randy.” Ok, no developer really thinks that, but they should. With a default comment in the code, the chance they’ll think about comments at all goes down significantly.
Second, when people do write comments, they often don’t write very good ones. Often it goes along the lins of “A BugzillaGrouper is a class that implements the Grouper interface.” Well that’s almost as bad as the default comment. Heck, I could figure that out from the class signature, and by reading less words even. What’s really the purpose of the class? It implements an interface, so that means it’s performing the function of the interface but in an implementation specific way. What is that? For example: “The BugzillaGrouper in this instance is a Grouper that groups incoming report data by the bugzillaId. It automatically splits apart bugzillaId’s that are comma separated into multiple ID’s. Unlike other Groupers that aggregate test result counts of similarly grouped items, the BugzillaGrouper only produces a set of distinct bugzillaId’s as it’s primary output. The output is a JSONArray in the following form:…”
I’m not going to list the actual form of the JSON output but I think you get the idea. The main part of the comment is only 4 sentences and took just a few minutes to write. However, the comment has some useful information about what it does specifically in relation to the interface it implements. It also describes how it is different from other implementations. An example of the output (which is different than what most groupers would produce) let the user’s of the class know exactly what to expect without having to step through the code itself for the output format.
Comment Driven Development
I’m already an avid fan of Test Driven Development. Another popular idea making the rounds is Comment Driven Development. I think these two can be used synergistically (one more for buzzword bingo!) to help with an agile development process. Also, it will leave a project with some (hopefully useful) documentation.
The main idea is to write the comment to a method/function/class before writing the code. If you’re unable to write an explanatory comment before coding, then you probably don’t know the problem domain of that piece of code enough to really be writing the implementation for it. Also, when you write the comment first, you’re actively thinking about what that piece of code should be doing. You can work out the design in your head, similar to how you can work out a design by writing a test before your code. Ideally, those two processes can intertwine and work off of each other.
For example, you would first start out by writing the comment to a function you want to implement. Having that basic written description of what the function does, you write a test for the implementation. Perhaps you find some sort of problem with how the actual implementation would work (maybe you need to split it into multiple functions or change some signatures around). This causes you to go back and modify your comment based on your new assumptions, which might reveal other problems. You can go back and forth between the two until you have some useful tests and a descriptive comment. Writing the code to meet those two goals should be pretty easy at that point.
This works even better if you follow the practice of limiting your function/method size. Ideally, your function should not be any longer than it needs to be. If you find yourself having to scroll down an editor to read an entire function, it’s probably doing too much and should be split into multiple smaller functions. Personally I try to keep my functions to 10 lines or less, though that’s not always possible. Still, keeping a goal for smaller function sizes makes them easier to understand and modify later, and makes writing both tests and comments easier by having a narrower scope.
Many developers will still shun comments in their code, wanting to produce something quickly and get it to compile and run. In the end though, the API’s will not be used very much because they’re not documented. Also, the code will be more difficult to maintain, not only by other developers, but by the original dev as well. Since most of your time coding will be in maintenance mode fixing bugs and adding features, it’s stupid not to add useful comments to your code. By forgoing it you will slow down not only other developers that have to work on your code later (and they’ll hate you for it), but also yourself when you realize you have no idea what you were thinking when you wrote that piece of obscure code.
Writing comments before you write your code is a way to not only help you make sure you actually write comments, but also a way to brainstorm design ideas. Comments can be helpful to the development process, and not just a necessary evil that slows down your coding.
Write comments. The world’s codebases suck enough as it is, raise the quality a bit!
Posted in Coding, Design, Programming