It seems to me like this:
var point;
require(['esri/geometry/Point'], function(Point) {
point = new Point();
}
does the same thing as:
var point = new esri.geometry.Point();
Is there any reason to opt for AMD-loaded constructors?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityThey are functionally equivalent. The difference is that require() loads modules using AMD while your second example uses a class from a global variable populated by Dojo's module loader in legacy mode. Technically, you should have to use dojo.require("esri.geomtry.Point") for your second example to work but because the module that defines that class is included in the built version of the API we (Esri) provide, and it's made available via the global esri object, your code will work.
The recommended approach is to use require(). When Dojo goes to 2.0, the legacy loader will be removed and the only way load modules will be require(). Once the esri js api is using Dojo 2.0, there will not be a global esri object by default so all code referencing classes from that global will break.