Unfortunatley, I'm not sure anyone really has any 'best practices'. (Or at leaset I'm not aware of any.)
Some things I usually try to do:
- I try to keep all my defines as upper case, whereas normal variable are declared with mixed case. (for example, !define VARIABLE or var MyVariable)
- When writing macros, it's good to include a !define so that you can enclose the entire include file inside an !ifdef statement. This way, if you try to include the same file twice, you won't get any nasty compiler errrors.
- Wrapping your macros inside of a define makes it easier to call the function. You'll find many examples of this throughout the various plugins that people have posted.
- While there is no hard and fast rules about when you should use an external include file, but generally it's good to do so if it would make your code easier to read. It's also wise to do it if you have certain functions that you find you share a lot between scripts. The downside is that sometimes it gets cumbersome to manage if you have too many NSH files.
- When working with large scripts, I find the best tool has been the NSIS plugin for Eclipse. (If you haven't looked into Eclipse, I would hightly recommend it. I has many so many useful functions to numerous to list here. I don't know how I ever coded without it!)
- I find my code is easiest to deal with if I place things in separate sections. For example, I group all my page functions separately from my 'real' functions. Also macros, variables, etc. have their own sections in my script.
- Last is document, document document! Unless you are blessed with photographic memory, it will make the code mush easier to deal with by having a good amount of comments in case you have to come back to it 6 months down the line and need to remember what you did! (Plus it helps anyone else if they need to help you modify the code.)
I'm sure there's probably more, but this should be a good start.