Matt 5:16 "In the same way, let your light shine before men, that they may see your good deeds and praise your Father in heaven." (NIV)
Matt 6:3-4 "But when you give to the needy, do not let your left hand know what your right hand is doing, so that your giving may be in secret. Then your Father, who sees what is done in secret, will reward you." (NIV)
1 Peter 2:12 "Having your conversation honest among the Gentiles: that . . . they may by your good works, which they shall behold, glorify God in the day of visitation."
Matthew 23:3,5 "Do not ye after their [Pharisees'] works. . . . all their works they do for to be seen of men."
Skeptics ask: Are we to do our deeds before men (per Matthew 5 and Peter) or is that wrong (per Matthew 6 and 23)?
Note that Matthew 5 tells us to do deeds in the same way -- as what? The previous examples are of a city on a hill and a lamp. Lamps and cities don't light for the sake of showing off -- they are passive instruments. They don't seek or take praise; they don't know or care that anyone watches, they just shine and do their jobs. That's our example.
On the other hand, the Matthew 6 verse is after a warning about not making a public spectacle out of your giving, and not announcing it with trumpets like the hypocrites do. Now if you are publicly announcing your "good deeds" and being a hypocrite, you are far from letting people see your good works: You are in fact setting a bad example, and being a poor witness for Christ (and actually, just a jerk in general, whoever you are).
So the two pieces of direction in Matt. 5 and 6 are progressive education, and they go together: Set a good example, but don't show off, lest you tarnish those good works with the stain of hypocrisy, and thereby defame the cause of Christ. The remaining two verses then draw from this lesson.
We may note the relevance of honor and collective scrutiny in the ancient world. Matthew 5 teaches that works should be done publicly, but in the sense that because one is in public and under scrutiny, they should become a "light" -- the instructions here are parallel to OT admonitions to Israel to be a "light" for the nations, who were on the outside, looking in. Hence, as I have said, it is passive.
Salt has no effect unless it is applied to something; it doesn't go looking for food to jump on in order to season everyone's taste buds. Light does not serve as a guide if it is hidden under a basket, but it also doesn't blind your eyes jumping up and down getting you to notice it. The city on the hill does not serve as an admonishment to build atop hills, but to simply illustrate that the location will result in that city obtaining notice.
Can one give alms (the example) without benefit to the public? Obviously not; the very purpose of almsgiving is to benefit the public (especially the poorer segment). As we have already stressed, however, the latter chapter simply emphasizes that public works are not to be done for the sake of public attention. Public works done simply for the sake of the public will draw a desirable type of attention, on the other hand.
Inevitably we must distinguish between doing good works for the honor of the Father (the word for "see" is eido, and merely means being visible), and doing good works for your own honor (the word for "seen" is theaomai, which implies a much closer examination, and an attempt to grab public honor for one's self).
-JPH