Select to view content in your preferred language

Flex API vs Flex Viewer API

645
8
01-17-2012 02:44 PM
MattGiles
Deactivated User
Hello,
I am new to flex api / flex viewer api. I was wondering if someone could explain the potential disadvantages of using the flex viewer api vs flex api.

I have been told that the flex viewer api is configurable, but not customizable (like apps made with flex api)..however i have also read that you can expand the source code provided with the viewer api..very confusing

Also, can flex viewer widgets that are found on arcgis flex api website be used without the viewer??..

Any feedback to clarify would be great!
Cheers.
Tags (2)
0 Kudos
8 Replies
RobertScheitlin__GISP
MVP Emeritus
Burns,

    The disadvantages of using the Flex Viewer is that to  truely give  it a look and feel that is not the standard boilerplate Flex  Viewer  look you have to be a GOOD developer to tear apart the code. That  being  said that disadvantage is pretty small. The Flex Viewer is a  custom  semi MVC framework and not a true MVC pattern. Now that is  assuming  that you even know what a MVC pattern is and you want to  develop using  one of the popular MVC patterns. Taking the Flex API  samples and using  them in the Flex Viewer is not any kind of simple copy  and paste for  those copy and paste ninjas.

I have been told that the flex viewer api is configurable, but  not customizable (like apps made with flex api)..
  That is  completely false. Those that make that statement are the ones  that  don't want to take the time to understand the ins and outs of the   Viewer. That being said, customizing the viewer does require a good   working knowledge of it's code if you want to do anything besides a   custom widget.

can flex viewer widgets that are found on arcgis flex api website  be used without the viewer??
Honestly, Yes but not without a  50% or more re-write of the code to remove the dependance on the viewers  framework.

If  you are a casual developer that does not plan on investing a lot of   time and learning of the Flex API than the flex Viewer is a great   product for you. If you are already a novice Flex Developer and plan to   do a lot more learning (such as MVC patterns) or need almost complete   control over your developed application and have a lot of time to invest   in writing all the code yourself than the Flex API is your obvious   choice.

If you are looking for a lot of pre-developed  capabilities to include  widgets and code examples that are not just the  ones developed by the  Flex API team in the form of API Samples and  people that are willing to  share their code source than the Viewer is  the better choice. Of  course other will have their opinion, but I have  to speak from my  several years of experience helping beginners and  sharing code on both  the old forums and these new ones for both the API  and the Viewer.
0 Kudos
MattGiles
Deactivated User
Thank you Robert.

By "standard boilerplate Flex Viewer look" - you mean the standard viewer header, "locked" widget icon locations, skins (the look of the widget windows, etc.), the use of "widgets" to incorporate tools, ....?

Also, just so I'm 100% clear - the only disadvantage to the viewer is the look and feel - no functionality is lost when using the viewer vs the flex api?
0 Kudos
MarttiKostia
Emerging Contributor
Id like to rephrase the answer:

Whether you choose Flex Viewer or Flex API depends on two things: how customized your application needs to be, and whether you have a customer that needs to be able to configure it without Flash Builder or writing code.

When you make a Flex Viewer app, it will look like a Flex Viewer app, and work mostly like a Flex Viewer app. (As you said, "the standard viewer header, "locked" widget icon locations, skins (the look of the widget windows, etc.), the use of "widgets" to incorporate tools" etc).

The viewer has a 'core', which is around 30 000 line monolith of a code. Modifying this core is very slow: some of the classes have sizes of over thousand lines, and there is not much commentation. This core defines how the Flex Viewer looks and how it essentially works. So if your application needs to be highly customized or cannot look like what Flex Viewer looks like, you probably should do it with just API.

However, it's easy to plug in widgets to the Flex Viewer, and if you settle for how the Viewer feels and looks, you can get very far by just making custom widgets for it. If the ready-made widgets for Viewer satisfy your needs, then go for them. However, if you need highly customized widgets, i recommend making own widgets. The Esri made widget files are often also over 1000 lines with no commentation or architecture in general, and trying to modify them can turn out to be a massive time sink.

Also, be aware that a lot of the component / widget functionality is embedded in the skin files that you can modify by downloading the skins with the API zip, and plugging them into the Viewer.

The Flex Viewer has the benefit, that it's very customizable using .xml-files. E.g. customers and such often wish to accomodate custom-built applications to their map documents personally, but don't have Flash builder and dont want code Flex, and thats what Viewer is well suited for.

Flex dev, Esri Finland
0 Kudos
IvanBespalov
Frequent Contributor
It all depends on experience.

Experience can not be downloaded and compiled.
Experience comes when you write the code yourself when you read the documentation.
First time opening "Flex Viewer" it seemes to me a heap of code. A year later, it seems to me too simple, easy extendable.

One of ESRI requirements for developers is:

Good knowledge of Adobe Flex SDK and preferable experience with Flex modules


When students come to us to practice and ask where to start, then I advise them to compile and run the examples provided by ESRI development team, and then advise them to work with "Flex Viewer". It takes two weeks and students can create their own widgets, can extend the interface and business logic.

IMHO - all depends on developer experience.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
M Giles,

   As others have already said yes the boilerplate look is talking about the header over the map, the widget container(s) , etc.

As far as loss of functionality, there is NONE, How could there be when the Viewer is built on the Flex API ( the same one you would use when not using the Viewer).

I agree with Ivan about learning to program with Flex (learning basic Flex SDK), the Flex API samples are a great place to start as they are normally very focused and simple examples.

What I have figured out or the years of working these forums is that MOST people are not developers or wish to become developers they are more copy and paste ninjas and the Flex Viewer is perfect for them.
0 Kudos
MattGiles
Deactivated User
Just out of curiosity...

All these applications seem to be made with the flex viewer api:
http://gis.calhouncounty.org/flexviewer2.0/index.html?config=config-calhoun-classic.xml
http://www.oilsandsdevelopers.ca/index.php/interactive-map/
http://gis.waterburyct.org/FlexViewer/flexviewer1.3/

Is this look changed from the standard viewer look through skins? If so, are these skins available for download somewhere??
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Matt,

   Yes all these sites are using the Flex Viewer app but the last two in your list are using the old Sample Flex Viewer 1.x version. Though my site (the First one) gives the old look it is the latest Flex Viewer 2.5 version. As far as availability of skin code that is where most people do not share their stuff, so that they can maintain a level of uniqueness.
0 Kudos
MarkHoyland
Frequent Contributor
There are many incredible flex mapping sites with or without the viewer framework.
I dont think there is an advantage or disadvantage to either approach, if you are familiar with flex development.

Here is an ESRI blog that has skinned and customised the viewer. The description reads:

At the 2011 Esri Developer Summit we presented the "Go Electric" application to demonstrate how easily a Flex programmer could customize and extend the ArcGIS Viewer for Flex


The key point here is "how easily a Flex Programmer could customise".
http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2012/01/11/Taking-ArcGIS-Viewer-for-Flex-custom...

If you are serious about learning flex, I think keeping away from the both the viewer and mapping api is a good way to learn the foundations of flex.
If you already know flex then you should have the foundations covered.

Once you have solid flex foundations you can review the core mapping api and the provided ESRI samples, you can review the viewer and the many widgets, then make an informed decision of what is more suitable.
It comes down to your own site specific requirements, and/or personal preference.

If you just want to get a site up without learning the ins and outs of flex and are happy with being a "copy and paste ninjas" then the viewer is a good solid choice. You can customise widgets, create your own widgets and as the blog shows, skin the site too.
0 Kudos