Gates are generally used to control access. If your sole purpose was to keep people out then you would just build a wall, but a gate allows access or egress. It allows you allow in what you want, it is under your control and it is your choice when it is open or closed.