Gilt Tech

Sep 02

#gilttech Celebrates #wear-white-after-labor-day Day

image

The Gilt tech team abstained from spaghetti and chocolate ice cream to join forces against the outdated fashion rule about not wearing white after Labor Day. Nobody accepted this author’s offer to dress as Princess Leia or the Abominable Snowman, but Senior Software Engineer Michael Chimirev pretty much won the day with his ensemble:

image

Aug 29

Check out Gilt’s Cool New Office Space in Dublin!

image

This week the Gilt team in Dublin, Ireland moved to a new space in Dublin 4. Everyone’s settling in nicely, and we’ve already had a party to celebrate the move!

"As you come through our front door, you are greeted with a large meetup/hangout space and a well-equipped open plan kitchen, perfect for getting everyone together,” says Senior Program Manager Deirdre O’Brien of the new space. “The general office area has a few large open spaces with beanbags and hot desks for teams to regroup.” Here are Principal Software Engineer Gregor Heine and Senior Systems Engineer Anders Holm demonstrating how to “work-lax” in the space:

image

We’ve separated team areas with glass partitions with integrated “whiteboards” while still retaining much of the vibe that defines #gilttech’s open, communal office culture:

image

The new office includes four spacious meeting rooms named by Software Engineer/Email team Michal Kowaliszyn: Phoenix, Herbert, Fitzwilliam and Merrion:

image

We’ve kept the “whiskey shelf” and “green” beer fridge. Big thanks to Gilt Ireland COO Fidelma Healy and IT Services Manager Glenn Conlon for managing the move and creating a fabulous space for Dublin Tech!

Aug 27

Scenes From Gilt’s Free Go Class

image

On Friday, Gilt hosted a free day of instruction in Go—the latest NYC installment of our free tech course series. Leading the class was BoardRounds Co-Founder/CTO Aditya Mukerjee, who covered Go basics and highlighted the language’s advantages. Here’s Aditya in action:

image

Friday’s class had great turnout from our own team—here are Scott Thompson and Will Chiong from #gilttech personalization, and Paolo Lim from the Gilt City team:

image

There are four #gilttech engineers in this photo—can you spot them?

image

Front-row focus:

image

After the class, attendee Tim Heaney (who traveled all the way from Maryland to join us!) wrote his own recap of his experience at Gilt:

Thanks to everyone who applied and attended! And big thanks to Aditya for spending the day teaching!

Aug 26

Welcome, Natalia Bartol!

image Gilt says “dzień dobry” to Natalia Bartol, who recently joined our engineering in team in Dublin, Ireland! Natalia is a passionate software engineer and open source contributor who will work on continuous delivery at Gilt. Originally from Poland, she moved to Dublin nearly four years ago and has been getting used to Irish weather ever since. “I eventually fell in love with the taste of Guinness and even started to appreciate windy weather and the cold sea, as I recently took kite-surfing lessons,” she says. “I also enjoy rock-climbing, skiing and… shopping.
Discovering Gilt brings about both fascinating technological challenges and a fashion thrill :-)”

Welcome, Natalia!

Aug 25

An Intro to Swift (Slideshow)

Here are the slides from Gilt Senior Software Engineer Yoshi Sugawara’s talk last week in Honolulu, Hawaii. Enjoy!

Modularity and the iOS Status Bar Network Indicator

image

Gilt recently released Mockingbird Toolbox, an open-source project for iOS intended to make common development tasks easier. The Toolbox is the basic building block of Mockingbird library, which will be released in stages over the coming months. Mockingbird serves as the base layer of Gilt’s award-winning iPhone and iPad applications.

This post is the first in a series that will be highlighting the code available in Mockingbird Toolbox and explaining how you can use it in your iOS projects.

Modularity

Modularity in software design is a key strategy for managing complexity. A well-crafted code module is:

When separate modules need to interact with a shared resource, modularity becomes more difficult to attain.

In order to be well-behaved, modules need to use shared resources in a way that recognizes the fact that other modules may be using that resource, too.

One way to try to account for that might be to introduce a mechanism for modules to communicate with each other to ensure proper behavior with respect to the shared resource. But doing so would make the modules less focused and isolated.

Gilt’s mobile team faced these sorts of design decisions during the evolution of our iOS apps. One generic solution we built was the MBServiceManager class, which we’ll discuss further in a future post.

But there was one specific shared resource that required its own solution: namely, the network indicator that appears in the status bar.

The Status Bar Network Indicator

The network indicator is the animated spinner that you sometimes see in the status bar, typically to the right of the other network information in the upper-left corner of the device screen.

The spinner doesn’t appear automatically; instead, applications are responsible for turning it on when they’re using the network, and turning it back off once they’re done. Displaying the network indicator is entirely optional, but polite applications are honest about when they’re consuming the user’s bandwidth.

Applications control the spinner through the UIApplication’s networkActivityIndicatorVisible property. Setting the value to YES causes the animated spinner to appear. Setting the property back to NO hides the spinner.

You might think that managing the network indicator is as simple as setting networkActivityIndicatorVisible to YES when an operation starts and back to NO when it finishes, but consider what happens when an app sends multiple network requests:

  1. Network operation A starts
  2. Network operation B starts
  3. Network operation B completes
  4. Network operation C starts
  5. Network operation A completes
  6. Network operation C completes

Under this scenario, the spinner should be animating from Step 1 through Step 6.

But that’s not what happens if we directly manipulate the networkActivityIndicatorVisible property at the start and end of each request. Instead, we get this behavior:

  1. Spinner appears
  2. Spinner animating
  3. Spinner disappears
  4. Spinner appears
  5. Spinner disappears
  6. Spinner remains hidden

Half the time, the network indicator is reflecting the wrong state.

Because the beginning and end of different network operations can be interleaved, the fact that there is only a single on/off value for the network indicator becomes problematic. If more than one set of code attempts to directly manipulate the value of networkActivityIndicatorVisible, we will get unexpected results.

Network Indicator Coordination

To avoid this problem, we decided upon creating a coordinator for the network indicator. The coordinator provides a simple interface for reporting when operations begin and end. Wherever network operations are performed, our code interacts with the coordinator, which in turn decides when to show and hide the spinner based on what’s happening across the entire application at any given moment.

The coordinator was designed to:

Introducing MBNetworkIndicator

The public interface to our coordinator is provided by the MBNetworkIndicator class, part of the Mockingbird Toolbox open-source project.

Any code that issues network requests can maintain one or more MBNetworkIndicator objects. Each instance is intended to represent one or more related network operations occurring on a single thread. While those operations are in progress, the MBNetworkIndicator instance is kept around, and is notified when operations begin and end.

The API consists of three instance methods:

Implementation

Every MBNetworkIndicator instance maintains a counter of network operations that is incremented for each call to its operationStarted method and decremented for each call to its operationFinished method.

Calls to those methods also update a master counter, which keeps a single, application-wide count of in-progress operations.

You can think of it this way:

Whenever the master count of network operations is greater than zero, the status bar network indicator is displayed. Otherwise, when there are no operations, the indicator is hidden.

Canceling Operations

Let’s say you have a UINavigationController-based app, and any given UIViewController pushed onto the navigation stack could result in multiple network requests being issued. Further, you handle the user tapping the Back button by hooking into viewWillDisappear: to cancel any network operations that haven’t yet finished.

In such a case, you might opt to have each UIViewController maintain its own MBNetworkIndicator instance. You would call operationStarted and operationFinished as requests are processed normally. But within viewWillDisappear:, you would call cancelOperations to signal that all pending operations for that view controller have been cancelled.

Calling cancelOperations is equivalent to calling operationFinished once for each pending operation.

Maintaining References

To ensure that the master counter balances over time, MBNetworkIndicator assumes that when an instance is deallocated, it is a signal that there are no related network operations still pending. (This is achieved by a call to cancelOperations from within dealloc.)

Because of this, you are expected to maintain strong references to MBNetworkIndicator instances that are still tracking pending operations.

Thread Safety

Because individual network operations are bound to specific threads, MBNetworkIndicator instances are designed to be used only on a single thread; instances must not be shared across threads.

However, the underlying mechanism that maintains the master counter and manages showing and hiding the network activity indicator is thread-safe.

The mechanism uses functions declared in <libkern/OSAtomic.h> to ensure that the master counter is handled correctly when several MBNetworkIndicator instances are in simultaneous use on multiple threads.

What’s Next

Our MBNetworkIndicator class is just one way to manage a shared resource while adhering to the principles of modularity.

In subsequent posts, we’ll discuss:

Aug 22

Rules for Best Practice Email Design: Coding Practices

Sitepoint has just published the third installment of Gilt Email Engineer Lauren Ribando’s informative “best practice email design series.” This time around, Lauren gives us tips on coding practices—from avoiding CSS shorthand to slicing images. Go here to read her full article.

Aug 21

Welcome, Mackenzie Nicholson!

image

Terve, aloha, and nǐ hǎo are just a few ways the #gilttech and #giltpmo teams would like to welcome Mackenzie Nicholson, the newest business systems manager to join our Program Management Organization! This global citizen was born in Napa Valley, grew up in Hawaii, went to high school in Seattle, attended college in Chicago and New York, and spent a year living in Helsinki running her own American-style baked goods company while commuting to London and Hong Kong for the engineering consultancy Systra. (She’s already given us a presentation on making the best of travel reward programs!)

Fittingly, Mackenzie is currently working with our back office team, which works on Gilt’s international payments and logistics. We’re thrilled to have her. Welcome on board, Mackenzie!

Gilt Presents at the Appium Roadshow (Slideshow)

image

Earlier this summer our friends at Sauce Labs released Appium 1.0, which the Gilt Mobile team has been using to automate our mobile testing efforts. Not long after its release, Gilt Senior Software Engineer Matt Isaacs wrote a blog post for for Sauce Labs highlighting Appium’s advantages and where it still falls a bit short. Yesterday (August 20) Matt joined representatives from Sharecare, Softcrylic and other Appium-using companies at Sauce Labs’ all-day Appium Roadshow at Projective Space in the Lower East Side. 

For all of you who couldn’t make it to yesterday’s sold-out event, here are Matt’s slides:

iOS Testing With Appium at Gilt from Gilt Tech Talks

Gilt CIO Steve Jacobs Featured on NJ Tech Weekly

image

Last month Gilt CIO crossed the Hudson River to present a talk for the NJ Tech Meetup, the largest tech community in the Garden State. Steve’s talk focused on creating emotional connections with customers, and how Gilt constantly innovates to strengthen and maintain those connections. NJ Tech Weekly was there, and have just published an article on Steve’s presentation! Go here to check it out.

As an added bonus, here’s the deck from Steve’s talk: