programming guidelines, ~hints by Stefan Kost email : kost@imn.htwk-leipzig.de version : 2.0 I wrote this, because I sometimes see people doing things which are unneccessary or could be done better. I don't want to say that my programms (SoundFX, FractalUniverse,... are perfect. This file is for collecting nice hints & tricks. So if you have some tricks, remarks, comments,... please let me know. -------------------------------------------------------------------------------- Don't Use Assigns ! ------------------- Every programm gets automatically an assign called progdir: from system. Therwith you can acess all file from the assign. Every additional assign you made has to set everytime the user boots his amiga an slowdown the boot-process. Furthermore if you use an assignmanager, the user has to move the assign from user-startup to his assign-manger everytime he is installing something. Keyfiles ! ---------- If your sharewareprogramm needs a keyfile, the please don't copy it to L: or S: or somewhere else. I started with SoundFX and FractalUniverse to make a drawer keyfiles in devs: and I recomend to place keyfiles there. This makes it possible to easilly backup your keyfiles. I've heard that some using a global env-variable called KEYPATH. Maybe check that too. But the best way is to show flexibillity, that means to look in several places (the progdir:, the devs:keyfiles, ...). Prefs ! ------- Everytime you boot you amiga, it has to copy all prefs from envarc: to env:. My suggestion is : Try to read prefs first from Envarc: and then from Env: If there's no prefs in Env: you already read the one from Envarc:. If all programms would do that, we don't need to copy them everytime. An easier way is to use 'HappyEnv' which could be found on Aminet:. This programm solves all these problems descibed above. Avoid copying to much to system-directorys ! -------------------------------------------- I advice you to create a local directory from progdir: and to copy everything which is only used by your program there (shared librarys, catalogs, online-help). Another advantage is with removing the entiere drawer you remove all things installed by the program. Maybe you ask the user (expert) during installation where to put it and during program runtime you check both locations. Avoiding too many requesters ! (Helmut Hummel) ------------------------------ Let the user decide which level of security requests he will have. E.g. three levels for closing a document : * ask never * ask only if unsaved * ask ever Default Tool Path (Phil Casidy) ----------------- Installer, Multiview, Amigaguide,.. : These Programs are installed in SYS:Utilities. So don't assume them somewhere else ! So the default tool for them should not include any path. Uploadarchives for e.g. Aminet ------------------------------ Start the short description of your readme with the version number. Don't include it in the name, because that would lead to dozen of different versions present in the same dir. Try to split the archive in subarchives if your programm becomes huge. E.g. different binarys, languages. This avoids downloading not needed stuff. Diskettes and harddisk ! (Kai Andres) ------------------------ When your program comes along on multiple disks, please don't always use their names to access files. Try to look for that file in "PROGDIR:" (or current dir) first before attempting to load it from a disk directly. Doing so, you enable the program to be installed onto harddisk by simply copying all files to the same directory. Minimize all diskaccess ! (Kai Andres) ------------------------- When some files are needed quite often, you better copy them into "RAM:" and read them from there to speed up loading. Don't ICONize everything ! (Kai Andres) -------------------------- Some people create icons for almost all kinds of files, even if they are just overlays or pure datafiles. I really don't understand that. Icons should only be used for programs that can be started alone or for projects, but NOT for things the user might get confused with. If you want to support "drag & drop" for changing datafiles (keyfiles for example), try to define their icons as projects that will start your program when mouseclicked. Check versions ! (Kai Andres) ---------------- When your program delivers and installs general libraries to any system- directory (such as "LIBS:"), don't just overwrite old files. Please check their versions first to avoid unwanted replacements of newer libraries with older ones. If you want to find out about Kickstart 2.0 or higher being used, simply try to open "exec.library", version 36. If this fails, the user still has Kickstart 1.3 or below in his Amiga (but don't forget to close the lib again after testing in case it could be opened!). ------------------------------------------------------------------------------- I got inspiration, comments, ideas from (in alphabetical order) : Andreas Mixich humpty@tomate.tng.oche.de Guido Mersmann geit@studst.fh-muenster.de Helmut Hummel hhummel@t-online.de Kai Andres Catboy@litter.leine.de Menno Tjoelker M.Tjoelker@mpn.cp.philips.com Matthias Andree M_Andree@tribal.line.org Phil Casidy pcasidy@pcmedia.fr Tak Tang tst92@ecs.soton.ac.uk So Thank you. To Matthias Andree (in german) : Wenn du manche Ideen nicht magst, kein Problem, das kann man aber auch freundlicher (taktvoller) ausdruecken !!! That's all for now. Please support it, by sending me suggestions. We need proffesional software to survive ! Ciao Stefan