Be a Dojo developer and more

1611
2
03-25-2015 08:51 AM
Labels (1)
ReneRubalcava
Frequent Contributor II
6 2 1,611

dojo_developer.jpg

Are you using the ArcGIS API for JavaScript on a regular basis? Do you want to take your development skills to the next level? Maybe you want to use the Web App Builder and create custom widgets. Maybe you're happy just throwing in some jQuery into your application and calling it day. Or maybe you want to push your skills a little further. I've said it before, but if you want to learn how to use the ArcGIS API for JavaScript, you need to learn yourself some Dojo.

Where to start

To get your feet wet, Esri provides a couple of quick guides on writing a class. By the way, JavaScript doesn't really have classes, but we can fake it. They even have a quick tutorial on writing a custom widget. I will disagree with one thing in that sample though. In the constructor:

this.domNode = srcRefNode;

The Dijit module _WidgetBase will handle this for you as part of the Dijit life cycle. You can read more about the lifecycle of a widget here.

Which brings me to the next resource I would recommend. The Dojo tutorials. The tutorial section covers everything from transitioning from 1.6 Dojo to modern Dojo to even creating builds. Although if you want custom builds of your app, I highly recommend grunt-esri-slurp or the ArcGIS JavaScript Web Optimizer.

You will probably also spend a lot of time in the Dojo reference guide. The samples in the reference guide are meant to introduce you to the concepts of the modules and at times may be a little confusing. If I had one wish, it would be to have both DOM attributed and pure code samples for some Dijit stuff.. Then there is the API documentation. The API docs can be a little difficult to navigate depending on your browser, but they do provide the nitty-gritty of what properties/methods are available. I've spent many a sunny afternoon in the dojox/lang/functional docs.

If you're thinking oh man, I don't want to spend a lot of time in docs, I don't know what to tell you. I work with a lot of different libraries, frameworks and languages and docs are the lifeblood of every single one of them. Roll up your sleeves, dig in and find some diamonds.

Next level

Another great resource for modern Dojo development, including updates to familiar modules is the Sitepen blog. You can learn more about the new Dojo testing tool called intern as well as dstore and dmodel. You'll even learn more about using modules like xstyle to do some really cool stuff. And of course, if you really want to dig in and see how things work, you can look at the Dojo source code. This is how I was able to figure out how to extend dojo/on for my purposes. You could even check out a very new framework using Dojo called Mayhem. It is still baking and in development, but it has some very nice tooling included. I'm still wading through this one myself. I also wrote an intro ArcGIS Web Development book that includes a lot of Dojo basics to get you up to speed for building ArcGIS API for JavaScript applications.

The point

If you want to really push your skills in working with the ArcGIS API for JavaScript, one of the first steps you need to do is get familiar with Dojo and it's capabilities. I promise you will improve your overall skills more than you imagined. You can still use other JavaScript libraries in your ArcGIS JS API apps, like React, Angular or Backbone, but Dojo is foundational to that knowledge and will only help you in the long run. Don't settle for meh, shoot for HELLZYEAH!

For more geodev tips and tricks, check out my blog.

2 Comments
BenFousek
Regular Contributor

Hellzyeah Rene Rubalcava​!

JeffPace
MVP Alum

I couldnt agree more.  Excellently written.

The more you use dojo, the less you "need" the other frameworks.  I spent alot of time getting the jquery i thought i "needed" back out of my code.

Dojo works.  And it works well.  Hellzyeah

About the Author
Softwhere Developer at Esri working on cool stuff! Author: Introducing ArcGIS API 4 for JavaScript: Turn Awesome Maps into Awesome Apps https://amzn.to/2qwihrV ArcGIS Web Development - https://amzn.to/2EIxTOp Born and raised in East L.A.