I think some people expect Starfleet officers to be always formal while on duty and to always observe discretion, especially on the bridge. But I think that's where we're reminded that Star Trek is first and foremost a television series or a movie. Too much formality among characters can easily produce complaints of them being "wooden" or outright dull. While some may consider this just being professionalism and more proper behavior, it can also lend itself to lower ratings or lower box office turnouts--where the rubber meets the road. So writers will have characters do things for dramatic or even comedic effect that may not fly at all otherwise.