ALL


  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,609 0       PROGRAMMING MAINTAINABILITY REUSABLE