closed as primarily opinion-based by PolyGeo♦ Oct 27 '16 at 6:34
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
I agree with @evv_gis in that, at least from my experience so far, there is little in the way of best practices for this relatively niche area of development. However, I do have some recommendations from my own experience.
The ESRI API examples are an excellent source for learning techniques but don't base your development of any complex application on them. They are simple code examples to demonstrate a particular technique and don't represent a robust application which needs more defensive programming including error / exception handling and so on.
I encapsulate functionality into Dojo modules that can be re-used between applications. For example, MapUtils is a class I put basic functionality such as loading a layer (not just "map.addLayer', you need to validate the url, test success and handle if it didn't load). Then, SearchUtils for search related functionality, RouteUtiuls for routing (Network Analyst) related functions and so on.
Don't hardcode things such as spatial reference, layer urls and so on. You will end up with hard coded values dotted around even in modules you wrote to be re-usable. I retrieve most data / settings from DB via web service calls. If this isn't an option though, have a single place that defines the settings / content for your application, that isn't intended to be re-usable, and define things such as the spatial reference, initial extent and so on there. Then your re-usable code can be written to reference this.
On the subject of separating code into dojo modules, ESRI have written a primer in their Concepts section. Check this out and the other pages in the Concepts section to.
I admit this is more an anecdotal answer based on my own experience rather than known best practices but hopefully it will help. If you find anything yourself on this subject, please post it for others (including myself!).
However, since it was stacked up in 2009, it might have some bad links and no-longer-relevant content.