Analysis / Top Stories

This Week in Programming: Abstraction, ORMs, and Fixing the Fixes

30 Jun 2018 6:00am, by

Abstraction can be a tricky thing — solve one problem just to arrive at another. I still remember the first time I used Dreamweaver (back then, it was Macromedia Dreamweaver) and I thought I’d sworn off using a straight text code editor ever again. I resized tables (that’s right, tables) and rows and cells left and right until everything looked just right. Suddenly, web design was a breeze! No more tedious tweaking by the numbers — and then manually uploading by FTP and refreshing — this did it, seemingly magically, and right in front of my very eyes!

And then I took a look at the code. Holy hell, it was UGLY. And let’s not even talk about the load times for these web pages — they were not only ugly but HUGE as well. With every mouse click and drag of a table border, the code generated was increased exponentially. At least, that’s how it appeared. I quickly returned to my text editor and didn’t look back.

Now, the likes of Dreamweaver and WYSIWYG editors aren’t really our topic at hand, but rather another type of abstraction (and the problems that can come with abstraction) that is likely much more commonly used these days — Object Relational Mapping frameworks or ORMs for short. This week, Adrian Coyler — who daily examines a different computer science paper — takes a look at a study that discusses how not to structure your database-backed web applications, which he calls “a fascinating study of the problems people get into when using ORMs to handle persistence concerns in their web applications.”

Before we go any further, here’s a quick little explanation of ORMs you can read through. The TLDR is this: ORMs handle your database queries, mapping out databases to objects for you to manipulate directly within your code. Basically, ORMs did what most frameworks do and made it easier to code by abstracting a complicated interaction into a uniform set of more easily accessible tools — in this case, replacing most of your complicated SQL queries with more familiar object manipulation.

In the study, the authors choose a dozen popular, well-known Ruby on Rails web applications, such as Lobster, Gitlab, OpenStreetMap, and Diaspora, and test their performance to “distil a catalogue of common performance anti-patterns.”

“There are a bunch of familiar things in the list, and a few that surprised me with the amount of difference they can make,” Coyler writes. “By fixing many of the issues that they find, Yang et al., are able to quantify how many lines of code it takes to address the issue, and what performance improvement the fix delivers.”

The authors find that the problems with these apps, which lead to increased server time and page load time, can be broken down to three basic areas: ORM API misuse, database design, and application design. In the end, “more than 78 percent of fixes require fewer than 5 lines of code” with server times “reduced from 3.57 seconds to 0.49 seconds, and the end-to-end page load times from 4.17 seconds to 0.69 seconds.”

For the full details, Coyler’s write-up of the paper is certainly worth the read, but you can also access the Hyperloop website, which “provides access to a tool you can use to identify and solve some of the common performance issues in your own (Rails) apps.”

There’s just something about the fact that one problem — the difficulties of dealing with database queries — led us to ORM frameworks as the solution, and then this solution led us to new problems, and a new tool to identify and fix that problem. Ahh, the great and wondrous cycle of abstraction.

This Week in Programming

  • GitLab Ditches Azure for Google Cloud Platform: In a move that (pinky swear) isn’t just a PR stunt to continue riding that #movingtogitlab wave, GitLab announced this week that it plans to move from Microsoft Azure to Google Cloud Platform “as part of its plan to improve the performance and reliability of GitLab…so that it could run GitLab on Kubernetes.” SDTimes writes that this follows a move from earlier this year, when GitLab “shipped native integration with Google Kubernetes Engine (GKE), which has the most robust and mature Kubernetes support available.” This move to Google Cloud Platform was just the next step in the already-in-motion plan, they say. As for the move itself, GitLab offers a plethora of details on just how it will be done, assuring that their “absolute top priority for the failover is to ensure that we protect the integrity of our users’ data.” The move is currently slated for July 28th, 2018.
  • Java SE as a Service: Oracle announced this week that it would begin offering Java SE as a subscription service, which ADTMag says is “aimed at enterprise Java users” and “will be offered as a complement to Oracle’s existing free releases and OpenJDK ecosystem.” According to the announcement, the service “removes enterprise boardroom concerns around mission-critical, timely, software performance, stability and security updates” and will be available as a monthly subscription for $2.50 per user.
  • Python 3.7 Adds Data Classes and Typing Supports: Python 3.7 arrived this week, bringing several new features, which seem to be most easily summarized by this Reddit comment: “1. Data classes, yay! Good step. 2. More typing support: awesome, this was such a nice inclusion. 3. Context… necessary, but not sure it will save the dumpster fire that is asyncio stuff in Python.” JAXEnter also does a nice job of summarizing the changes, writing that “In a nutshell, Python 3.7 is fast. Wave goodbye to the slow lane, because Python is is revving up.”
  • Rust 1.27 Adds SIMD and New Trait Object: Rust 1.27 also arrived this week with “two big language features that people have been waiting for.” The first feature, SIMD, which stands for “single instruction, multiple data” and looks like some pretty nitty gritty stuff, but one HackerNews commentator summarizes as unlocking “the power of the GPU-esque parallelism that is already inside your CPU.” The other big feature, the dyn Trait, redesigns Rust’s trait object syntax, which the announcement says “is one that we ultimately regret.” And beyond that, in the language’s continuing effort to make learning Rust easier, it also announced that all books in the Rust Bookshelf are now searchable.
  • Eclipse IDE Gets Full Rust Support: And while we’re talking about Rust, the new Photon release of Eclipse IDE now ships with full Rust support. According to the announcement, the release “delivers native Eclipse IDE experiences for Rust and C# through Language Server based plugins.” In addition, the latest release adds support for building Java 10 and Java EE 8 based applications and adds dark theme improvements.
  • The Big Blue Blockchain: What week goes by without a blockchain announcement? This one is no exception (and we’re not even really mentioning that whole $300M blockchain fund thing). IBM announced that its IBM Blockchain Platform Starter Plan is now generally available. The platform “was introduced as a way for anyone to access the benefits of the IBM Blockchain Platform regardless of their level of blockchain understanding or production readiness,” the company writes in its announcement. SDTimes writes that “IBM is continuing its effort to democratize blockchain technology for developers…[with] the tools for building blockchain proofs-of-concept and an end-to-end developer experience.” The platform runs on the open-source Hyperledger Fabric framework and comes with $500 in credit for startups, as well as a test environment, a suite of education tools and modules, network provisioning, access to IBM Blockchain Platform Enterprise Plan capabilities, and code samples on GitHub.
  • A Tube for Developers: And finally this week, a video aggregation site specifically for developers — DevTube. Just as you might expect, DevTube is a collection of developer videos that can be sorted according to topic or speaker on a variety of dev-related topics. Go forth and browse!

Google and Microsoft are sponsors of The New Stack.

Feature image via Pixabay.


A digest of the week’s most important stories & analyses.

View / Add Comments

Please stay on topic and be respectful of others. Review our Terms of Use.