TuentiChallenge3. Are you in?

Posted on 2/25/2013 by Eng Outreach Committee 

We are pleased to announce that the third edition of Tuenti Challenge is about to begin. Starting today, whoever accepts the challenge can sign up to participate!
We’re very excited about this new edition and its novelties, but just in case this is the first time you’re hearing about Tuenti Challenge, let’s start from the beginning:

What’s #TuentiChallenge?

Tuenti Challenge consists of programming challenges and other tests that can be quite tricky, so contestants really have to give their brain a workout. It’s not a speed competition- the Tuenti Eng Team values the quality of solutions, code, and algorithms.

TuentiChallenge3

How does it work?

The contest is divided into two phases: the first will take place online and the second in our office. The winners of the first phase will be those with the top 50 scores and will receive a Tuenti prize pack. The score will be computed by taking into account the number of challenges solved and, if there is a tie, the time taken to submit the solution. Some challenges will have both a small and a large input, and both will be considered when calculating the score.

The solutions implemented by the 50 winners of the 1st phase will be manually reviewed by Tuenti’s engineers. They will consider automatic metrics along with other factors related to quality: the algorithm chosen, the quality of code, and cleanliness. The language chosen won't be considered in the scoring.  The top 10 of these winners will be chosen to participate the second phase that will take place in the office, and they will have the opportunity to spend a day working alongside our engineers, participate in incredible workshops and win awesome prizes. They could even end up working at Tuenti!

Past editions

During the following weeks, we’ll introduce you to some of the winners from previous editions, and they will tell you about their favourite challenges. Do you have any questions for them? Follow us in the official Tuenti Page or on twitter at #TuentiChallenge3

Here we go!

Mobile Libraries that worked well for us and might work well for you too

Posted on 2/05/2013 by Alberto Gragera, Davide Mendolia and Nuria Ruiz.

It seems like there is a never-ending stream of micro libraries that can be used in all types of ways, so we thought we’d share the libraries we use on m.tuenti.com. Here, we’ll explain why we chose them, what gaps we needed fill how they’re working for us.

The first thing we’d like to mention is this: If you are developing mobile web for a wide set of devices, the number of Javascript libraries you might need to use in the first version might be zero. Why? Because it’s possible that the mobile devices your users are using simply can’t execute Javascript, even if the devices say they can. And if when you are thinking about mobile devices you are only thinking “phones” your definition might be too narrow.

There is an awesome presentation about what constitutes a mobile device by yibu:

As they very well explain, “the most popular devices do not necessarily translate to the most used devices”. In Tuenti’s case, there are couple devices on the most used devices list that cannot execute Javascript at all. Also, number 4 on that very same list is the iPhone.

In order to be able to support users with fancy smartphones and also users with devices that cannot really execute Javascript (or render any fancy CSS), we decided to have two versions of the mobile site. A “basic” version for the so-called feature phones and a “rich” version for so-called smartphones. There also exists the possibility that someone is browsing m.tuenti with a smartphone using a browser like Opera Mini. In that case, regardless of how cool or awesome your phone is, you will see the “basic” version. Additionally, a very basic version of your website for mobile is very handy because it can be easily used by old desktop browsers like IE6. We currently redirect all our IE6 traffic (we still have a small amount) to the basic mobile version of our site. Since the “basic” version is really basic, IE6 works well (and fast!).

You thought this post was going to be about Javascript mobile libraries, right? It is, but in our opinion, it’s definitely worth emphasizing that you can do mobile without Javascript.

When picking libraries, we ideally like for them to be well maintained, have full webkit support (since our rich version is geared towards webkit-based browsers) and provide value for weight.

There are only three main things we were looking for in a mobile Javascript framework: DOM methods, ajax ground work (like serializing forms) and delegates support.#

Zepto provides all three but only for webkit browsers. We took some time to evaluate the feature gap to make Zepto support Windows Phone and, while it’s doable, it seems that Windows Phone browser functionality is still too up in the air to be worth it.

For example, Microsoft decided to name touch events in a way that was different from what the W3 recommended (W3C Candidate recommendation) and this means that the touch event layer would need to be abstracted away to account for these differences

There is also the issue with __proto__.  Zepto uses the __proto__ property to extend the object’s prototype and add functionality while maintaining a reference to the original constructor’s prototype#. __proto__ is a non-standard property, but it come with EcmaScript 6. Sadly, it’s supported for the majority of modern browsers except for IE, regardless of the version. If you use any of the inheritance models out there rather than the __proto__ property, then a good chunk of the Zepto library works (~180/200+ tests start to pass).

For the time being, we aren’t modifying Zepto in any way. We use it as is, and we decided to downgrade Windows Phones to the “basic” (without Javascript) version. Since the mobile landscape is ever-changing, we might need to revisit this decision in the near future if we get more Windows Phone users.

The other winner when it comes to mobile libraries is the widely used FastClick maintained by FT Labs.. It solves the delay issue with touch events and clicks#. Kudos to this team - although we found a small bug with iOS4 support, they were very proactive when we suggested a solution.

While in theory most modern webkits support query selector well, we found that that was not the case for some of the Nokias we support in the “rich” version. There is a whole world out there with the many flavors of wekbkit in Nokia devices. For those browsers that do not support querySelector, we also add sizzlejs to the mix.

More than on the desktop, on mobile it is important to reduce the number of requests as much as possible, so you want to be careful when bundling together the Javascript that changes at the same rate. That is, all libraries that constitute your Javascript framework could be bundled together. Assuming that they do not change much, once downloaded they would be cached “forever” (if your cache headers are done well, etc). The Javascript that pertains to your features can be bundled in a separate bundle that will be updated more frequently. While this implies you would be doing at least two requests at the beginning of a session, it also implies a bigger cache hit ratio over the life of your application since only one of the bundles is updated regularly.

Just like you can do on a desktop, you can also do dynamic downloads of Javascript from the client on a per feature basis. While this strategy works great on the desktop (and that is what we do on tuenti.com) it does it not work so well for mobile because we want to reduce the number of requests as much as possible. However, we are still investigating approaches on Javascript loading on mobile and we’ll discuss our results in a future blog post.

Open Space Event

Posted on 1/29/2013 by Tuenti Eng Outreach Committee

If you follow us on twitter, you probably know that we love hosting tech events in our offices. Last Jan 19th we received the visit of almost 60 folks attending an Open Space meeting about Persistence. This group has been created to talk about how to deal with Persistence issues such as NoSQL, APIs, migrations, data access patterns or Big Data.

Thanks to our friends @decharlas for sending us these amazing pictures of the event (by @hell03610

It sounds interesting, right? Stay in the loop, we’ll keep you posted about more events like this!

A promise is a Promise - Tuenti's talk at dotJS

Posted on 1/18/2013 by David Iglesias, Senior Engineer

Last 30th November some of us attended to the first dotJS, the largest JavaScript Conference in France. Although it wasn’t planned, I had the chance to talk about solutions to synchronize events in JS and not give up in trying.

Does that sound familiar to you? Check the presentation out!

Pages

Follow us