SQLAlchemy in batches: Generating a top playlist

SQLAlchemy is arguably the most powerful and ubiquitous ORM framework for Python.

At Oursky, we have been using SQLAlchemy for quite a period of time and appreciated the flexibility and elegance it provides over the Data Mapper abstraction. No doubt, it works very well for modern web applications but what about long-running background jobs? Would the abstraction get in your ways? (tl;dr: yes, but we still prefer it)

Here are some hands-on experiences from us.

We built a popular iOS application with a song recommendation system at the backend. The system suggests a top list for 20 popular songs.

Previously our editors hand-picked popular songs by download count and gather a new playlist as a recommendation to users. Now, we want to automate this process and generate the playlist weekly.

Continue reading “SQLAlchemy in batches: Generating a top playlist”

Geek’s way to say things

developer's way to say things

We geeks often have our own ways to express, which might be too geeky for normal people to understand.

Here are some general guides to help you communicating with your geek friends (at least knowing what they are thinking about… )

1. “X is a subset of Y.”

x_subset

Spoken by Computer Scientists to say that X is a kind of Y, but Y is not X.

Real life examples:
“Matcha is a subset of Green Tea. They are different!”

Continue reading “Geek’s way to say things”

VIPER – iOS App Architecture Beyond MVC (Mega-ViewController)

The MVC Architecture is generally used in developing iOS applications.

However the “ViewController” approach widely used is the most evil part that messes up Views and Controllers: Developer writes both view animation and business logic in the UIViewController, hence introducing a MEGA-ViewController.

In this passage, we will share our experience on how VIPER saves our lives from this monster in one of our projects.

VIPER is not a framework  but an approach to iOS application architecture, which stands for:

  • View
  • Interactor
  • Presenter
  • Entity
  • Routing(Wireframe)

The “MVC” monster

mega-viewcontroller monsterTypical Model objects are simple, they are just NSManagedObject.

View and Controller are wrapped in a single UIViewController class. The UIViewController class constraints the fundamental view management of the iOS app. As the name convention suggests,  view controllers often handle both business logics and logics for responding to user interactions.

Continue reading “VIPER – iOS App Architecture Beyond MVC (Mega-ViewController)”

Hands on Realm Database for Android projects

In one of the Android app projects at Oursky, we started using Realm for data caching. So users won’t have to look at blank pages when they log back to the app, waiting for remote API results.

We think it’s a minimalistic yet reliable solution, and is worth giving it a shot for your next app. Just beware of the differences between versions, follow the conventions, and pay extra attention when using with other libraries.

More is discussed below in details and with example snippets.

What is Realm?

Realm Database
Realm Database

Realm is the mobile database solution that  proposed as  a replacement for SQLite & Core Data.

It’s like using SQLite with an ORM (as those who used SQLAlchemy may have experience), with a lot of awesome and convenient methods for data transactions.

However, Realm is NOT built on top of SQLite. It persists on its own persistence engine.

Realm is  also cross-platform that supports both iOS and Android, so developers who write Java, Swift, Objective-C can share the same Realm files painlessly.

Continue reading “Hands on Realm Database for Android projects”

Continuously Delivering iOS Beta Builds Automated with Travis CI

Over the years, we’ve been building loads of nicely-crafted iOS applications for our clients.

To keep everyone work closely, we send daily builds to our QA Team, beta users, clients, other team members. However, building an iOS is still painful for Project Manager — It involves compiling, uploading the app to TestFlight or HockeyApp,
setting up  Crittercism for collecting crash reports (Those who have experience, should know that you have to upload dSym files for symbolic debug messages), notify everyone on Slack, etc.

Much better if we can automate all these with each Pull Request.

Continue reading “Continuously Delivering iOS Beta Builds Automated with Travis CI”