Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use Flex?

In a recent conversation, I mentioned that I was using JavaScript for a web application. That comment prompted a response: "You should use Flex instead. It will cut your development time down and JavaScript is too hard to debug and maintain. You need to use the right tool for the right job." Now, I don't know too much about Flex, but I personally don't feel like JavaScript is too hard to debug or maintain, especially if you use a framework. JavaScript is also one of the most used languages right now, so it would seem a better choice in that regard too. However, his reply piqued my interest. Would Flex be a good choice for a distributable web app for which 3rd party developers could build add-ons? What are the advantages of using it vs. a JavaScript framework? What are some of the disadvantages?

like image 698
VirtuosiMedia Avatar asked Sep 24 '08 15:09

VirtuosiMedia


People also ask

What are the advantages of using flex?

Flexbox, in part, is "shorthanding" combinations of methods listed above but also has three distinctive advantages: setting flexible width/height of elements depending on available space. both vertical and horizontal centering without any hacks and workaround solutions.

Should I use flex or grid?

CSS Grid and Flexbox are layout models that share similarities and can even be used together. The main difference is that you can use CSS Grid to create two-dimensional layouts. In contrast, you can only use Flexbox to create one-dimensional layouts.

Should I use flex or float?

Using floats we are limited to place items left or right but using flexbox we can modify our models in all four directions. Flexbox is a new concept in CSS to achieve a responsive webpage with some important properties of flexbox. We should use flexbox over floats.

Should you use flexbox for everything?

You could use flexbox on everything but you really shouldn't. Flexbox is a new layout algorithm for laying out complex web pages/applications, but he also have it disadventages(temporarily the most slower layout). Basically flexbox is the most best for smaller page components and UI elements.


3 Answers

I have recently started to develop Flex applications, and I personally find it a refreshing framework for the web.

You get a state-ful application that runs completely client side. You get no worries about cross-browser portability that you do with JavaScript, and you get some really neat things such as effects, graphing, and rich user interface components.

Flex also makes it easy to communicate to webservices and the XML parsing via ECMA is insanely powerful and simple.

I'm glad I have made the switch. As far as how popular it is...I'm not really sure, but I am fairly certain that the developer base is expanding rapidly.

The only real disadvantage I can think of is a flash player requirement, but I would say it is pretty safe to assume that most browser support flash player; even konquerer in Linux is supported; much more so then a silverlight runtime (which I NEVER plan on installing)

like image 195
mmattax Avatar answered Oct 11 '22 01:10

mmattax


Here is my experience: you really need to consider 2 things separately - development and the end-user experience. Flex shines in the first area:

  • ActionScript is a nice mixture of Java and JavaScript so you get a familiar language with strong support for OOP
  • debugging is far easier than what you can achieve in JavaScript
  • Flex framework is component-oriented and event-driven which helps in creating rich user interfaces (HTML was not really created to support application UI scenarios)

On the other hand, the end-user experience is worse when running a Flex app compared to an AJAX app. First, you need to have Flash Player installed but this is probably not an issue for most computers today. Bigger problems are with usability - Flash Player handles all UI interactions (instead of a browser) so the password manager doesn't work, text fields don't remember previous entries, Ctrl+T and middle-clicking doesn't work, text search doesn't work etc. etc.

My advice would be - if you are developing an application (rich UI, relatively separated from the rest of the web), go for Flex as it will save you time, money and will make your users happier by providing richer functionality and shorter periods between new versions. On the other hand, if your application needs to be tightly integrated with the web and you want your users to be able to use features of their browsers, go with AJAX.

Nice example is Google Docs vs Buzzword. Buzzword is much more feature rich (for instance, text can flow around an image from both sides which is something you could never ever achieve in DHTML) but Google still decided to go for an AJAX version because they are the "web company". There is no right or wrong in doing it the one or the other way, it's just different and it's important to consider who your end users are.

like image 40
Borek Bernard Avatar answered Oct 11 '22 01:10

Borek Bernard


I would push you towards standard web development technologies in most cases. Javascript is no longer a great challenge to debug or maintain with good libs like jQuery/Prototype to iron out some of the browser inconsistencies and tools like Firebug and the MS script debugger to help with debugging.

There are cases when Flash is a better option, but only in cases where you are doing complex animations. And, if you are willing to invest the effort, most animations can be achieved without resorting to flash. A couple of examples...

Flash content is not as accessible as other content.
This will not only affect people with out flash, but also search engine spiders. There may be some hacks to help get around this now, but I think that most flash content will never be indexed by google.

Flash breaks the web UI.
For example:

  • If I click my mouse wheel on a link, that link is opened in a background tab. In a flash app there is no way to simulate this behavior.
  • If I select text in my browser and right-click I get options provided by the browser that include things like "Search Google for this text". In a flash app those options are no longer there.
  • If I right click on a link or an image I get a different set of options that are not available in a flash app. This can be very frustrating to a user who is not "flash savvy".
like image 12
Prestaul Avatar answered Oct 11 '22 02:10

Prestaul