Слайд 2
![Disadvantages of native methods: Not save – memory corruption errors](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-1.jpg)
Disadvantages of native methods:
Not save –
memory corruption errors may occur
Platform dependent –
native methods are less portable
More difficulties with debugging
Worse performance doing a small amount of work –
consume some resources for going into and out of native code
Слайд 3
![Use as little native code as possible](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-2.jpg)
Use as little native code as possible
Слайд 4
![Strive to write good programs rather than fast ones Don’t sacrifice sound architectural principles for performance](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-3.jpg)
Strive to write
good programs rather than fast ones
Don’t sacrifice sound architectural
principles for performance
Слайд 5
![Strive to avoid design decisions that limit performance Components interacting](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-4.jpg)
Strive to avoid design decisions that limit performance
Components interacting between modules
and with the outside world are difficult to change.
Слайд 6
![Consider the performance consequences of your API design decisions Mutable](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-5.jpg)
Consider the performance consequences of your API design decisions
Mutable public class
– may require a lot of needles defensive coping
Inheritance – ties class with its parent and may have limits on the performance of superclass
Interfaces – allow to create faster implementation in the future
Слайд 7
![Don’t warp API to achieve good performance Problems with performance](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-6.jpg)
Don’t warp API to achieve good performance
Problems with performance may go
away in future releases,
bad API – never
Слайд 8
![Measure performance before and after each attempted optimization Effect can be measurable or even negative](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-7.jpg)
Measure performance
before and after each attempted optimization
Effect can be measurable or
even negative
Слайд 9
![Java doesn’t have a strong performance model There is a](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-8.jpg)
Java doesn’t have a strong performance model
There is a gap between
what
the programmer writes and what the CPU executes
Слайд 10
![Item 56: Adhere to generally accepted naming conventions](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-9.jpg)
Item 56: Adhere to generally accepted naming conventions
Слайд 11
![Packages Components of package names should consist of lowercase alphabetic](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-10.jpg)
Packages
Components of package names should consist of lowercase alphabetic characters and,
rarely digits.
Components should be short, generally eight or fewer characters.
Meaningful abbreviations are encouraged
(For example, util rather than utilities)
Слайд 12
![Classes and interfaces Abbreviations are to be avoided, except for](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-11.jpg)
Classes and interfaces
Abbreviations are to be avoided, except for acronyms and
certain common abbreviations like max and min.
Acronyms can be either uppercase or have only their first letter capitalized
(The second is better. HTTPURL or HttpUrl)
Слайд 13
![Method and field names The same as classes’ names but the firstLetterShouldBeLowercase. If constant – UPPERCASE_WORDS_SEPARETED_WITH_UNDERSCORE](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-12.jpg)
Method and field names
The same as classes’ names but the firstLetterShouldBeLowercase.
If constant – UPPERCASE_WORDS_SEPARETED_WITH_UNDERSCORE
Слайд 14
![Local variable The same as members’ names but abbreviations are available](/_ipx/f_webp&q_80&fit_contain&s_1440x1080/imagesDir/jpg/203265/slide-13.jpg)
Local variable
The same as members’ names but abbreviations are available