Question

I'm reading Code Complete 2, and I'm at the chapter where it says to (paraphrasing) "avoid programming through the interface." Why is it bad to program "through" the interface?

A more concrete example: if I have a method of a class that submits a funny picture, what's wrong with it logging me in also? Should I simply provide more "helper" methods that do it automatically?

Would it be preferred to break it up into:

  • set_login(username, password)
  • login()
  • submit_picture(funny_picture)
  • easy_submit(funny_picture) # where it will log in (if not already) and submit

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top