Hacker News new | past | comments | ask | show | jobs | submit login

This is an interesting point. When one starts to become dogmatic about any kind of 'best practices' it can be difficult to see what benefit is actually gained from them. In any given situation, you should know when and when not to apply them. Clearly, testing accessor methods is a sure way to drive any programmer numb with tedium.



Perhaps that counts as an argument against accessor methods?


It's an argument against using accessors for the sake of using accessors.

It's important when learning any technique (and this goes not just for programming) to understand why that technique makes sense in this situation, which means that you can evaluate later situations on a case-by-case basis and decide whether or not that technique fits.

Too often people believe that a technique is good (Inheritance is good!) without fully appreciating why (Polymorphism). This means they start using it for other situations (code reuse) when it might make sense to do it another way (composition).


Thanks for interpreting my comment as more thoughtful than the blunt stab at OOP I wrote.


Yes! You can never have too many arguments against accessor methods...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: