Sponsored By

Feature: Programming Sins - Obfuscated Code And Cut-And-PasteFeature: Programming Sins - Obfuscated Code And Cut-And-Paste

In <a href="http://www.gamasutra.com/view/feature/6426/sponsored_feature_programming_.php">a new feature</a>, originally published in Game Developer Magazine and brought to you now in association with Intel, various game developers discuss their pet peeve

July 13, 2011

2 Min Read
Game Developer logo in a gray background | Game Developer

Author: by Staff

In a new Gamasutra feature, originally published in Game Developer Magazine and brought to you in association with Intel, various game developers discuss their programming pet peeves and how to avoid them. Michael Carr highlights numerous coding nuisances, including obfuscated code, which he says can be a real, unnecessary hassle for a forgetful person such as himself. "I couldn't tell you the intimate details of a function I wrote three weeks ago, let alone six months or a year ago," he says. "It's because of this that I consider obfuscated code a sin." "This also fits nicely with working in a team of programmers where someone might have to debug and/or add new functionality to someone else's code. The quicker it is to understand, the easier it is for them to make the required modifications," he continues. Noel Llopis warns about the dangers of vertical syncing during loading, noting that load times can be heavily affected if you're not careful. Citing his own work, he says, "There was nothing horribly wrong with that approach... the rendering code drew the progress bar, and then did a present call with vertical sync on. That meant that most of the time the console was waiting for vertical sync instead of doing an actual load. Once I removed the vsync, loading times went down to about 20 seconds!" A contributing anonymous developer also discusses the act of creating specific functions in place of cutting and pasting blocks of code over and over again. "I frequently go for the cut-and-paste "solution" first simply because it gets me the result I want quicker," he admits, "but I pay for my sins, and usually end up having to refactor it away later, sometimes after a few more needless duplications." The feature can now be read in full on Gamasutra.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like