Reducing the number of classes and methods
Here are several ways you can reduce the number of classes and methods:
Avoid unnecessary components
Ensure that the prerequisites of applications you are packaging are correct. If you have additional prerequisites that you do not need, the packaged image will almost certainly contain unnecessary classes and methods. Checking prerequisites contains information on validating prerequisites.
Also ensure that test code and other code which is necessary only in the development environment is contained in separate applications. Do not package these applications.
Minimize polymorphism
Because the packager includes all implementors of any referenced message, polymorphism means that methods that are unnecessary may sometimes be included. A good example of this problem is the class message initialize. This message is implemented and referenced in many places, and therefore it is likely that all implementors will be included in the packaged image. Most programmers, however, use the class method initialize only to perform initialization when the class is loaded into the image. This code is frequently unnecessary in the packaged image because it is not excecuted at runtime. To avoid this problem, you can rename such methods to initializeOnLoad. Then these methods will be left out of the packaged image.
Also, you should ensure that initializeOnLoad is not referenced by any method which will be included in the packaged image. If it is referenced, not only will your method be included, but also those of all other classes in the development image.
Create well-structured applications
With your knowledge of the applications being packaged, you might be able to remove individual methods and classes. However, it is not recommended that you do this. Rather, if methods and classes are not needed, you should restructure your applications to contain only the necessary classes and methods. If you do specifically exclude classes and methods, make sure you check for possible problems.
Last modified date: 10/11/2017