Realm Blog

Pedro on 8fit

8Fit App Screenshots

We know Pedro Piñera because he’s been helping us with our Spanish documentation (for Cocoa and Java), but he also does some amazing development work. Here he discusses his involvement with 8Fit, an exercise and diet app that immediately impressed us, along with a side project of his called SugarRecord, a data management library written in Swift incorporating both Core Data and Realm.

Tim Anglade, VP of Product at Realm: Where are you based in Spain?

Pedro Piñera: I live in Barcelona right now. I’m from Murcia. I studied in Valencia, but I ended up in Barcelona because I was hired by a company called Redbooth. And two months ago I moved to my new company, called 8Fit.

Tim: Was it a big move for you? I know there’s a lot of pride about which area of Spain you grew up in and where you live. There’s a big difference between Valencia and Barcelona. Or are people pretty modern about it now and just move wherever they need to?

Pedro: It was something very new for me because, as you mentioned, Valencia and Barcelona are very, very different. I like Barcelona. There are a lot of people here starting amazing projects. I’m forming a lot of relationships and meeting new, interesting people in the mobile development world. I prefer living here in Barcelona.

T: Barcelona is the center of the tech scene in Spain. It’s much bigger and much more vibrant than Madrid, I guess, at this point.

P: Yeah, it’s much more in contact with Europe than Madrid is. I meet a lot of people here in different meetups related to iOS and Android development.

T: How did you first get into mobile app development?

P: I started in 2010 because someone at the university mentioned C. I didn’t know about it. Then I started doing some development in C, and later in something like MATLAB. I don’t know if you know about MATLAB, but it’s a programming language related to mathematics.

Later I did some Java, but I didn’t like it so much. Then I got my first iPhone and started reading some documentation around 2010. I ended up doing small applications. Later I built a big application. I fell in love with the platform, developing for iOS.

I ended up at Redbooth a year ago. I was working not only on applications but different open-source projects. I did Android too. I actually started falling in love with Java. Then I became a mobile developer.

Pedro Buendia

T: And you’re still doing a mix of iOS and Android?

P: Yeah, right now I’m working with Java, Objective-C, and Swift.

T: Now you work for this company called 8fit. Can you explain a little bit about what 8fit is, what the app does?

P: The idea behind 8fit is to help people get into shape. When people get to be around 30 years old, they don’t get any exercise. We want people to exercise every day.

It’s not difficult. All you need is a house, a place where you can do some pushups and different kinds of simple exercises. We want people to feel better and have a healthy life.

T: The idea is to make exercise part of your daily life.

P: Yeah, exactly. It’s a mix of custom exercise plans. Then we offer you different meal plans and a diet that you can follow at home. Doing these things will help you feel better and change your life for the better.

T: What I like about it is that it’s not just a tracker for different metrics like the calories you’ve ingested or the calories you’ve worked off or your weight or stuff like that, but it also has this nutrition element and covers the full cycle of it. It seemed like a pretty nice, comprehensive view.

P: We took a look at different apps. As you said, they’re just for tracking information. I weigh 70 kilos or I ate that food. We wanted to offer you what you should do, what you should eat, how you should exercise. That’s more or less the idea.

We track your progress — not the small metrics, just the progress. Then we offer you different recommendations. We encourage you to play some sports, do some exercise.

T: I really like it. To some extent, I feel like the current system is like the current devices you can buy. It’s all about tracking. It’s very passive. I think the next frontier is giving you the other side of that — giving you active advice and sending reminders.

P: Exactly, we want to be an active application. We even want to integrate with platforms like GoogleFit and HealthKit, just so users have that information.

Imagine you are a runner, and you use an application like Nike+ or RunKeeper to track your races. We want to bring that information into our platform and use that information to make your programs adaptive, letting you know about what you should be eating that day and stuff like that.

T: How is the application built, both for iOS and Android? What kind of components do you use internally? What kind of libraries do you use to build the application?

P: We started with Web applications. The reason is because the two developers who started the company were both Web developers. They wanted to have the platform as soon as possible, and they knew about the Web, so the best option was a mobile app, with a Web app inside.

Then they started the application. In approximately two months, they had the app ready for both platforms. We built something called Bridge that is a native component to bridge the Web with the different native components like payments, videos, and other kinds of integrations.

The application is a Web app, but we wanted the payments, for example, to be done natively. Why? It’s easier for the user to make an in app purchase, instead of having to introduce credit card numbers.

T: Nice. I see that being a popular way to do HTML5 apps now. Are you using PhoneGap and then using plugins inside of PhoneGap, or did you use the JavaScript bridge natively?

P: No, we’re not using any kind of framework like PhoneGap. On the website, we are using Backbone and Underscore for JavaScript, but on the native side we’re not using any small frameworks to make our development faster.

We just built the components because we knew mobile. I’m a mobile developer, so I was able to do that. We’ve been building the Bridge using Objective-C and Java. It’s not difficult to do. Native components, I build them.

T: Nice. That seems like a really powerful, fine-tuned approach. That way, you can just do the HTML5 and JavaScript for the UIs specifically and then you do everything else native.

P: We wanted to have something custom because if you decide to use PhoneGap, you have to look at the documentation to see if there is any kind of plugin existing to do what you want to do. You have to use that plugin, and if you want something a bit different, you have to modify the plugin, make a proposal of your changes.

Why go through that? We need something, we develop it.

T: I spent quite a bit of time in the PhoneGap world. I have a ton of respect for their library, but a lot of time the plugins aren’t very well maintained or they’re buggy or PhoneGap itself is buggy. You end up wasting so much time. You’re right. If you know native development and you know HTML development, it’s very well built into the libraries for both Android and iOS.

P: PhoneGap is great if you are a Web developer and you don’t want to spend time learning how to start your project on Android Studio or in Xcode. That’s OK. If you’re not going to use a lot of plugins, PhoneGap is a good solution. But if you want something more custom and you have a mobile developer, why not build it yourself?

T: Absolutely. How do you use Realm in relation to all of that? I’m assuming it’s in the native part because we haven’t made anything available for JavaScript yet. Can you talk a little bit about how Realm connects to the rest of the application considering your setup?

P: We use Realm because we do some kinds of local persistence of data. We wanted to show a widget on the application, so we had to persist data information — data about food, about diet. The only way to do that is persisting the data locally. We bring in different information about the user locally too because we constructed the small pieces of the application in a native way. The information related to those fields has to be on a local persistent system.

I decided to do it with Realm because I learned about Realm some months ago. I like it. The syntax is very simple. It’s very easy to use.

I’ve had a lot of headaches using Core Data contexts and SQLite, and Realm was beautiful.

T: Awesome. Was it hard to add Realm to the application? Did you have any persistence before, or did you just add persistence with Realm?

P: We didn’t have persistence before. We had to make a choice and the choice was Realm. The integration was very easy, very simple to do. We didn’t have any problems. We’re very happy with it.

We’re following your updates. The products you are doing with the library are amazing.

T: Thank you so much. Is there anything you don’t like about Realm so far? Anything that you wish we would improve or would add to the library?

P: The truth is that so far, we haven’t had any problems with Realm. Of course, if we find anything, we will let you know.

T: I’m very happy to hear that. I have trouble believing that you haven’t hit any issues, but I am happy to hear that nonetheless. [Laughter]

Are there any other cool technologies that you’re either following or very interested in trying out next?

P: We’re trying out Swift now. We like it. We’re building those small components I mentioned on Swift, and we are very happy with it. I’d recommend developers start using it.

T: Are there any particular features coming to the application or releases that people should look out for?

P: Yeah, we are working on widgets for the platform. We’re working to integrate with HealthKit and GoogleFit.

We’re trying to refactor the workouts. We want to do it native because it’s currently just on the Web. People want to have them full screen. Then we are going to make the workouts more interactive. I think people are going to like the changes.

T: Sounds great. Maybe we can also talk a little bit about your other project. You’ve been working on this ORM library on top of Realm and Core Data called SugarRecord. Can you give a quick overview of how you would explain the project to other people?

P: I started working on SugarRecord because, first of all, I wanted to learn Swift. I read the book and I thought it wasn’t enough. Why not start a new library? I saw people moving existing Objective-C libraries to Swift. I decided mine was going to be a data persistent library. And I thought about Magical Record why not having another records for Swift?

Then I thought of SugarRecord. It’s a kind of wrapper to work with databases, but in an easy way. Instead of having to deal with context, with threads, with difficult stuff, it has an easy syntax.

Another thing I did with the library is have compatibility with both Core Data and Realm. Why? If you start using SugarRecord and you start using it with Core Data, then suddenly you want to change into Realm, the only thing you have to change is the database. You don’t have to change the syntax because it’s the same. I think it will be good for those developers who are planning to move to Realm in the future.

T: Absolutely. It comes up every now and then that people really want to be able to easily move from one to the other and not be tied into a specific library.

P: I’m trying to improve it every day, but I have to do it in my free time. I don’t have a lot of free time.

T: I was really surprised by the quality of the library and the design and the documentation you have. You have this cool review of how it’s built and what it does. I really appreciate all the time you’ve been putting into it.

P: I put a lot of effort into the documentation. I wanted it to have great documentation and be perfectly clear. I had Realm as a reference. I wanted it to be easy to bring to users’ projects.

T: It looks really, really cool. Now I see you’re even using Jazzy for the documentation, so I’m even more excited. I definitely encourage people to check it out. You have a website now, SugarRecord.com. And you’re on GitHub. People should take a look.

Thank you so much for the time, and best of luck with everything. I know I’ll be keeping an eye on your products in the future.

P: Thank you.


Realm Team

At Realm, our mission is to help developers build better apps faster. We provide a unique set of tools and platform technologies designed to make it easy for developers to build apps with sophisticated, powerful features — things like realtime collaboration, augmented reality, live data synchronization, offline experiences, messaging, and more.

Everything we build is developed with an eye toward enabling developers for what we believe the mobile internet evolves into — an open network of billions of users and trillions of devices, and realtime interactivity across them all.

Get more development news like this