ALL


  Reducing Code Nesting

"This guy’s code sucks!" It’s something we’ve all said or thought when we runinto code we don’t like. Sometimes it’s because it’s buggy, sometimes it’sbecause it conforms to a style we don’t like, and sometimes it’s because itjust feels wrong. Recently I found myself thinking this, and automaticallyjumping to the conclusion that the developer who wrote it was a novice. Thecode had a distinct property that I dislike: lots of nesting. But the more Ithink about it, the more I realized that it’s not really something Iâ€â...

3,301 0       CODE NESTING READABILITY MAINTAINABILITY REDUCTION


  Can Your Programming Language Do This?

One day, you're browsing through your code, and you notice two big blocks that look almost exactly the same. In fact, they're exactly the same, except that one block refers to "Spaghetti" and one block refers to "Chocolate Moose." // A trivial example: alert("I'd like some Spaghetti!"); alert("I'd like some Chocolate Moose!");These examples happen to be in JavaScript, but even if you don't know JavaScript, you should be able to follow along.The repeated code looks wrong, of course, so you create a function: function SwedishChef( food ) { alert("I'd like some " + food ...

2,606 0       PROGRAMMING MAINTAINABILITY REUSABLE