5 days Ago

Capsule Movie Reviews Vol.2014.4

Published by marco on in Art, Film & Literature

He’s Just Not That Into You (2009)
A star-studded cast can’t save this utterly derivative and cliché script. Bradley Cooper, Jennifer Connelly, Kevin Connolly, Scarlet Johannson, Justin Long, Drew Barrymore, Jennifer Aniston and Ben Affleck. And Busy Phillips—of Freaks and Geeks fame—had a small role. This movie purports to dispel the myths of dating, marriage and male/female relationships. Though it may appear to do so superficially—at least it very clearly tells you that it is doing so—at a deeper level, it is no better than any other film in this genre. I don’t remember every minute of this 129-minute movie—you read that correctly, this so-called “chick flick” is over two hours long and never seems to end—but I’m almost 100% certain that it failed the Bechdel Test.[1] It also fails other common tests: there are a dozen lead characters and they’re all white. The women all have low-level jobs—most work together in a cube farm and another is a struggling singer—while the men are all successful : one is a record executive, another owns/operates his own bar/restaurant, another is a successful real-estate agent and another’s job is unclear but he owns his own boat. The women are all kind of dependent on their men, whining about their inability to get married or find a guy. The men clearly don’t care. Not recommended.
Brother (2000)

Takeshi Kitano directs himself in the starring role in this story of the journey to America of an exiled Yakuza gangster named Aniki Yamanoto. He is sparing in motion and speech but when he moves, he does so precisely and with great and often lethal force. He is also extremely shrewd at conquering territory in his newfound home, where the existing gangs seem to be less quick to pull triggers than he. The movie also stars a very young Omar Epps.

Yamamoto joins forces with another local Japanese gang and they commence expanding their territory. There are many execution scenes that delineate the new power divide. There are scenes of self-mutilation among the Yakuza that makes you wonder whether they’ll kill themselves off before their enemies can do it. They finally end up taking on the Mafia and things get really ugly. The scenes themselves are often very stylistic and pretty, despite the gruesome depictions in them.

It’s nicely filmed in what I’ve come to think of as the Japanese crime-drama style. Many of the shots feel like Grand Theft Auto Tokyo/San Francisco. Saw it in English and Japanese/Spanish with English subtitles. Recommended.

Sexy Beast (2000)

This is an English crime movie starring Ben Kingsley as a thug named Don Logan sent to collect Ray Winstone’s character, Gad, to help execute a robbery. Gad has been living in Spain for years after retiring from the safe-cracking business. Logan doesn’t take no for an answer and he makes the most of his reputation as a ruthless henchman. Gad, his wife and his friend and wife are all extremely leery of Logan and give him a lot of leeway. Kingsley fills all the space he’s given with menace, although it’s a tight-rope of false menace versus the fear of the others, who just want to extricate themselves from this situation. They want the nightmare of Kingsley’s character to go away and he knows this, he feeds off of it.

Spoiler alert: Logan pushes them all too far and Gad’s wife ends up taking him out with a shotgun after which he taunts them from the ground, spitting blood and curses and epithets while he chokes out his last. Gad goes to England to do the job anyway, trying to cover tracks, but the head honcho there—Teddy, played by ian McShane—oozes just as much menace as Don Logan. I thought the film had a nice style—it was directed by Brian Glazer—and it reminded me a bit of some of Kubrick’s work. Recommended, but not highly.

Frozen (2103)

The standard Disney princess-meets-boy movie has been transplanted to the great white North, presumably somewhere in … Iceland? Because of the trolls? Or Norway because of all of the names, like Olaf? Probably generically European, I guess. It’s all just one big place. The first act—about 40 minutes—is pretty insufferable. There is one forgettable musical number after another, with the most appalling lyrics.

And then, out of nowhere, the door to the sauna/shop cabin in the woods opens and we are introduced to the innkeeper, who seems snatched right out of the Emperor’s New Groove and is a breath of fresh—and funny—air in an otherwise odiously predictable movie. A movie made all the more unbearable by the back-to-back-to-back and seemingly endless crooning. The one song that really stood out was, of course, Olaf the snowman’s ode to summer, another slyly hilarious song made poignant by his utter obliviousness to the meaning of the words he’s singing. That twenty-minute segment in the middle could be extracted into a good short film.

What I’m calling the third act was just as predictable as the first act. How were the much-vaunted animations? The snow was well-done, I guess. The human figures were terrible, at least the female ones were. Has anyone else noticed that Disney has ended up depicting females as Bratz dolls instead of human-looking? The male characters were fine, although of course all conventionally handsome. Josh Gad as Olaf was a standout. The musical numbers and plot was 100% designed so that Disney doesn’t have to pay anyone to write the inevitable Broadway musical.

The Waterboy (1998)
It is neither an exaggeration nor necessarily a compliment to write that this is possibly Adam Sandler’s best comedy, or is at least in the running with Happy Madison.
The Fantastic Mr. Fox (2009)

A wonderful stop-motion animation written and directed by Wes Anderson and based on a story by Roald Dahl. The film is unmistakably a Wes Anderson flick with the usual rogue’s gallery that includes Bill Murray, Owen Wilson, Willem Dafoe and Jason Schwartzman all lending their voices to characters. Meryl Streep lends her voice to Felicity Fox, Mr. Fox’s wife. Mr. Fox is voiced by George Clooney, who at times seems to be channeling Everett McGill from Oh Brother Where Art Thou. There were no musical numbers, which was a nice change of pace from Frozen, which was filled end-to-end with them.

The story follows a reprobate Mr. Fox who supplements a boring career as a newspaperman with a few last capers that involve stealing from three local farmers. The farmers respond with extreme prejudice and Mr. Fox’s capers end up dragging the whole local animal world into danger. His son, Ash, is kind of strange (played by Schwartzman, of course) and in competition with his cousin, who’s come to live with them for a while and who is quite an accomplished athlete much more in the vein of his uncle than his uncle’s son (Ash) could ever be. The first and second acts were quite strong while the final act kind of dragged a bit, but it was a madcap and zany animated feature that is well worth the time. Recommended.

The Jungle Book (1967)
The classic Disney movie has its own cloying bits of story, but the feel of the film was somehow much more artistic than Disney’s later efforts (like Frozen, reviewed above). The songs are great and include more than a few classics and more memorable characters than most of Disney’s princess-drenched pap. Baloo, Bagira (Baggy), Ka and King Louie all stand out—although what also stands out is that there almost no female characters at all. The film’s not without its problems, but the musical numbers are something to look forward to rather than to dread. Ka stretches all over the trees and forms stairs and wheels out of his coils for Mogli to fall into and it’s somehow nicer than the CGI animations we have today. Recommended.
Ponyo (2008)
This is a wonderfully drawn Japanese cartoon that has a plot made for six–year-olds. It was an adorable plot but it didn’t give adults much to go on. I could only find a dubbed version (or perhaps the original was in English?) because I usually avoid Hollywood dubbing of Japanese anime like the plague. Ponyo’s father was voiced by Liam Neeson—of all people—and his rather distinctive voice took me a bit out of the aesthetic of the film. Highly recommended for small kids but not anywhere on the level of a Spirited Away or Howl’s Moving Castle for adults.
Singin’ in the Rain (1952)
Gene Kelly, Donald O’Connor, Debbie Reynolds and Jean Hagen star in this movie about a silent-film company that makes the transition to sound. Set in 1927, the feel is quite over-the-top and it’s hard to tell whether it feels dated because the film is from 1952 or whether it feels dated because it’s pretending that it comes from 1927. I don’t know if it’s worth 8.4 out of 10 on IMDb but it definitely has its moments and it’s definitely worth being called a classic. It was highly entertaining and there was a number near the end that was positively Daliesque. There were so many fantasies within fantasies that I think we were three inception-levels down if not four. O’Connor’s “Make ‘em laugh” routine is marvelous and Kelly’s scene opposite Hagen where they act out a scene in a movie while discussing her having gotten the girl he likes fired was pretty inspired.
Walk of Shame (2014)
Elizabeth Banks is charming in this movie, which goes a long way to papering over the otherwise glaring cracks in the script. James Marsden is also quite good as the sheepish, earnest one-night-stand. It’s a popcorn comedy that ended up being fun enough with an utterly unsurprising ending. Bill Burr had a cameo as a police officer but was unnecessarily brutal and not funny at all. Not recommended but also not not recommended.
Prisoners (2013)
Jake Gyllenhall and Hugh Jackman are the two leads in this well-made film about child abduction. Hugh Jackman plays the father, driven mad with grief over the loss of his daughter. Jake Gyllenhall plays the police officer assigned to the case. Both are very, very intense. Maria Bello played Jackman’s wife, who arguably handled the abduction even worse than her husband. Paul Dano and Melissa Leo were both very, very good but I won’t mention their roles so as not to spoil anything. The ending was a bit lame, in that it made what should have been routine police-work looks like nigh-miraculous leaps of intuition.[2] Still, highly recommended.
The Lego Movie (2014)

A movie for the A.D.D. generation. This movie is, on the surface, an explosion of color, sound and scene and context changes. Below the surface, there might be some social critique, but it is quickly buried beneath a relentless avalanche of nearly incomprehensible action. Imagine yourself clinging to the edge of a rubber tube, smashing your way down category–5 rapids, holding on for dear life and trying desperately to anticipate what’s going on. That helpless feeling you have—if you’ve imagined properly—is exactly how you’ll feel watching this movie.

When it slows down for some insipid dialogue, delivered during a Matrix-like pause, you’re ever so thankful that the onslaught on your brain has, for whatever reason, abated. You’re so happy that you don’t even care that the one-liners are carefully vetted to satisfy all audiences and censors and harbor no true critique. This movie is rated PG and is therefore open for kids of all ages—who are we kidding?—but in the first fifteen minutes, we see a man have half of his personality erased for failing to prove his allegiance by incapacitating his own parents. As the lead lego-man said, “I’m just gonna come right out and say this: I have no idea what this place is or what’s going on—at all.”

Big Night (1996)
Stanley Tucci and Tony Shalhoub play Italian brothers with a restaurant in New Jersey that is on the verge of closing because they cook authentic Italian food and the customers are sparse and mostly “Philistines” (as Tony Shalhoub says). This seemed a promising film, but I was unable to finish watching it. More details in a future edition.
Captain America: The Winter Soldier (2014)

This is a very solid spy movie. There’s good continuity from the first movie and Chris Evans and Scarlet Johansson reprise their respective roles well. I liked almost everything about this movie and look forward to more in the Captain America series. The effects were well-integrated and not too distracting right up until the very elegant ending credits.

I’m not so happy with Samuel L. Jackson’s continued ham-handed portrayal of Nick Fury, though I admit that I may not be remembering just how much of a jingoistic jerk Fury was in the comic books. My admittedly old memories of him all see him as “cool”, whereas he was probably exactly the proponent of the security state that Jackson portrays him to be. Robert Redford is also way over the top and it’s hard to tell whether he’s deliberately being over the top in his portrayal of a right-wing power-hungry super-criminal and where I’m so out of touch with US culture that I can’t tell that he’s just espousing very mainstream views.[3] The main premise involving H.Y.D.R.A. was well–thought-out and executed. Highly recommended.

My Cousin Vinnie (1992)
It is absolutely clear from the first time she opens her mouth why Marisa Tomei earned an academy award for this movie. Joe Pesci is good, Ralph Macchio is…ok, but Marisa Tomei is spectacular. The whole movie is quite a clever and nicely made courtroom drama that pokes fun at everyone—although the American South arguably gets the worse and more unfair treatment. They’re pretty much all hicks, according to this movie. Still, there are so many good lines and clever turns that it’s definitely worth watching. Highly recommended.
District 13 (2004) (fr)
This French parkour film stars one parkour star—David Belle, ostensibly the inventor of the sport—and one stuntman, Cyril Raffaelli, both of whom deliver some nicely choreographed fight scenes. The first act ends on a very cool note, with Belle delivering the coup de grâce. The plot is mostly predictable but it’s quite well-made and the parkour scenes are worth the price of entry. Some of the thugs are less one-dimensional than usual (e.g. K2) and the sub-titles are idiomatically rather than literally translated. There’s a bit of a twist at the end that’s not bad. Recommended for fans of the genre.
I’m Gonna Git You Sucka (1988)
As the title suggests, this is a send-up of blaxploitation movies of the 70s, starring a couple of the Wayans brothers as well as Jim Brown, Bernie Casey and Isaac Hayes. Some parts work; most don’t (at least anymore…the movie hasn’t really aged well). The outside sets are kinda nice as are some of the cars. When Kung Fu Joe (played by Steve James) is pulled over, he gets out of his Nissan, which tells him that his “door is ajar”—that took me back because we had a ‘84 Nissan Maxima that did the same thing. It has its moments—a 23-year–old Chris Rock plays a bit part as “Rib Joint Customer”, inventing the temporarily popular “I’ll have one rib” catchphrase. Not really recommended unless you need to fill a hole in your silly 80s movies education.

[1] The Bechdel Test (Wikipedia) is a gender-bias test that “asks whether a work of fiction features at least two women who talk to each other about something other than a man. The requirement that the two women must be named is sometimes added.”
[2] For example, Redford’s character asks the idiotic and purportedly provocative question that included the hypothetical “when Pakistan starts killing women in soccer stadiums […]”, I wondered whether his hyperbolic depiction of Pakistan as an Islamist stronghold with Sharia law was due to ignorance on the part of the scriptwriter or Redford’s character’s ignorance or whether it was US propaganda injected into the film to form people’s opinions about Pakistan more negatively.
[3] There are several pretty glaring plot holes, but they don’t really ruin anything. The one that comes to mind is that, when Loki went back to the house at the end of the film, he saw crews working the frozen ground, looking for more evidence of other abductions. However, there is a car parked on top of a giant piece of plywood right next to them. It doesn’t occur to anyone to ask “I wonder what’s under here?” Instead, they dig into frozen ground and rely on Loki hearing Keller’s stupid whistle before they realize that there might be a prisoner stashed under the plywood.

6 days Ago

Is Encodo a .NET/C# company?

Published by marco on in Miscellaneous

Encodo has never been about maintaining or establishing a monoculture in either operating system, programming language or IDE. Pragmatism drives our technology and environment choices.[1]

Choosing technology

Each project we work on has different requirements and we choose the tools and technologies that fit best. A good fit involves considering:

  • What exists in the project already?
  • How much work needs to be done?
  • What future directions could the project take?
  • How maintainable is the solution/are the technologies?
  • How appropriate are various technologies?
  • What do our developers know how to do best?
  • What do the developers who will maintain the project know best? What are they capable of?
  • Is there framework code available that would help?

History: Delphi and Java

When we started out in 2005, we’d also spent years writing frameworks and highly generic software. This kind of software is not really a product per se, but more of a highly configurable programmable “engine”, in which other programmers would write their actual end-user applications.

A properly trained team can turn around products very quickly using this kind of approach. It is not without its issues, though: maintaining a framework involves a lot of work, especially producing documentation, examples and providing support. While this is very interesting work, it can be hard to make lucrative, so we decided to move away from this business and focus on creating individual products.

Still, we stuck to the programming environment and platform that we knew best[2] (and that our customers were requesting): we developed software mostly in Delphi for projects that we already had.[3] For new products, we chose Java.

Why did we choose Java as our “next” language? Simply because Java satisfied a lot of the requirements outlined above. We were moving into web development and found Delphi’s offerings lacking, both in the IDE as well as the library support. So we moved on to using Eclipse with Jetty. We evaluated several common Java development libraries and settled on Hibernate for our ORM and Tapestry for our web framework (necessitating HiveMind as our IOC).

History: .NET

A few years later, we were faced with the stark reality that developing web applications on Java (at the time) was fraught with issues, the worst of which was extremely slow development-turnaround times. We found ourselves incapable of properly estimating how long it would take to develop a project. We accept that this may have been our fault, of course, but the reality was that (1 )we were having trouble making money programming Java and (2) we weren’t having any fun anymore.

We’d landed a big project that would be deployed on both the web and Windows desktops, with an emphasis on the Windows desktop clients. At this point, we needed to reëvaluate: such a large project required a development language, runtime and IDE strong on the Windows Desktop. It also, in our view, necessitated a return to highly generic programming, which we’d moved away from for a while.

Our evaluation at the time included Groovy/Grails/Gtk, Python/Django/Gtk, Java/Swing/SWT/Web framekworks, etc. We made the decision based on various factors (tools, platform suitability, etc.) and moved to .NET/C# for developing our metadata framework Quino, upon which we would build the array of applications required for this big project.

Today (2014)

We’re still developing a lot of software in C# and .NET but also have a project that’s built entirely in Python.[4] We’re not at all opposed to a suggestion by a customer that we add services to their Java framework on another project, because that’s what’s best there.

We’ve had some projects that run on a Linux/Mono stack on dedicated hardware. For that project, we made a build-server infrastructure in Linux that created the embedded OS with our software in it.

Most of our infrastructure runs on Linux with a few Windows VMs where needed to host or test software. We use PostgreSql wherever we can and MS-SQL when the customer requires it.[5]

We’ve been doing a lot of web projects lately, which means the usual client-side mix of technology (JS/CSS/HTML). We use jQuery, but prefer Knockout for data-binding. We’ve evaluated the big libraries—Angular, Backbone, Ember—and found them to be too all-encompassing for our needs.

We’ve evaluated both Dart and TypeScript to see if those are useful yet. We’ve since moved to TypeScript for all of our projects but are still keeping an eye on Dart.

We use LESS instead of pure CSS. We’ve used SCSS as well, but prefer LESS. We’re using Bootstrap in some projects but find it to be too restrictive, especially where we can use Flexbox for layout on modern browsers.

And, with the web comes development, support and testing for iOS and other mobile devices, which to some degree necessitates a move from pure .NET/C# and toward a mix.

We constantly reëvaluate our tools, as well. We use JetBrains WebStorm instead of Visual Studio for some tasks: it’s better at finding problems in JavaScript and LESS. We also use PhpStorm for our corporate web site, including these blogs. We used the Java-based Jenkins build server for years but moved to JetBrains TeamCity because it better supports the kind of projects we need to build.


The description above is meant to illustrate flexibility, not chaos. We are quite structured and, again, pragmatic in our approach.

Given the choice, we tend to work in .NET because we have the most experience and supporting frameworks and software for it. We use .NET/C# because it’s the best choice for many of the projects we have, but we are most definitely not a pure Microsoft development shop.

I hope that gives you a better idea of Encodo’s attitude toward software development.

[1] If it’s not obvious, we employ the good kind of pragmatism, where we choose the best tool for the job and the situation, not the bad kind, founded in laziness and unwillingness to think about complex problems. Just so we’re clear.
[2] Remo had spent most of his career working with Borland’s offerings, whereas I had started our with Borland’s Object Pascal before moving on to the first version of Delphi, then Microsoft C++ and MFC for many years. After that came the original version of ASP.NET with the “old” VB/VBScript and, finally, back to Delphi at Opus Software.
[3] We were actually developing on Windows using Delphi and then deploying on Linux, doing final debugging with Borland’s Linux IDE, Kylix. The software to be deployed on Linux was headless, which made it much easier to write cross-platform code.
[4] For better or worse; we inherited a Windows GUI in Python, which is not very practical, but I digress
[5] Which is almost always, unfortunately.

1 week Ago

John Oliver on the estate tax

Published by marco on in Finance & Economy

John Oliver’s new show on HBO is what some of us have always wanted the Daily Show to be. Oliver doesn’t self-censor, he doesn’t do pandering interviews and he does really, really in-depth segments. He did one recently on inequality.

“The federal estate tax does not apply to 99.4% of all farm estates. It also doesn’t apply to 99.86% of anyone’s estate. Basically, if you are not comfortable calling your pile of shit an “estate”, the estate tax probably doesn’t fucking apply to you.”

Watch the whole segment below.

Last Week Tonight with John Oliver: Wealth Gap (HBO) by John Oliver (YouTube)

2 weeks Ago

Should you return null or an empty list?

Published by marco on in Programming

I’ve seen a bunch of articles addressing this topic of late, so I’ve decided to weigh in.

The reason we frown on returning null from a method that returns a list or sequence is that we want to be able to freely use these sequences or lists with in a functional manner.

It seems to me that the proponents of “no nulls” are generally those who have a functional language at their disposal and the antagonists do not. In functional languages, we almost always return sequences instead of lists or arrays.

In C# and other functional languages, we want to be able to do this:

var names = GetOpenItems()
  .Where(i => i.OverdueByTwoWeeks)
  .SelectMany(i => i.GetHistoricalAssignees()
    .Select(a => new { a.FirstName, a.LastName })

foreach (var name in names)
  Console.WriteLine("{1}, {0}", name.FirstName, name.LastName);

If either GetHistoricalAssignees() or GetOpenItems() might return null, then we’d have to write the code above as follows instead:

var openItems = GetOpenItems();
if (openItems != null)
  var names = openItems
  .Where(i => i.OverdueByTwoWeeks)
  .SelectMany(i => (i.GetHistoricalAssignees() ?? Enumerable.Empty<Person>())
    .Select(a => new { a.FirstName, a.LastName })

  foreach (var name in names)
    Console.WriteLine("{1}, {0}", name.FirstName, name.LastName);

This seems like exactly the kind of code we’d like to avoid writing, if possible. It’s also the kind of code that calling clients are unlikely to write, which will lead to crashes with NullReferenceExceptions. As we’ll see below, there are people that seem to think that’s perfectly OK. I am not one of those people, but I digress.

The post, Is it Really Better to ‘Return an Empty List Instead of null’? / Part 1 by Christian Neumanns (Code Project) serves as a good example of an article that seems to be providing information but is just trying to distract people into accepting it as a source of genuine information. He introduces his topic with the following vagueness.

“If we read through related questions in Stackoverflow and other forums, we can see that not all people agree. There are many different, sometimes truly opposite opinions. For example, the top rated answer in the Stackoverflow question Should functions return null or an empty object? (related to objects in general, not specifically to lists) tells us exactly the opposite:

“Returning null is usually the best idea …”

The statement “we can see that not all people agree” is a tautology. I would split the people into groups of those whose opinions we should care about and everyone else. The statement “There are many different, sometimes truly opposite opinions” is also tautological, given the nature of the matter under discussion—namely, a question that can only be answered as “yes” or “no”. Such questions generally result in two camps with diametrically opposed opinions.

As the extremely long-winded pair of articles writes: sometimes you can’t be sure of what an external API will return. That’s correct. You have to protect against those with ugly, defensive code. But don’t use that as an excuse to produce even more methods that may return null. Otherwise, you’re just part of the problem.

The second article Is it Really Better to ‘Return an Empty List Instead of null’? − Part 2 by Christian Neumanns (Code Project) includes many more examples.

I just don’t know what to say about people that write things like “Bugs that cause NullPointerExceptions are usually easy to debug because the cause and effect are short-distanced in space (i.e. location in source code) and time.” While this is kind of true, it’s also even more true that you can’t tell the difference between such an exception being caused by a savvy programmer who’s using it to his advantage and a non-savvy programmer whose code is buggy as hell.

He has a ton of examples that try to distinguish between a method that returns an empty sequence being different from a method that cannot properly answer a question. This is a concern and a very real distinction to make, but the answer is not to return null to indicate nonsensical input. The answer is to throw an exception.

The method providing the sequence should not be making decisions about whether an empty sequence is acceptable for the caller. For sequences that cannot logically be empty, the method should throw an exception instead of returning null to indicate “something went wrong”.

A caller may impart semantic meaning to an empty result and also throw an exception (as in his example with a cycling team that has no members). If the display of such a sequence on a web page is incorrect, then that is the fault of the caller, not of the provider of the sequence.

  • If data is not yet available, but should be, throw an exception
  • If data is not available but the provider isn’t qualified to decide, return an empty sequence
  • If the caller receives an empty sequence and knows that it should not be empty, then it is responsible for indicating an error.

That there exists calling code that makes assumptions about return values that are incorrect is no reason to start returning values that will make calling code crash with a NullPointerException.

All of his examples are similar: he tries to make the pure-data call to retrieve a sequence of elements simultaneously validate some business logic. That’s not a good idea. If this is really necessary, then the validity check should go in another method.

The example he cites for getting the amount from a list of PriceComponents is exactly why most aggregation functions in .NET throw an exception when the input sequence is empty. But that’s a much better way of handling it—with a precise exception—than by returning null to try to force an exception somewhere in the calling code.

But the upshot for me is: I am not going to write code that, when I call it, forces me to litter other code with null-checks. That’s just ridiculous.

Optimizing data access for high-latency networks: part IV

Published by marco on in Programming

 In the previous two articles, we managed to reduce the number of queries executed when opening the calendar of Encodo’s time-tracking product Punchclock from one very slow query per person to a single very fast query.

Because we’re talking about latency in these articles, we’d also like to clear away a few other queries that aren’t related to time entries but are still wasting time.

Lazy-loading unneeded values

In particular, the queries that “Load values” for person objects look quite suspicious. These queries don’t take a lot of time to execute but they will definitely degrade performance in high-latency networks.[1]

 Lazy-loads for people are very fast queries

As we did before, we can click on one of these queries to show the query that’s being loaded. In the screenshot below, we see that the person’s picture is being loaded for each person in the drop-down list.

 Lazy-loading pictures

We’re not showing pictures in the drop-down list, though, so this is an extravagant waste of time. On a LAN, we hardly notice how wasteful we are with queries; on a WAN, the product will feel…sluggish.

What is a load-group?

In order to understand the cause of these queries, you must first know that Quino allows a developer to put metadata properties into different load-groups. A load-group has the following behavior: If the value for a property in a load-group is requested on an object, the values for all of the properties in the load-group are retrieved with a single query and set on that object.

The default load-group of an object’s metadata determine the values that are initially retrieved and applied to objects materialized by the ORM.

The metadata for a person puts the “picture” property of a person into a separate load-group so that the value is not loaded by default when people objects are loaded from the data driver. This is a good balance because business logic will avoid downloading a lot of unwanted picture data by default.

Business logic that needs the pictures can either explicitly include the picture in the query or let the value be lazy-loaded by the ORM when it is accessed. The proper solution depends on the situation.

Lazy-loaded property values

As before, we can check the stack trace of the query to figure out which application component is triggering the call. In this case, the culprit is the binding list that we are using to attach the list of people to the drop-down control.

The binding list binds the values for all of the properties in a metaclass (e.g. “person”), triggering a lazy load when it accesses the “picture” property. To avoid the lazy-load, we can create a wrapper of the default metadata for a person and remove/hide the property so that the binding list will no longer access it.

This is quite easy[2], as shown in the code below.

var personMetaClass = new WrapMetaClass(Person.Metadata);
var query = new Query(personMetaClass);

With this simple fix, the binding list no longer knows about the picture property, doesn’t retrieve values for that property and therefore no longer triggers any queries to lazily load the pictures from the database for each person object.

The screenshot of the statistics window below shows up that we were successful. We have two main queries: one for the list of people to show in the dropdown control and one for the time entries to show in the calendar.

 Just a single query for person data

Final version

For completeness, here’s the code that Punchclock is using in the current version of Quino (1.11).

var personMetaClass = new WrapMetaClass(Person.Metadata);

var accessToolkit = new PostgreSqlMetaDatabase().AccessToolkit;

var query = new Query(personMetaClass);
query.CustomCommandText = new CustomCommandText();
    "EXISTS (SELECT id FROM {0} WHERE {1} = {2})", 
var people = Session.GetList<Person>(query);

Future, improved version

Once we fix the but in the WhereExists join type mentioned in the previous article and add the fluent methods for constructing wrappers mentioned in the footnote below, the code will be as follows:

var personMetaClass = 

var accessToolkit = new PostgreSqlMetaDatabase().AccessToolkit;

var people = 
    new Query(personMetaClass).
    Join(Person.MetaRelations.TimeEntries, JoinType.WhereExists).

This concludes our investigation into performance issues with Quino and Punchclock.


You may have noticed that these calls to “load values” are technically lazy-loaded but don’t seem to be marked as such in the screenshots. This was a bug in the statistics viewer that I discovered and addressed while writing this article.

 Calls to 'load values' now marked as lazy loads


This is a rather old API and hasn’t been touched with the “fluent” wand that we’ve applied in other parts of the Quino API. A nicer way of writing it would be to create an extension methods called Wrap() and RemoveProperty that return the wrapper class, like so:

var personMetaClass = 

var query = new Query(personMetaClass);

But that will have to wait for a future version of Quino.