Monday, June 25, 2007

Pull my Strings

My favorite Joel Spolsky article is The Law of Leaky Abstractions. It may not be the wittiest or the most controversial, but makes up for it in shear importance. Joel's site is down right now (something that doesn't happen frequently), but wikipedia says that the Law was worded as:

"All non-trivial abstractions, to some degree, are leaky."

Well, some pretty trivial abstractions are leaky too. What is the type you use most in your programs? Probably int, but after that? For me it is String (currently java.lang.String or scala.String to be annoyingly more precise).



That is a pretty shitty* abstraction, don't you think? String is supposed to be short for StringOfCharacters. Leaving aside the fact that shorthanding is a bad practice, the name may not be wrong, per se, but it does nothing to characterize the meaning of the type in our programs. Why not Text? It is semantically more accurate and actually shorter than "String".



* To retain the plumbing analogy.

3 comments:

Unknown said...

You can break text (the concept) into paragraphs, segments, phrases, sentences, and finally characters. Really, it's only making the whole thing worse :)

Rodrigo Lopes said...

Yet, there're people using String like a reason to use metaphor principle in XP: 'Hey. Java guys did use string metaphor, remember!? Why can we not use xyz for our metaphor' _ where xyz is another stupid metaphor too.

Darren Demers said...

The Collection Marts is platform where you can view latest designs about home d├ęcor and bedding. We have large range in different categories with finest fabric in cotton and silk. You can view not only present trends but also view huge collection with reasonable price. The Collection Marts can provide fast service about delivery as well as customer support too. Our products are not only self-made but also, well connected with markets to ensure for possibility of available designs if client want to purchase. The Collection Marts customer support open 24/7 to guide their customers about material or product stuff.double bed razai , crushed velvet sofa covers