So AMD seems obviously the right choice for defining and loading modules, but what I haven’t found is any consensus on what a module should consist of. In CommonJS a module often seems pretty big, like an entire namespace. My approach when I converted Cesium to modules was to make them pretty small, one “class” per module. Erring on the side of smaller modules is really the only way to let an optimizer make applications small by only including modules that are needed.
Math is one that I couldn’t decide on. Here’s some other possibilities that I didn’t do:
Make a subfolder called Math, put one function per module in there. require([‘Core/Math/toRadians’]) The problem with this is that functions are often used in groups, e.g. toRadians/toDegrees so the result is even more module IDs in the (already overlong) require lists.
Break them up into smaller pieces that make some kind of organization sense. At the time I didn’t want to tackle that, but maybe that’s the best overall. If we do this, I would suggest not having anything so generically named as “Math” at all.
On the other end of the spectrum is Core/FAR, which I think is egregiously bad, but in the opposite direction. Sorry.