There are laws you cannot make - top level things that would break international treaties, breach human rights, or just lead to civil war. I nearly did not put this category in this post, but then realised that a right to privacy is one of those human rights things... Hmmm
Laws that cannot be detected to be enforced
You can't sensibly make something illegal that is impossible to detect and so enforce. In some ways the laws that existed against being gay are a bit like that - essentially the only proof was something done in the private, so only by admission or catching someone in the act would you catch some. It is a stupid law for moral reasons, but also for purely practical reasons of being hard to enforce.
Outlawing something everyone wants
Another good example is laws that try to outlaw something that is, by human nature or common practice, something people want to do. A good example is banning alcohol in the US. When you make a law like that you don't stop people doing it, but you drive it underground, making it hard to detect. You also create a huge problem that people become criminals anyway, so they have something to hide. People with something to hide get sucked in to more criminal behaviour and can be blackmailed. Before you know it you have the mob. Regulating such things so that you allow most people to do what they want within limits and still be legal is much more likely to succeed and make the criminal element unprofitable. The same is true for copyright violation - allowing people to easily and cheaply and legally access material is the way to stop the unwanted behaviour, not laws making something simple and wanted actually illegal.
Making everyone a criminal
Another big problem is that it is easy to make everyone a criminal with a stupid law. This has all sorts of problems. Much like the above, you could create an underground market of some sort, but if you really make something we all do every day illegal you end up with a law that is largely ignored. There is simply no way to enforce such laws. This is where banning use of any means of communications that cannot be read under an order from the Home Secretary (something David Cameron is calling for) would be silly. Everyone that uses FaceBook, iMessage, online banking, the conservative party web site, or even a cash machine, would be a criminal.
Making everyone a criminal causes all sorts of issues. You have people that try to comply, but can't so they take their business or themselves out of the UK. You have the problem with people with "something to hide" so can be blackmailed. You also create a convenient "We can arrest anyone we like" logic for police, as they just have to arrest you for having an iPhone. It is unworkable.
When can you make a law?
A law has to do some good and meet an actual requirement. It has to be proportionate - the cost of complying and enforcing the law has to reflect the benefit gained (questionable for many anti-terror related laws). It has to be detectable and enforceable. It also has to be something the public are happy with, as, after all, the government do work for the people!
Obviously a law does not have to be 100% - some people with evade detection. For most laws this is a simple matter of economics - a trade off for effort to catch every last transgressor compared to the cost/damage caused by them. However, for anti-terror laws, this is not the case. We are making anti-terror laws when there have been tiny numbers of terrorist attacks. Allowing one terrorists cell to evade the law would be unacceptable, if we are to believe the rhetoric of politicians. For an anti-terror law to be justified in the first place you have to make it one that can be 100% enforced as it only takes one nutter with a small nuke to ruin your whole day.