The purpose of a funeral is to provide a way of commemorating a life and drawing together friends and family members so that they can support each other as they share memories. Although different religious communities have created set formats or rituals that they follow in conducting funeral services, there really is not a right or wrong way to do a funeral.
The most important thing to keep in mind when creating a service or commemoration is that it should be reflective of the person who has died. While religious elements may play a part, it should also include stories about the person's life that help everyone recapture and revisit their own memories. Sometimes this is best accomplished by having friends or family members share their reflections as part of the service. Some people personalize the service with special music (which may be religious or non-religious). Others bring in pictures to have at the service. Sometimes favorite things that belonged to the deceased are integrated into the ceremony such as wood carvings, golf clubs or even a motor cycle.
The goal is to give a true sense of who this person was. There is nothing wrong with telling funny stories about the person who died: a funeral recognizes the sad event of a death, but can include humor.
Whether or not an open casket is part of the ceremony is an individual family choice. The main reason that we have any "viewing," is because that allows people to have a physical presence to focus on when saying their goodbyes. Since most people are very visually inclined by nature, it seems to help them to see the person for the death to be "real" to them and allows them to better focus to begin to tidy up the loose ends that they have with this person. A funeral helps people begin to complete their relationship with the person who died, and sometimes seeing the body helps.
The value of the service depends on how it is constructed. Our family attempts to create funerals that leave families and friends feeling very lucky that the deceased was a part of their lives: the music, the stories, the whole nature of the person being well integrated into the service that it captures just who they were.