programming

A programmer's joke

A CS student shows his lab assignment to the professor. The code works and even produces the correct output, but the professor mutters that the code is not OK:

— You have to choose variable names wisely. Names like i, j, foo and bar make your code unreadable. By next time, please use long, mnemonic variable names.

A few weeks later, the same student completes a new assignment and brings it to the professor. This time, his code is full of long_mnemonic_variable_i, long_mnemonic_variable_j, long_mneminic_variable_foo and long_mnemonic_variable_bar.

OK… Here's another way to add random signatures to Gmail. Now using Google Apps Script.

It almost works. It will update signatures that you store in a Google Sheet at regular intervals. The only problem is… You have to be a Google Apps for Business administrator to run this thing, because the only way to update a Gmail signature programmatically is via the Google Apps for Business Admin SDK. Ha-ha. Another problem is tha the signature only gets updated when you refresh the page. But that's a minor thing ;-)

Check it out and make a copy to have access to the script.. And here's the code:

Occasional XSLT for Experienced Software Developers

FIrst published in 2004 in DevX

Although using XSLT to process XML is increasingly common, most developers still use it only occasionally—and often treat it as just another procedural language. But that's not the best way to use XSLT. Learn how to simplify and improve your XSLT processing using event-driven and declarative techniques.

XML appears in some form in most modern applications—and often needs to be transformed from one form into another: merged, split, massaged, or simply reformatted into HTML. In most cases, it's far more robust and efficient to use XSLT to perform such transformations than to use common programming languages such as Java, VB.NET, or C#. But because XSLT is an add-on rather than a core language, most developers use XSLT only occasionally, and have neither time nor resources to dive into the peculiarities of XSLT development or to explore the paradigms of functional and flow-driven programming that efficient use of XSLT requires.

Such occasional use carries the danger of abusing programming techniques suitable for mainstream languages such as Java, C and Python, but that can lead to disastrous results when applied to XSLT.

However, you can avoid the problems of occasional use by studying a few applications of different well-known programming problems to an XSLT programming task through this set of simple, thoroughly explained exercises.

Programmers learning from philosophers

In a paper entitled "Classes vs. Prototypes: Some Philosophical and Historical Observations" and published in 1996, Antero Taivalsaari draws parallels between the evolution of the philisophy and of the Object-Oriented paradigm in programming.

Indeed, the classification of the world was in the center of interests of philosophers since Plato and Aristote. Taivalsaari argues that the traditional class-based OOP builds upon the principles that have first been described by Plato, while there are more sophisticated approaches to categorization, e.g. the so-called prototype theory, started by Wittgenstein, that lays in the foundations of the prototype-based OOP, like what we find the the modern implementations of the JavaScript language.