←Older revision |
Revision as of 14:13, 2 May 2010 |
Line 55: |
Line 55: |
| | | |
| This is an [[API]] that naturally guides users through the whole life cycle | | This is an [[API]] that naturally guides users through the whole life cycle |
- | of an object. In each phase only appropriate methods are available. Only | + | of an object (to be fair, I have to mention that it solves only the initialization |
| + | path, there is no easy way to make an already existing object ''obsolete''). |
| + | In each phase only appropriate methods are available. Only |
| such methods are shown in code completion inside an IDE. The possibility of | | such methods are shown in code completion inside an IDE. The possibility of |
| making an error is minimized. | | making an error is minimized. |
Line 67: |
Line 69: |
| If none of the above is available, then please at least follow credo of [[MartinRinard]]'s presentation [[Image:RinardOOPSLA06.pdf]] - ''don't throw needless exceptions unless you have to!''. Of course, during development strive for proper order of calls (e.g. ''start'' must be before ''progress''). But in production environment do your best to survive even wrong call order (which is easy in this case, just call the ''start'' automatically, if it has not been called yet). | | If none of the above is available, then please at least follow credo of [[MartinRinard]]'s presentation [[Image:RinardOOPSLA06.pdf]] - ''don't throw needless exceptions unless you have to!''. Of course, during development strive for proper order of calls (e.g. ''start'' must be before ''progress''). But in production environment do your best to survive even wrong call order (which is easy in this case, just call the ''start'' automatically, if it has not been called yet). |
| | | |
- | Help your users to be [[clueless]]. They will reward you by not hating your [[API]]! | + | Help your users to be [[clueless]]. They will reward you by not hating your [[API]]! Or at least their feelings are not going to be as negative as mine, whenever I have to deal with [http://bits.netbeans.org/dev/javadoc/org-netbeans-api-progress/overview-summary.html this one]. |
| | | |
| + | <comments/> |
| | | |
| [[Category:APIDesignPatterns]] | | [[Category:APIDesignPatterns]] |
| [[Category:APIDesignPatterns:Anti]] | | [[Category:APIDesignPatterns:Anti]] |
| + | [[Category:APIDesignPatterns:Clarity]] |