Thursday, June 11, 2009

That's How I Rant

OK, I think I came a little too strong in the meeting – blame it on production incident! This is going to be a long one...

I think I got a better handle of the original idea. So I think of it in 2 ways. First is the ease of use – easy to install/run aspect from automation expert side. And the second is the bank of dedicated machines that Mo’s group will be in charge of maintaining/running a pre-defined set of tests that will get triggered automatically with pushes and also they can run them in small chunks on demand against an environment of their choosing.

I believe that it would be ridiculously impossible to maintain these dedicated boxes if we let anybody try to “test-run” their newly written tests willy-nilly. In my opinion the testers of other groups should be writing their tests/adding on to the basic extensions/actors we created locally on their machines and then check in to Perforce when they’re done. Than after verifying that these tests are working as expected and decided that they are worthy of promoting to the set of tests that get ran with the automated push.

It seemed like we were all in agreement that it would be impossible to maintain the “lab” for “everybody else”. First and foremost we cannot know what kind of requirements they will have about the environment for their tests. Most basic – how many devices/accounts do they want the test to run against? So far all our examples were based on 1 device/test. So I’d recommend that the testers can still write the tests up to their expectations and then if we see this test to pass certain standards, then we can promote it to run with the automated push.

So in this case what would the “lab” look like? I don’t think we would need to split them up based on location. We just need to verify that they have access to the environments they are going to run against. Then I guess we’d have a separate box per environment such that if needed we can run the same set of tests concurrently against all environments.

Let’s figure this out with Angi before moving on to the next sprint.

Friday, December 19, 2008

"Write Me a Function That Reverses a String"

(If you want to get real information how to really interview, don't look anywhere else but

I happened to cover my team lead for an interview, and apparently our interview process is quite harsh. Harsh is not enough to explain - It was like trying to dodge bullets during a hurricane. If I was the intern, I would probably have flipped over the meeting table and run for the window!

Let me first explain to you how our interviews are structured. Depending on the candidates' experience and position they usually go through a minimum of two 45-minute interviews. You would think two interviews is very short, right? Well, each interview happens to have three people on the opposite side of the table. These three people are preferably from different teams. So you're interviewing three people all at once. That's quite a pressure if you're used to having 1-on-1 interviews. 

Interview started off with pretty straight forward questions that every CS student must be able to answer really easily:
  • What is polymorphism?
  • What is difference between method overloading and method overriding?
  • What is a Reentrant Lock? How does it differ from a Semaphore?
  • How do you select all columns from the Users table?
  • What's the time complexity of Merge Sort? (This one really annoys me, I'd rather ask them to implement it first, and then tell me the answer based on their solution instead of directly answering it.)
Next comes the questions that show us how good a Java superstar you are:
  • What's the difference between a regular inner class and a static inner class?
  • Why should I choose StringBuffer over StringBuilder?
  • What's the difference between Interface and Abstract Class?
Then comes the hard-core superstar programmer questions:
  • What is a Socket? 
  • How do web sites "remember" you? (Let me give you a hint, it's got nothing to do with IP or MAC addresses!)
  • Which one performs better for parsing XML: DOM or SAX? (another hint, it's not DOM!)
  • What is the difference between HTTP and TCP/IP?
Well, let's stop for a second here. What's the problem with these questions? Oh, by the way this is only the first 5 minutes. As you might imagine, candidate had all of them wrong! Well, if I was a sophomore, I would probably choke on all these questions as well. To tell you the truth, I have a feeling I would never have gotten hired if my interviews went like this ;). 

Sure, these questions show us how much of a technical knowledge the candidate has, but tells us nothing about how smart or if he can get things done! After the first 10 minutes of total destruction, I was a little sad for the interviewee. To tell you the truth I even sympathised with the kid. I'd rather try to understand if he was a smart, capable and fast learner kid, so I stepped in; I have a couple of very simple questions that show us the candidate's knowledge of algorithms and problem solving skills. So I went with my favorite question:

"Write me a function that reverses a String."

Takes, maybe, 2 minutes to answer this question on the board. Another 3 minutes to have a step-by-step testing exercise. Once the candidate is confident with the answer, I then ask them if they saw their bug - let them roll around in the mud for 5 minutes. This is especially fun if there is no bug - the good ones just go nuts trying to find their non-mistake.

What makes this my favorite question is if you have good candidates, then there is so little places where they'll mess up. If they can't even answer this question, you know they are a "No hire". Unfortunately even I can't make any exceptions if you can't answer a standard question. 

Fun part is if the candidates go through this question like a breeze, you can easily extend the question to better measure them up:
  • What's the space/time complexity of your solution? (Did they go to their algorithms class?)
  • Now do it in constant space. (Problem solving skills)
  • How would you solve this multi-threaded? (Translation: Are you a superstar student?)
Tough economic times call for tough interview experiences. We can't make the mistake of hiring an intern that we don't want to bring in for full-time after the internship. Yes, our interview process must be very competitive and selective but I believe that the interview must be well balanced, too. Enough questions to show us the technical knowledge as well as personal capabilities. You can't be too harsh, or too soft. The result should never solely be based on technical questions - what's the probability that an intern or a new graduate is technically well versed? If the candidates are not technical enough, they better be able to solve questions better than I would!

Sunday, September 14, 2008

Mocking Static Blocks in Java

My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and these are one of the annoying points in our push in writing unit tests. Our goal is to be able to write unit tests for classes that depend on this static initialization with minimal code changes.

So far my suggestion to my colleagues is to move the body of the static block into a private static method and call it staticInit. This method can then be called from within the static block. For unit testing another class that depends on this class could easily mock staticInit with JMockit to not do anything. Let's see this in example.

public class ClassWithStaticInit {
static {
System.out.println("static initializer.");
Will be changed to
public class ClassWithStaticInit {
static {

private static void staticInit() {
System.out.println("static initialized.");
So that we can do the following in a JUnit.
public class DependentClassTest {
public static class MockClassWithStaticInit {
public static void staticInit() {

public static void setUpBeforeClass() {
Mockit.redefineMethods(ClassWithStaticInit.class, MockClassWithStaticInit.class);
However this solution also comes with its own problems. You can't run DependentClassTest and ClassWithStaticInitTest on the same JVM since you actually want the static block to run for ClassWithStaticInitTest.

What would be your way of accomplishing this task? Or any better, non-JMockit based solutions that you think would work cleaner? Please follow the discussion at

Tuesday, August 05, 2008

5 Ws Done Right

5 Ws, 6 Ws, 5 Ws and 1 H... Who cares? What did I do? When? With who? And where? That's what everybody care about! The point is that the hundreds of social networks we're involved with happens to manage one or some of these Ws. I think the other day a similar conversation was going around in Twitter but I don't remember all the details - too bad! That was around the time I started using brightkite.

Then, it got me thinking that what brightkite is doing with Twitter sharing should actually be the other way around. I'm already putting what I am doing, where and with whom on Twitter - why should I do the same thing over again at brightkite? Why should brightkite forward what I post there to Twitter? What brightkite should be doing instead is to subscribe to my Twitter feed and check me in to the locations I mention in my status updates.

Of course this proposal doesn't make anything easy for brightkite... Natural language processing is not an easy problem. And I'm not expecting any service like this to show up any time soon.But I believe that should be the value-add of brightkite.

Saturday, March 29, 2008

Mobile Innovators Falling Back?

antoniocapo: Blog Post: A twittering life. Yours similar?

You can never be too fast to follow the latest trends in the World. Being slow, on the other hand, is unacceptable; it means you're not cool! Last night I was sitting around, doing some work, then @antoniocapo sent this out on Twitter, and the post got me thinking... (It also got me thinking that I'm probably the only one amongst the 8,000 people at RIM that uses Twitter. Facebook is catching up :)).

Well, for those of you who don't know, I work at Research in Motion, RIM for short. We make the BlackBerry. We are THE innovators in mobile technology. To be more specific, I work in the group that makes your Gmail, Yahoo!, heck all your personal emails delivered to your phone so you get more addicted to your device (more info here). We are the kings of push mail technology which saves you gazillions of dollars on mobile data bills.

So, what has this tweet got to do anything with what I do? It got me to realize that we're still very much on the corporate side. RIM's not trying hard enough to tap into the consumer market. Yes, last couple years we've done a lot to tap into the consumer market and achieved great success (ever heard of Pearl, Curve ?). But we can do better, we should be doing much better.

Then what happened next? We said, let's tap into social networks. I bet only people that had Blackberry's heard about the infamous (!) Facebook app. In my opinion this brought the biggest shame on the company's profile but nobody has realized it yet. First of all it's no where as cool as the Facebook iPhone app - it's not even close, it hurts. Let me tell you what this app does. You know, Facebook sends you emails on certain things - like somebody sent you a message, wrote on your wall, added you as a friend, right? All this app does, is sees these emails on your inbox and displays them to you in a pretty application. You can reply to the wall posts, etc from this app but that's about it. You can also tag the pictures you took with you BlackBerry and upload to Facebook, but that's the cool part of the app - so unimportant. Why don't I like this app? Because it relies on Facebook sending you an email (I'm already pissed off at Facebook because it never delivers these emails in a timely fashion anyways).

If you ask me, any application on BlackBerry that doesn't use push data somehow is LAME. A Twitter app that refreshes every 15 minutes is LAME (The coolest thing so far - which is kind of accidental, is to have Twitter send notifications to your Google Talk on your BlackBerry; but still, that's not a true, native Twitter application). A Facebook app that doesn't send you all the notifications is LAME. We provide really good infrastructure so you can write apps that will deliver real-time data to the device, i.e. push! Push, push, push, push.

What can I do so I don't cry myself at night? I take it as a personal goal to raise awareness of the BlackBerry API to the masses, a la iPhone SDK. We already have a great network of sources for BlackBerry developers, however - for some reason - it's not as cool, or popular as the iPhone's. Why isn't there any buzz about BlackBerry apps? What saddens me the most is the fact that even thought there is a tremendous amount of BlackBerry apps out there (yes, even US government has in-house apps built on BlackBerry infrastructure) the mass media - aka non BlackBerry users - don't know about them.

All BlackBerry developers out there - make sure you drop me a line. I want to hear your thoughts and ambitions on how to improve your experience so YOU can design and develop the coolest applications.

All BlackBerry users - drop me a line as well. What kind of cool applications do YOU want to see on your device so iPhone and other smart phone users are jealous of your BlackBerry?

PS: I'm no where related to the group that publishes the BlackBerry APIs, nor am I a PR person. I have no influence what so ever on those groups and I don't want to be. This is totally a non-work-related initiative of mine.

Friday, February 22, 2008

Your Online Presence

This is a very tricky and fragile matter. Actually there are two matters here, first the standardization of web services - whether this be SOAP, REST or WS-*, this problem has been solved long time ago - and then there is creating a standard infrastructure of web services - this is what I'd like to rant on. Feeling confused? Well, don't, because this will be the next greatest thing after my grandmother's crunchy walnut baklava.

Here is the problem I see with the web services and Web 2.0 applications out there today:

  1. There are a lot of new websites that do pretty much the same things. RSS readers, social networks, heck even word processing sites (Google Docs rocks, I know, it's so cool!).
  2. I have my established (or maybe not so, who knows?) online presence and I'm using certain tools/applications to maintain it (Facebook, Twitter, Blogger, etc.)
  3. If I'm not happy with one service, it's almost impossible to move to a different one. This fact makes me locked in to one application either because I started using it the first, or because the majority of my friends circle is in it.

One of the major problems people have been arguing around is the question of who owns the data/pictures/videos people upload? If I put up a video on YouTube, does that video becomes YouTube's property? For the sake of simplicity, you can replace "media" with "profile", "data", etc.

The way I think of this issue is rather different than any other person's I've heard so far. I believe that you are the sole owner of your own media. Hence, you have a hard copy (offline) of the media at your person. The problem you're facing is, in order to share your media with your friends, you have to go through some third party social network. It also happens that this social network also makes tagging your friends on this media and commenting on the same media available to your and your friends' disposal. The key here is that the media is now in the 3rd party's control.

Are you with me so far? Here is what you've been trying to accomplish so far.

  1. You have some media you want to share with your friends.
  2. You upload this media where all or most of your friends can access.
  3. The place you uploaded allows you to link this media with your friends through tags or comments, etc.

Good. We can get back to what I believe in. My God says that even if I own the original media, the social network owns the plumbing that connects me to my friends. It's the social network's value-add to society. It may be your personal profile, your blog, your status updates. but it's the social network that provides you with the infrastructure to host this data.

It used to be that getting your data back from social networks was hard; not impossible, but hard. If you really wanted, you could use screen scraping. Nowadays, most sites give you public links that will take anybody outside the social network easily see the media or provide you with web service APIs that would allow you to look at your information from outside the social network's web site.

Twitter's API, for example, allows you to do pretty much everything you want to do on Twitter - including getting a list of your friends, followers, your and their statuses. When you think about the power Twitter gives in the user's hands, this is a great step towards enabling the user owning their own data.

Similarly, OPML - the XML document that describes "outlines" - lets you easily move your RSS subscriptions from one reader to another.

Don't even get me started on the power of Facebook and Ning APIs.

Now, imagine that you can move all your online presence over to wherever you want. In comes It's a project that started in November 2007 and has seen a lot of attention in the last couple of months. The idea behind the group is to merge the existing open standards, protocols, formats (such as OpenID, APML, and various APIs) with people's online presences (profiles, friends, media) in a way that the users have the control over their data. I'm very hopeful about the steps this group has been taking so far, and hopefully it's going to result in a new era in web applications.

Imagine tagging a picture on Facebook and viewing that same picture with same tags (and maybe more) on Flickr without doing anything... It's going to be slow but hopefully that's the direction I'd like to see social networks and web sites evolving into. Of course this might require different ways for you to host your data but what the hell, we're humans, we evolve!