Introduction to MVVM for iOS

Standard

Most of iOS Developers are familiar with MVC (Model-View-Controller). Some call it Massive View Controller. That’s certainly how it felt at the time. One of the key architectural changes I would make would be to use an alternative to Model-View-Controller called Model-View-ViewModel (MVVM).

Model-View-ViewModel (MVVM) is basically another architectural paradigm for GUI applications. Although it seems similar to MVC (except with a ViewModel object in place of the controller), there’s one major difference — the view owns the view model. Unlike a controller, a view model has no knowledge of the specific view that’s using it.

There are three really important points about MVVM:
– MVVM is compatible with your existing MVC architecture.
– MVVM makes your apps more testable.
– MVVM works best with a binding mechanism.

Devops – Culture

Standard

Some of us, when talking about Devops, will say that DevOps is about a role who manage or create tools that automates things e.g. CI/CD. But another people will see that Devops is about culture.

At ChefConf 2015, Adam Jacobs delivered a great presentation about Devops titled Chef Style Devops Kungfu. This presentation talked about Devops movement, Devops definition and building Devops practice through repetition and skill development.

Continue reading

Apache Thrift

Standard

Apache Thrift website define Thrift as a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml, Delphi,and other languages.

In simple word, Thrift allow programming language in client side to communicate directly to server side (usually called RPC or Remote Procedure Call) although in different languages. Almost all step handled by Thrift, we just implement the function in server side, using any programming language (which is supported by Thrift) and use that function in client side by calling  that directly, even with another programming language.

Take a look to this presentation for more information:

 

To use Thrift, write the Thrift definition file which contains interface and variable definition, and then build it. Thrift will generate code for both client and server, and we just input code for implement the function. As you can see in slide 3 (Thrift architecture), we just do the top part in architecture and let Thrift handle the rest.

Laravel 5 – Event & Queue

Standard

Laravel’s has their own implementation for observer (event handling) and queue implementation. Laravel’s event handling allowing you to subscribe and listen for events in your application.  The Laravel queue service provides a unified API across a variety of different queue back-ends.

This presentation try to give a simple example about laravel’s queue and event handling.

Resolve Duplicate Permission Problem in Android Package

Standard

Android application has unique identifier called package name to prevent duplicate installation. The standard convention name for Android package name is reversed web URL.

In development process, developers may need to separate application into some versions for testing purpose. For example, we need beta version to be tested before it’s released on the marketplace. We can separate them using different flavors definition in gradle script.

But it can be problem when we use the package name in the manifest file. So we may need to adjust the manifest too.

For example, if we use GCM (Google Cloud Messaging) to enable push notification we need to add permission with unique name (so it has to be the package name). So for different package name it need different permission or there will be problem with duplicate permission. Here we need to define another permission with specified package name and remove the previous permission definition when merging the manifest.

These are the sample code of different manifest file for different package name in different flavor.
Main AndroidManifest.xml

<permission
android:name="com.packagename.app.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.packagename.app.permission.C2D_MESSAGE" />

Beta AndroidManifest.xml

<permission
android:name="com.packagename.app.permission.C2D_MESSAGE"
android:protectionLevel="signature"
tools:node="remove" />
<uses-permission
android:name="com.packagename.app.permission.C2D_MESSAGE"
tools:node="remove" />

<permission
android:name=”com.betapackage.app.permission.C2D_MESSAGE”
android:protectionLevel=”signature” />
<uses-permission android:name=”com.betapackage.app.permission.C2D_MESSAGE” />