@yanong_banikanhon ok, i may have not clarified my point well.. sorry for my crappy words.. galisud gyud kog pasabot... sakto ka wala ko mag expose og implementation.. ang ako tag e point out is you are letting external entities to use your setters and getters what would happen if ma change ang implementation sa imong setters og getters is daghan ma apektohan for example if ang implementation sa setters/getters
this would require all classes nga naggamit ana nga mga setters and getters to be changed pud..Code:int getBalance(); void setBalance(int); //into double getBalance(); void getBalance(double); Class UserClass1 { private PrintCustomerBalance() { Customer cust = new Customer("CUST01"); int bal = cust.getBalance(); // needs to change print(bal.toString()); } }
anyways, mao na syay gi imposed ta sa gang of four.. if you read their books mao na ilang pasabot nganong evil na sya, pero that doesnt mean nga dli ka angay mo gamit ana depende na sa imong design. try to read sa link nga gi post sa TS mao sad ang gi sulti didto.
also try dont myn nlng ng ingn ana nga issue since most IDE karon naay refractoring nga feature. saun man tanang gang of 4 karaan mana sila.. lol..
also, setters/getters are only evil in strongly type languages, java, C#.net.. if adto ni sa mga scripting languages like python wala mani problema since dili man ka mag declare, tanan variant man.
thats why nag design sa java mo ana gyud nga python ang best language with regards to pattern



Reply With Quote
kinahanglan gihapon usbon ang mga codes nga dunay 'money.GetAmount();'.