Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Over on the Esri forum, user Matt Moyles suggested that the approach used in the Esri JS samples isn't suitable for robust development of a web mapping application using HTML, JavaScript and CSS:

ESRI's suggested approach to javascript application development is ancient and outdated. I would not recommend following the samples. Dojo 1.7 supports AMD with Asynchronous dependency loading. I would start with the dojo boilerplate template and "work" the arcgis api into that. The samples are not suitable for serious application developers. They are mostly just proof of concept snippets.

A serious application should be developed with the aid of some sort of framework to help structure things. I have been using dojox.mvc with great success! But other options include things like backbone.js, spine.js, or even javascript MVC.

Dojo Boilerplate - https://github.com/csnover/dojo-boilerplate

  • does anyone agree/disagree with this statement?
  • are there any online examples of better approaches to web application development using the ArcGIS Server JS API?
share|improve this question
1  
yes dojo 1.7 uses AMD but the latest esri js api is built on top of dojo 1.6.1 and the layer packages/modules that they serve or you can download are not in the AMD format. Therefore it wouldn't just work. It seems silly to load the js api (dojo 1.6.1) and dojo 1.7 just to use AMD –  Steve Jan 12 '12 at 16:42
    
I just noticed that there's a session on backbone.js at the Esri Developer Summit this year. –  Stephen Lead Jan 19 '12 at 5:22
    
I ran into trouble using the latest dojo boilerplate. I fell back to a 1.6.1 boilerplate package since that is what esri supports. ESRI will prob. release AMD version of their API for dojo 2.0. Here is the boilerplate project I used blog.rebeccamurphey.com/a-dojo-boilerplate (Matt Moyles) –  dubvfan87 Feb 27 '12 at 16:26
add comment

4 Answers

up vote 7 down vote accepted

I would agree with Moyles that the samples are just samples and dojo boileplate is a great resource however at current snovers boilerplate isn't a viable solution. You have two different versions of dojo going on there. The current js api still uses the classic require syntax of dojo 1.6.1 and does not support AMD. I'm sure that a newer js api will be built on 1.7.x and since converting classic dojo.defined modules to AMD is mostly trivial I would choose that route.

If you're starting your project now then I would choose whatever server side framework you wanted to use (if it is necessary for your application. If its just a single page viewer with no server side requirements then don't over complicate things). It could be rails, php, asp, whatever. Follow the best practices for your framework/language.

Then since esri is built on dojo you are already loading a great js framework for creating large scale web applications. Structure your code so that the dojo's loader can load your widgets and modules with the dojo require syntax. Write dojo widgets and modules, use dijits and dojox tools when necessary ( http://dojotoolkit.org/documentation/tutorials/1.6/declare, http://dojotoolkit.org/documentation/tutorials/1.6/recipes/custom_widget/, http://dojotoolkit.org/documentation/tutorials/1.6/understanding_widget, http://dojotoolkit.org/documentation/tutorials/1.6/templated, http://dojotoolkit.org/documentation/tutorials/1.6/cdn). Do not write inline js like the samples do. Create a build profile to optimize all your code when its time for production.

You have to keep your esri and custom code separate to a certain degree because they don't offer the source for compiling - it's already built and minified. The build tool doesn't like that so much.

share|improve this answer
    
Cool, thanks for the info –  Stephen Lead Jan 12 '12 at 19:30
add comment

It should be pretty obvious that samples aren't meant to be serious applications: they're samples.

That said, it's much less common, in the typical internet world, to use something like Backbone than to use dojo, which is known for being expansive and complex, but often unnecessary.

If you could describe your objective more, it'd be easier to make a solid recommendation. Stuff like Backbone is written for full client-side applications - so if you're actually doing most of your work in PHP or ASP or nodejs, it's less necessary. Or if you don't need multiple pages and views all wired up, you could easily get by with just jQuery, or no framework at all.

share|improve this answer
1  
if the esri code is built on top of dojo why would you use anything other than dojo? Dojo can do all the things backbone can and jquery. You're already loading a very capable framework, why would you recommend loading other ones? –  Steve Jan 12 '12 at 16:40
    
@tmcw fair enough that the identify tool sample shouldn't be used to develop an application - but what about the more complete ArcGIS.com-based samples? Are Esri on the wrong track with these? –  Stephen Lead Jan 12 '12 at 19:26
    
@tmcw as for my objective, here is an example of a site I worked on, using the Esri Dojo approach. If I was to start it again tomorrow, should I do it differently? –  Stephen Lead Jan 12 '12 at 19:28
2  
@Steve yep, there's a recording of the talk here if you're interested. –  Stephen Lead Jan 13 '12 at 1:04
1  
@StephenLead i was there :) –  Steve Jan 17 '12 at 19:30
show 3 more comments

Totally agree. ESRI is javascript api, i feel like they are competing with ArcGIS Viewer for Flex. Samples are nothing but just proof of concept that how can you can use their dijits...I wish that they just provide a simple pure javascript API, and let user decide which framework people gona use like Bing, Google, Openlayers and several other...

share|improve this answer
add comment

jsRevolution, OmniStation's new JavaScript Framework and Build Tool, is the most robust commercially available framework on the market. It is designed for large-scale deployments of non-trivial applications. I represent OmniStation. Our clients may have 100's or 1000's of classes, 10's even 100's of developers. While these clients will find the framework indispenable, jsRevolution is practical for certain applications with as few as 25 classes.

jsRevolution's many features include: Asynchronous Loading, Codeless Namespacing, URL Switchable Code View (from Dev to Deploy), Codeless Inheritance with build-time validation, Codeless Interface with load-time validation, Codeless Abstraction (sometimes referred to as Mixin), the ability to identify a resource as an instance class, Multi-Versioning (multiple versions of classes within the same application -simple to execute), and many other features.

share|improve this answer
    
Hi Ryan, welcome to our site! I have made minor edits to your answer to conform to our policy about commercial posts. For more information, please consult our faq. If you would like people to get in touch with you, you may use your user profile to present contact information. –  whuber Apr 30 '13 at 14:33
1  
DO you have a link of a ArcGIS JS API mapping site using your technology? Otherwise this answer just feels too much like spam. –  Devdatta Tengshe Apr 30 '13 at 15:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.