views:

236

answers:

7

I am considering creating a website with the complexity of Facebook that should be able to scale into the millions of users. My question is: Is there any reason not to use Adobe Flex for such large project apart from the obvious point of requiring everyone to have Flash installed and not having to rely on Adobe? In my view Adobe Flex would reduce the server load for Facebook, because more of the work could me done on the client side. Do you agree?

+4  A: 

Go to facebook and do view source...do you see all that JavaScript? That all runs client side

SQLMenace
But things like multithreading are as far as I know only supported using GoogleGears. This means that utiizing the client will be lots more complicated.
David
@David, I believe your over-utilizing client side code then.. You shouldn't need multi-threading code to be run in a browser for all practical purposes. (you do know your not suppose to create SQL queries on the client side right?)
Earlz
your client would call a service on the server which could be parallelized there..for all you know the client is still running a PIII 600 MHZ box..
SQLMenace
Consider www.grooveshark.com. If that had been built using Javascript, wouldn't there be a lot more load on the servers because a connection needs to be established every time a link is clicked?
David
Not necessarily if you use a JavaScript library like ExtJS you can bring all the components down on first load and then only show the ones you need when you click a link on the client. Also when you have jQuery hosted on Google it will already be cached for the user if he visits another sire first that also uses the Google hosted version
SQLMenace
That is very interesting, thanks for the point. I will research the maturity of ExtJS.
David
The number of HTTP requests for a Flex application will probably be about the same as a site that makes very heavy use of AJAX. The only possible advantage for Flex is that if you make a number of RemoteObject requests within a small enough interval, the Flash Player will combine those requests into a single HTTP request. That can have drawbacks however.
cliff.meyers
@David - Keep in mind that Flash/Flex isn't multithreaded either.
jsight
+1  A: 

Flex is the GUI for the client. You still need server-side storage and that's what has to scale. The user interface could be in Flex, while most of your users won't like such interfaces.

johannes
The familiarity thing, is a good point.
David
I don't get the downvotes here (maybe the argumentative statement about "users won't like such interfaces"?) The fundamental issue of client vs. server is a very valid point.
jeroenh
+1  A: 

You will have to do a custom version of your site for the iPad/iPhone.

There are other ways of moving load to the client side. Javascript will give you porting headaches, but less than moving away from the entire architecture like Flex.

OTOH when you get a million users you'll have the resources to reimplement your site.

Matt Curtis
Ipad/iphone support is an excellent point. Reimplementing a site is never favourable, even with nearly unlimited resources.
David
Sorry, I was being a bit facetious :-) The correct answer is, when you have "million of users", you'll be able to pay someone else to reimplement it for you, or sell it to Google :-)
Matt Curtis
By the way I think facetious is an excellent name for a Facebook clone :-)
Matt Curtis
+3  A: 

Johannes is right to point out the difference for server vs. client. The server side stuff is what needs to scale.

As an example, the Microsoft Silverlight team has assembled a facebook client app in silverlight (using the Facebook public API). My point is, using todays technologies, it is entirely possible to write a web application targeting many different kinds of client technologies: classic web browsers (HTML/javascript), 'rich internet applications' (flex, silverlight), ...

See also the myriad of Twitter clients out there.

jeroenh
I like your point of using many clients. It does add complexity, though.
David
+5  A: 

Of course Facebook could have been implemented in Flash. But then the question is would it have succeeded? There are reasons big web companies like Google, Facebook and Yahoo only use Flash as sparingly as possible.

The thing I would fear most is alienating users. The Flash plugin isn't the best piece of software out there. It is slow and likely to crash once in a while. If your app gets bigger you might get some loading times that might not be acceptable to your users. Also in my opinion full Flash sites just don't feel right because they behave differently from HTML websites. All great websites like Google, Flickr, Stackoverflow or Facebook feel very light and slick which is very elegant makes up for great usability.

And then HTML and JavaScript are a lot more flexible. Do you want your website to be available on smartphonse? The iPhone has no Flash and even with phones that do you have the problem that users will very likely hate a full Flash site since those phones don't necessarily scale Flash as nicely as they scale HTML and Flash draws battery like crazy. If someone comes up with another revolution like smartphones you can be sure it supports HTML and JavaScript but you can't be so sure about Flash.

Then the question is how would you gain any efficiency? Of course you can write your UI with Flex and just call very lightweight webservices like you would use them for AJAX and you can even cache some of the content of the site locally so that you don't transmit more data as necessary for user interaction (the UI is transmitted only once). But you can also do that with JavaScript. You can write your UI in HTML and JavaScript, load it once and then just pull the naked JSON data from the servers and render it using JavaScript. You can also fetch lots of this data in advance to get the number of requests down. But still such an approach has its cons. Did you ever notice that when you type an answer on stackoverflow and someone else submits an answer you get notified while typing your answer. Such real time features are very cool and you might want this at some point in time which means more server interaction.

But whatever you do your servers still have to scale if your site grows. Even if you minimize the number of GET requests that hit your servers they will still grow a lot when your site gets popular and you will need a lot of servers to handle you will just improve your users/servers ratio.

The most interesting point though is that Flex is much easier to program than AJAX (think about browser incompatibilities for instance) and still AJAX was not only invented but the whole world messes with all those problems that come with it instead of using Flex. I think this tells a lot about of the value of the result you get when creating a full website in Flash.

ahe
+2  A: 

The company I work for has a large app in Flash that is used by Governments. It is very hard to maintain and does fail sometimes. The problem is all of the .fla and .as files that have to be alterted just to make a small change. Yes, the app could of been built better but even so it is still harder to maintain than an HTML/JavaScript front end.

While I love writing Flash/Flex apps, I believe they should complement a site and not be the site.

Using a good JavaScript framework like jQuery takes the Browser compatibility question out of the picture (for the most part) and allows allot of functionality.

Todd Moses
Why do more files have to be updated when a site is implemented in Flex? Is your point that creating a good architecture in Flex is more difficult than in HTML/Javascript?
David
This is in Flash but the same could occur in Flex. There are SWF Files that contain the UI and the UI logic then AS files that contain the business logic. These AS files must communicate with a server side database layer (PHP in this case). That means if you have a problem it is either in the PHP, AS, or SWF. While a PHP app usually just has a PHP class for the Data and a UI page to communicate with that class.
Todd Moses
+1  A: 

I don't think you would see a performance advantage with a site like Facebook, because the content is highly dynamic, comes from many different places, and is created by many independent entities. Flash (and therefore Flex) is better for monolithic apps from a single source that don't need to change very often.

The default in Flash is to build everything into a single .swf file that holds everything. It is possible to break out of this default behavior, of course. You can make web service calls, pull in external components via the SWC mechanism, load static content via HTTP, etc. Nevertheless, it's not the default pattern, which affects how Flash development libraries and tools work. Besides, the more of this you do, the less of the "run everything we possibly can on the client side" benefit you get. It gets soaked up in HTTP connection overhead.

The default on the plain old standards-based web is to store all assets separately and assemble them dynamically at the client. This is one reason the web is slow -- again, all that HTTP connection overhead -- but also why it is flexible and dynamic. It mates well with a site like Facebook which requires constant evolution by a lot of independent developers.

I say this having developed a Flex app, which I am happy with. Only one person -- me -- has to maintain it, and it's naturally a monolithic app. It plays right into Flex's strengths.

Warren Young
Excellent points. Thanks
David