What I've Learned From Classic Hollywood Film and Programming
Wait, what?

As a disclaimer, I am NOT a film person by any stretch of the imagination. I'm also not going to claim I know much about the classic Hollywood system, how good films are truly constructed or try and do anything to provoke a violent backlash from those who do consider themselves film people. So please, reserve for your attacks on me at least after reading what I'm writing here.
However, I've gained something critical in my mind from some ideas behind this system of filming, and maybe film in general. In particular, it's the idea of making precision shots that help with continuity of the story.
The goal of films in the Classical Hollywood System is to create a series of image that are very easy to process, digest, and help persist the story without having to really think about each image that is show. Tricks such as eyeline matches and graphic action matches along with dialog that is very concise and only helping to continue the flow of the story are all part of this system to creating film for the masses.
In a similar way, the presentation of code and ideas behind code are also critical to this notion of clarity behind an idea one is trying to convey. While this is well taught and obvious from the perspective of code semantics/correctness (AKA, what you want the damn thing to do at each step and overall) as well as efficiency of the code itself, it is not always clear in the sense of who must come and maintain it.
For example, it's very much possible to create functions that avoid the use of standard libraries. Lets say, for example, we wanted to assemble some kind of function in Java that helps parse an email address into its parts assuming we want to divide it among the characters '@' and '.' (and assuming we're not even gonna bother to try and correct for bad input). We could let this very much get out of hand:
public static String[] parseEmail(String email) {
ArrayList<String> parsed = new ArrayList<String>();
int firstPartIndex = email.indexOf('@');
String firstPart = email.substring(0, firstPartIndex);
Scanner scanner = new Scanner(firstPart);
scanner.useDelimiter(".");
while (scanner.hasNext()) {
parsed.add((String)scanner.next());
}
/* More code to follow */
return parsed.toArray();
}
As one can see (by the way I didn't even bother finishing this) that this simple idea can get out of hand quickly. There must be a simpler way! There most certainly is also.
public static String[] parseEmail(String email) {
String delimiter = "[@.]";
return email.split(delimiter);
}
A bit simpler? I'd certainly say so!
In a lot of these situations, I believe that the more clear example is (depending on the circumstances) the much better solution, even in the face of efficiency. Things like this save maintainers and other developers lots of heart ache when trying to tell the story of what you were trying to think and how the problem needs to be fixed.
"And a woman needs like a man
Like a fish needs a bicycle
And you're trying to throw your arms
Around the world."
U2, Around The World
Tags: film, bogart, programming, simplicity, java
