Jab hum apne program me data ko validate kr rhey hon ge ya phir data pe koi check lga rhey hongey to isey hum "Business logic" kahen ge. For Example: if(weight > 0){..........}
Agar instance variable jisey hum apne program ki kisi property(get & set) me use kr rhey hon ge to best practice yeh hai k according to requirement hum is instance variable ka access modifier private rakhey kyun k hum property me use values ko check lga k safe kr saktey hain lakin instance variable ki value ko safe nahi kr saktey matlab yeh k agar instance variable ka access modifier public hoga to koi bhi class k bahr se is instance variable ko access kr sakta hai aur is ki value change bhi kr sakta hai.
No comments:
Post a Comment