In its Android developer articles, Google states that you should usually post public variables, not private ones, with getters and setters to improve performance on embedded devices (I suppose function calls are more expensive than just writing to an address).
I was wondering - to what extent should efficiency be sacrificed in order to adhere to the OOP paradigm? And in what other cases does optimization mean breaking away from “good” coding methods?
Build it for maintenance, and then hack it faster.
, , .
, .
.
: - . get, , , public OO. , , , .
, , , , , , "". , , , , "". , , , -, " ". , , .
, - . .
- , .
" : . ( !): ". - .
, , . , /, , - ? , , , " ".
Google , , , API . , / , . , , , - , .
, . , , Java, Fortran.
/ , . , , ressource, , . , Android.. Android, .
? ( MIPS, ).
/ , CPU reset ( , , , , ). / , . , , / , .
( +).
, Google , .
, , , , , .
, , , , 80% , 20% , . , , , , , Android ).
, Android , . - , , , . , , .
, Google ad absurdum, :
1 XML: 22 000: 15
1 XML: 22 000
: 15
, onLayout(), Adapter.getView() inflate(). .
, , . , . Android . , .
, get-get-getter/setter , " ", . , Java, " ", , - .
, ++, , .
, , , .
"" , , . , , . , - , .
; , . , , . , , , , .
Android . - , Android , ( ). . , .
Java , , .
Google , getters/seters Android. / . http://developer.android.com/guide/practices/design/performance.html:
" Getters/Setters
, ++, (, = getCount()) (i = mCount). ++, , , .
Android . , , . - , .
Millions of man hours have been wasted on these stupid little getters and setters. In most cases, they are not needed. Start with open fields, and you can always change their use to get / set methods later if necessary.
Source: https://habr.com/ru/post/1723929/More articles:Заполнение пользовательских объектов С# из полученной хранимой процедуры - c#Can't I use TryGetValue and assign a value to a property? - dictionarymysql group to return min and get the corresponding row data - sqlHow can I misinform my inclusion statements? - securityDrupal syntax highlighting - fckeditorZend Framework: how to combine two columns and use fetchPairs ()? - zend-frameworkforeach algorithm in C ++ - c ++Does anyone use boost :: multiindex as a single table database? - c ++Java callback function for each class method - javaIs there a digital image steganography algorithm that is resistant to image manipulation? - algorithmAll Articles