Rent vs Own

Came across this article online recently. Kind of related to the recent Amazon Cloud Drive launch. I think there are a lot of digital contents that users like to rent now instead of owning them. For example, music and books. Netflix has already build a successful model renting out videos via streaming. So why can’t we stream music and books? Good question. It looks like Rdio and Spotify are trying to do exactly that on the music front. These are interesting mini clouds which IMO serves as a platform for more applications.
It looks like Rdio event has a API now. So if rdio does all the heavy lifting of music acquisition and legalizing streaming then developers can write app against it to create a user facing storefront for consumption. I’m sure there will be people paying monthly subscription for that. But the thought of subscribing to rdio with my account and build a pipe to let several other people to use the pipe at the same time intrigues me.


March for Babies

Help me to participate in the March for Babies. Your donation can be as small as $1 will support March of Dimes research and programs that help moms have full-term pregnancies and babies begin healthy lives. And it will be used to bring comfort and information to families with a baby in newborn intensive care.
click here to donate.

What is the difference between the Adapter and the Facade pattern

What is the difference between the Adapter and the Facade pattern? That was the question I was asked today by a fellow Yahoo! employee in the hallway. The conversation came about like this: I met an ex-coworker (for the sake of his discretion, I will just call him L) in the cafeteria. He asked me how I was doing and I responded I might be working on a project that is a layer higher than what he is working on. He asked “are you going to build a Facade or Adapter?”

I paused a little bit because I haven’t really explored the pattern paradigm here at Yahoo! so I don’t really know what is being practiced at his group and this new project group that I will be joining. Sensed the hesitation, he began giving me some history of the practice in his group.

Here are the quotes from the gang of four: the definition of Facade pattern: “Provide a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.” Adapter, however, “lets the classes work together that couldn’t otherwise because of incompatible interfaces. (Convert the interface of a class into another interface clients expect).”

Facade reduces the learning curve necessary to successfully leverage the subsystem. It also promotes decoupling the subsystem from its potentially many clients. On the other hand, if the Facade is the only access point for the subsystem, it will limit the features and flexibility that “power users” may need.   So in short, Facade is for unified simple inteface combining functionality of several classes. Adapter is used to provide extensible functionality by privately inheriting the adaptee class.

Here’s an example of Adapter pattern in C#:

1 using System;
3 // Adapter Pattern - Simple Judith Bishop Oct 2007
4 // Simplest adapter using interfaces and inheritance
6 // Existing way requests are implemented
7 class Adaptee {
8 // Provide full precision
9 public double SpecificRequest (double a, double b) {
10 return a/b;
11 }
12 }
14 // Required standard for requests
15 interface ITarget {
16 // Rough estimate required
17 string Request (int i);
18 }
20 // Implementing the required standard via Adaptee
21 class Adapter : Adaptee, ITarget {
22 public string Request (int i) {
23 return "Rough estimate is " + (int) Math.Round(SpecificRequest (i,3));
24 }
25 }
27 class Client {
29 static void Main ( ) {
30 // Showing the Adapteee in standalone mode
31 Adaptee first = new Adaptee( );
32 Console.Write("Before the new standard\nPrecise reading: ");
33 Console.WriteLine(first.SpecificRequest(5,3));
35 // What the client really wants
36 ITarget second = new Adapter( );
37 Console.WriteLine("\nMoving to the new standard");
38 Console.WriteLine(second.Request(5));
39 }
40 }

Here’s an example of Facade Pattern in C++:

// "Subsystem ClassA"
class SubSystemOne
void MethodOne()
std::cout << " SubSystemOne Method" << std::endl;

// Subsystem ClassB"

class SubSystemTwo
void MethodTwo()
std::cout << " SubSystemTwo Method" << std::endl;

// Subsystem ClassC"

class SubSystemThree
void MethodThree()
std::cout << " SubSystemThree Method" << std::endl;

// Subsystem ClassD"

class SubSystemFour
void MethodFour()
std::cout << " SubSystemFour Method" << std::endl;

// "Facade"

class Facade
SubSystemOne one;
SubSystemTwo two;
SubSystemThree three;
SubSystemFour four;


void MethodA()
std::cout << "\nMethodA() ---- " << std::endl;
void MethodB()
std::cout << "\nMethodB() ---- " << std::endl;

int Main()
Facade facade = new Facade();


return 0;

Development Framework

So you got a web development idea but there are so many frameworks out there which one should you use and will benefit you in the long run? Hey, I’m in the same shoes.

Google Apps is built on top of / using Django (Django is pretty much what Google Apps cheer and support). Yahoo’s YUI team made an announcement recently that they would be using Node.JS. Twitter has been using Ruby On Rails for their UI and transition to Scala for their queuing system and other middleware. Facebook seems to be using PHP/Javascript on top of pagelet bigpipe Framework. (if anyone knows more detail, let me know).

From what I observed, a lot of startups are using Python, Ruby ROR, PHP/Javascript/HMTL5 for web development. Well, let me also mention what they do in their backend. It seems that ETL and data warehouse is what everyone’s favorite. So things like HBase, Hadoop M/R, and a bunch of other Java based technologies. But for the web frontend to be benefited by the backend data/analytics, there will probably be a cache layer that serves large datasets in a high performance fashion, hence C/C++ based middleware that pulls data from various sources (distributed hashtable, MySQL, NoSQL etc), cache, and webservices will be used here. Of course, C/C++ is my choice and a lot of Java purist out there may argue this but the bottom line is the trade off between performance and the vast libraries that support whatever you are doing.

So back to the Web Development. I’m contemplating to use Python and Ruby ROR. But for practicality, perhaps I should stick with PHP/Javascript and catch up on HTML5. I have no problem with any of the backend work. But it’s the frontend development that gives me the headache to choose which framework to stick with. In the recent years, things have involved faster than we can catch up.


IP rights

As a developer in the software business, creativity is one of my key assets. This question sort of came out when I started getting kind of serious about investing my time in a venture on the side after work. “Will my invention belong to the company that currently employs me?” Especially my invention is in the software field. Perhaps related to Search, Social, Entertainment and etc. For those who don’t know about me, I have been working for my current employer, Yahoo!, for almost 3 years. This is sort of no brainer since Yahoo! is involved in a lot of things. Yahoo! has websites covering Email, News, Sports, Finance, Entertainment, Search and most recently Social.

Because of this question in my mind, I began researching it on the Internet. And I found the following website kind of provided an answer. Anyone out there who have some experience in this? I just can’t imagine all these Silicon Valley entrepreneurs out there who became successful all had to quit their day job before they start working on their “garage” project.