What is the best approach to write hooks? I had to use some hook functions on almost every project I worked, right now I am working on a project ( basically to collect donations and maintain organizations list ) where I need to write lots of custom code, at first I started to write all the code in theme i am developing, later I realized that its not going good with all the functions in theme because some hooks need to be written in modules so now some of the code is written in module and some is in theme which breaks the functionality when switch theme or with admin theme.

So I am thinking to write all the code again but not sure what is the best approach to write custom code in a drupal project.

if all code goes in custom module some of the theme sections needs to be rebuild and I didnt find any proper article on net on this
I think your question is more of in-general type . Please specify for what all purpose you need to use hooks .
I think this might be helpful for you : http://www.stephanemartinw.com/articles/25-theme-drupal-hooks-templates-functions

Thanks